-
Notifications
You must be signed in to change notification settings - Fork 4
Deployment
The code on the live server is deployed by pushing to a "live" repo which lives on the live server under /var/repo/restarters.git. You'll need to have set that up as a remote if you're doing this for the first time. See internal Server & Deployment doc for more info.
git checkout develop
git pull
git checkout master
git pull
git merge develop
git push origin master
This will trigger a build on CircleCI - wait and check this works.
We have a production
branch that functions as a build and deploy branch. Assets and dependencies are built and installed locally (e.g. via npm build / composer installs etc) and committed to this branch in order to get pushed to production. We don't build on production. These assets and dependencies are not checked in to other branches.
(Note: in order to push to the production server, you will already need to have set it up as a remote. e.g. git remote add live ssh://restarters/var/repo/restarters.git
.)
git checkout production
git pull
git merge master
# Do a diff to check if any new .env values need setting up on prod - if so, they will need to be added manually.
<diff-tool-of-choice> .env.example .env
composer install --no-dev
npm install
php artisan lang:js --no-lib resources/js/translations.js
export NODE_OPTIONS=--max-old-space-size=8192; npm rebuild node-sass; npm run prod
php artisan l5-swagger:generate
git add public resources vendor node_modules composer.lock composer.json package.json package-lock.json storage/api-docs/api-docs.json
# Note: next step may fail with 'nothing to commit, working tree clean' if npm run prod didn't produce any changes
git commit -m "Build assets"
git push origin production
This will trigger a CircleCI build. Wait for that to complete.
IMPORTANT!: Before pushing to production, take a backup of the code folder on the server that we can easily restore to if something goes wrong:
ssh restarters
cd /srv/users/serverpilot/apps
sudo cp -r restarters restarters.`date +"%Y-%m-%d"`
git push live production
- run migrations
cd /srv/users/serverpilot/apps/restarters/
echo yes | php8.2-sp artisan migrate
php8.2-sp artisan view:clear
- translations
Import newly added translations to the translation manager:
php8.2-sp artisan translations:import
Generate new API docs:
php8.2-sp artisan l5-swagger:generate
chown -R serverpilot:serverpilot storage/api-docs
- .env
If any new values flagged for addition from diff step earlier on, add them in to .env.
php8.2-sp artisan queue:restart
Take the server out of maintenance:
rm storage/framework/down
First check top level sections look OK. (i.e. click through Fixometer, Events, Groups sections), and anything relevant to the specific release that might need an extra look at.
Then run through tests at https://github.com/TheRestartProject/restarters.net/wiki/Regression-Testing.
Monitor Sentry over the next couple of hours to spot any sudden breakages.
Make sure develop
has latest changes from master
for our new sprint:
git checkout develop
git pull
git merge master
git push origin develop
Publish a new release at https://github.com/TheRestartProject/restarters.net/releases
Things to check if you get a white screen of death.
- Have a look in the log files to get an idea what the issue is.
- e.g.
view /srv/users/serverpilot/log/restarters/restarters_php8.2.error.log
- e.g.
- Try clearing various caches (see e.g. https://stackoverflow.com/a/54334729)
php8.2-sp artisan cache:clear
rm -rf bootstrap/cache/*.php
php8.2-sp artisan optimize:clear
If something went wrong during deployment of code and you can't resolve it, revert back to the folder backup you took earlier:
sudo mv restarters restarters.broken
sudo cp -r restarters.`date +"%Y-%m-%d"` restarters