Giter VIP home page Giter VIP logo

application-skeleton's Introduction

SumoCoders Application Skeleton

Use the following commands to create a new project:

composer create-project sumocoders/application-skeleton my_project
git init
git add .
git commit -n -m "Initial commit"

Start you project by running:

symfony serve
npm run watch

Configuration

Deployment

Open deploy.php and check the configuration, replace the example values (prefixed with $) with correct values.

Try to deploy to staging by running:

symfony php vendor/bin/deployer.phar deploy staging

Log in through ssh on the dev-server and alter the .env.local-file to use the correct credentials.

Continuous deployment to staging

Each time something is merged into the staging branch it can be deployed automatically. To do so, follow the steps below:

  1. Open the project in Gitlab.
  2. Open Settings → Repository → Deploy Keys.
  3. Click the tab "Privately accessible deploy keys" and enable the key called "Sumo deploy user".
  4. Open Settings → CI / CD → Variables.
  5. Add a variable called SSH_PRIVATE_KEY, the value can be found in 1Password under "Sumo Deploy User private key". You can check the "Protect variable" flag.
  6. Add a variable called SSH_KNOWN_HOSTS, the value should be the output of ssh-keyscan -H dev02.sumocoders.eu.
  7. Open .gitlab-ci.yaml, scroll to Deploy - to staging.
  8. Alter the url under environment → url.

Usage

Using Encore

Building assets:

# compile assets once
npm run dev

# or, recomile assets automatically when files change
npm run watch

# on deploy, create a production build
npm run build

For more information about Encore, see the official documentation.

Tests

We use panther to add functional tests to our project. By default, a page response 200 should be tested on al pages. To do this you can add your urls to the providePublicUrls and/or provideLoggedInUrls.

Working on the Skeleton

Testing create-project locally

There is a test-script scripts/test.sh which you can use:

COMPOSER_MEMORY_LIMIT=-1 ./scripts/test.sh BRANCH-TO_TEST TARGETDIR

This will create a new project that uses the commited code in the selected branch. The new project will be located in the TARGETDIR

Kudos to beporter.

application-skeleton's People

Contributors

tijsverkoyen avatar absumo avatar stijnvrolijk avatar jonasdekeukelaere avatar daphneslootmans avatar bjorvack avatar katrienvh avatar davysumo avatar dependabot[bot] avatar

Stargazers

Yifans_Z avatar Burak Sormageç avatar

Watchers

 avatar James Cloos avatar  avatar Jelmer Prins avatar  avatar Aurélie Vandaele avatar  avatar  avatar

application-skeleton's Issues

Pipeline fixes

These are still issues that occur when running a CI pipeline on a new skeleton project:

PHPStan

 Line   src/Repository/User/UserRepository.php                                 
 ------ ----------------------------------------------------------------------- 
  88     Method App\Repository\User\UserRepository::getAllFilteredUsers()       
         return type has no value type specified in iterable type               
         SumoCoders\FrameworkCoreBundle\Pagination\Paginator.                   
         💡 See:                                                                
         https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-i  
         terable-type                                                           

Edit: Fixed in sumocoders/FrameworkCoreBundle@4e2fb98

  Line   src/Security/CustomAuthenticator.php            
 ------ ------------------------------------------------ 
  37     Expression on left side of ?? is not nullable.  
  38     Expression on left side of ?? is not nullable.  
  39     Expression on left side of ?? is not nullable.  

Edit: Fixed in sumocoders/Framework-User-Implementation-Example@cf2df0a

     Error                                                              
 -- ------------------------------------------------------------------- 
     Ignored error pattern #array of function array_map expects array,  
     iterable<.*># was not matched in reported errors.                  
 -- ------------------------------------------------------------------- 

Standard.js

standard: Run `standard --fix` to automatically fix some problems.
  /builds/getuigenonderweg/app/assets/app.js:14:1: Do not use 'new' for side effects.
  /builds/getuigenonderweg/app/assets/controllers/hello_controller.js:1:48: Extra semicolon.
  /builds/getuigenonderweg/app/assets/controllers/hello_controller.js:13:1: Expected indentation of 2 spaces but found 4.
  /builds/getuigenonderweg/app/assets/controllers/hello_controller.js:13:12: Missing space before function parentheses.
  /builds/getuigenonderweg/app/assets/controllers/hello_controller.js:14:1: Expected indentation of 4 spaces but found 8.
  /builds/getuigenonderweg/app/assets/controllers/hello_controller.js:14:103: Extra semicolon.
  /builds/getuigenonderweg/app/assets/controllers/hello_controller.js:15:1: Expected indentation of 2 spaces but found 4.

To-do: remove hello_controller.js by default?
Edit: PR: #67

SensioLabs Security Checker Discontinued

"sensiolabs/security-checker": "^6.0",

Excerpt from SensioLabs Security Checker:
WARNING: Don't use this piece of software anymore as the underlying web service will stop working at the end of January 2021. Instead, use the Open-Source CLI tool that does the same locally, or use the Symfony CLI tool.

Including it will add a script to composer auto-scripts that will break any and all composer commands in dev env.

Missing components

This is a list of components that almost any of our framework projects will use but are not present in the skeleton composer.json as of today:

  • symfony/form
  • symfony/messenger
  • symfony/validator
  • annotations
  • symfony/mailer
  • symfony/dotenv *
  • symfony/monolog-bundle *
  • symfony/yaml *

* are required to deploy to staging

blocks.html.twig

In config/packages/twig.yaml we ask for a blocks.html.twig file, but this file isn't in the templates folder of new projects by default. We should create it in the PostCreate script.

Webpack config missing Vue loader

When setting up a new framework project, the following error is thrown during npm run build

Error loading ./node_modules/frameworkstylepackage/src/js/Framework/Components/Toast.vue

NPM suggest: To load Vue files: 1. Add Encore.enableVueLoader() to your webpack.config.js file.

Since our core bundle and style package include Vue files now, we should add the Vue loader by default.

Lock cachetool version by default

Right now we run into issues when deploying older projects because the default Deployer recipe always downloads the latest version of cachetool (which is now 8.x), but if you're deploying a project on 7.4, this crashes the deploy.

Edit: Deployer latest release (17 days ago) actually fixed this and now defaults to the 7.0.0 version of cachetool, which is compatible with 7.4

Deployer currently uses a cachetool_url option, see https://github.com/deployphp/deployer/blob/master/contrib/cachetool.php#L54. Which defaults to the 7.0.0 version. We should be able to set this url in our deploy.php with the appropriate version. See https://github.com/gordalina/cachetool#compatibility for version compatibility.

To avoid these kind of issues in the future, we should lock the cachetool version. Each cachetool version has a unique download URL, so we should be able to automagically fetch the correct version of cachetool based on the PHP version of the project. Extend or override the default Deployer task, adjust the URL, done.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.