The CMS of Swiss Tchoukball is using Directus.
Production is on cms.tchoukball.ch
Staging is on staging.cms.tchoukball.ch
Production and staging are hosted on an Infomaniak Managed Cloud Server.
Deployment is currently not automated.
To update the deployment, one has to SSH on the server and pull the latest version from origin.
Based on Infomaniak documentation.
To show the list of active crons: crontab -l
.
After having cloned the repository:
npm install
- Duplicate
.env.example
into.env
and provide a value for theSECRET
env variable (this only needs to be done the first time) docker compose up
(to start the DB)- Dump the production DB and import it to your local DB (this only needs to be done the first time, or if you want to get up to date schema or data)
- Copy the content of the
uploads
folder locally (this only needs to be done the first time, or if you want to get up to date uploaded files) npm start
- Make sure that both staging and production DB are on the same version of Directus
- Backup the staging DB
- TODO: instructions to dump production DB
- TODO: instructions to restore staging DB from production DB dump
Possible references to come up with step 3 and 4.
- https://phoenixnap.com/kb/how-to-backup-restore-a-mysql-database
- https://dba.stackexchange.com/questions/8869/restore-mysql-database-with-different-name
TODO: Set up a Github Action to automate this.
This implies a downtime of Directus, and thus, of the website.
TODO: Set up a maintenance page on the frontend that can be used when updating the CMS.
-
Do a backup of the
sites/directus/
(includingnode_modules
) -
Disabled the cron so that it doesn't interfere with the update
- Open the crontab config with
crontab -e
- Comment the line for the cron handling Directus
- Save changes
- Open the crontab config with
-
Stop directus with
pm2 stop directus
-
Apply the dependencies update
- In production or staging, this should be done by pulling the latest state of
main
(as the update should have been tested first locally), and runningnpm ci
. - If upgrading Directus: Directus - upgrading a project
- In production or staging, this should be done by pulling the latest state of
-
Restart directus with
pm2 restart directus
-
Re-enable the cron
- Open the crontab config with
crontab -e
- Uncomment the line for the cron handling Directus
- Save changes
- Open the crontab config with
TODO: Automate the whole thing
And a message saying Current process list running is not in sync with saved list
Running pm2 update
should solve the issue.