Systems administrator's guide Installation guide
28 mai 2024 à 05:35Installation guide
Note: all available administration/development commands are visible by running make
.
Run the app
This only command is sufficient to run the whole stack in one stretch:
APP_ENV=prod make deploy
It is equivalent to the following commands:
make run_maintenance_app # Display maintenance page
make prod_config # Configure environment variables
make build # Build Docker images
make run # Run containers
make alembic_migrate # Run database migration
make stop_maintenance_app # Hide maintenance page
The list of available APP_ENV environments:
-
dev
: For local development. -
ci
: For Continuous Integration on Gitlab. Without Traefik proxy. -
review_app
: For Review Apps on Gitlab. Similar to production configuration. -
prod
: For production usage.
Initialize the secrets
Once the app is running, generate the root password by running following commands:
docker compose exec -it server python
>>> from app.services import auth_service
>>> auth_service.create_salt_and_hashed_password(plaintext_password="YOUR_PASSWORD")
Then, copy and paste the password and the salt in the ROOT_PASSWORD_HASH and ROOT_PASSWORD_SALT environment variables respectively (in the backend/.env
file which has been generated by the previous *_config
command)
Generate the JSON Web Token secret key:
openssl rand -hex 32
Then, copy it in the SECRET_KEY
environment variable.
Configure the URLs
In the backend/.env
file, replace VITE_APP_SERVER_HOST
with your real domain name and set VITE_APP_SERVER_WS_PROTOCOL='wss'
if your reverse-proxy can handle SSL/TLS like for HTTPS (recommended).
Set the analytics
If you want to follow the visitor’s activity on the app and you have a Matomo instance, you can configure Petit Rapporteur to send data to it.
In the backend/.env
file, you need to put the Matomo’s domain name in ‘VITE_APP_MATOMO_DOMAIN’ and the ID, given by Matomo after having declaring a new website, in VITE_APP_MATOMO_SITE_ID
.
Take changes into account
Finally restart the app in order for the environment variables to be taken into account:
make stop && make run