Skip to content

Deployment

dps.lwk edited this page Aug 3, 2024 · 2 revisions

Production should be on the release branch, which when ready it fast forwarded to master and tagged with a version number

Production deployment - Release

  • git pull
    pull down the latest release code

  • git submodule update --recursive
    update the submodule's (can be skipped)

  • git describe --always --tags --dirty >version
    save the version number

  • composer install --optimize-autoloader
    if composer.json or composer.lock has changed install the new php dependencies

  • npm ci
    if package.json or package-lock.json has changed install the new js dependencies

  • php artisan cache:clear
    clear the application cache

  • php artisan migrate
    if there is a new migration in database/migrations, update the DB structure

  • php artisan doctrine:migrations:migrate
    if there is a new doctrine migration in database/migrations_doctrine, update the DB structure

  • php artisan hms:database:refresh-views
    if the database submodule has changes to the views database/database/views/*.sql, refresh them

  • php artisan hms:database:refresh-procedures
    if the database submodule has changes to the stored procedures database/database/procedures/sp_*.sql, refresh them
    note changes to stored functions database/database/procedures/fn_*.sql, will need to be loaded by had with a SUPER db user

  • php artisan config:cache
    if .env has been changed, any file under config/ or composer was ran
    update the application config cache

  • php artisan route:cache
    if any file in routes/ has changed or composer was ran

  • php artisan view:cache
    if any file in resources/view/ or resources/lang/ has changed or composer was ran

  • php artisan event:cache
    if any app/Event/, app/Listeners/ or app/Providers/EventServiceProvider.php has changed or composer was ran

  • php artisan auth:clear-resets
    TODO: LWK remember why this might be needed

  • php artisan doctrine:clear:metadata:cache
    if any changes in the mappings app/HMS/Mappings/, clear doctrine metadata cache

  • php artisan doctrine:clear:query:cache
    clear doctrine query cache

  • php artisan doctrine:clear:result:cache
    clear results doctrine cache

  • php artisan doctrine:generate:proxies
    if any changes in the entities app/HMS/Entities/ or mappings app/HMS/Mappings/, generate the doctrine proxies

  • php artisan permissions:sync
    if any changes to the permissions or roles config/roles.php, you can check for issues first with php artisan permissions:compare

  • php artisan meta:sync
    if any changes to the Meta defaults config/meta.php, sync them

  • php artisan db:seed --class ContentBlockSeeder
    if any new ContentBlocks have been added to database/seeds/ContentBlockSeeder.php, load them into the db

  • php artisan horizon:terminate
    restart the background workers so they pick up the new code, Check this has worked by visiting the /horizon page, it may need a stronger kick with sudo systemctl restart horizon.service

  • php artisan ziggy:generate resources/js/ziggy.js
    if any file in routes/ has changed

  • npm run production
    if npm ci or ziggy:generatewas ran or any resources/js/, resources/sass/ file has changed
    regenerate the js and css assets

git pull
git submodule update --recursive
git describe --always --tags --dirty >version
composer install --optimize-autoloader
npm ci
php artisan cache:clear
php artisan migrate
php artisan doctrine:migrations:migrate
php artisan hms:database:refresh-views
php artisan hms:database:refresh-procedures
php artisan config:cache
php artisan route:cache
php artisan view:cache
php artisan event:cache
php artisan auth:clear-resets
php artisan doctrine:clear:metadata:cache
php artisan doctrine:clear:query:cache
php artisan doctrine:clear:result:cache
php artisan doctrine:generate:proxies
php artisan permissions:sync
php artisan meta:sync
php artisan db:seed --class ContentBlockSeeder
php artisan horizon:terminate
php artisan ziggy:generate resources/js/ziggy.js
npm run production 
Clone this wiki locally