================== SQL Default Schema ================== Use case ======== The backend of the application creates the SQL tables in the database public schema by default. If you want to use a different schema, you need to set it up. Configuration ============= You need to setup the `DB_SCHEMA` variable in `/app/instance/config.py`: .. literalinclude:: config.py :language: python Now you need simply to mount your configuration file in the backend container. Here is how to do it in the `docker-compose.yml`: .. literalinclude:: docker-compose.yml :language: yaml .. warning:: If you mount the `instance/config.py` to `/app/instance/config.py` this way when initializing your application the first time, it will use it verbatim, bypassing the configuration from environment variables. So you better initialize it first with the default installation method, then copy it on your host system and override the proxy config, before changing the `docker-compose.yml`. Otherwise you'll use the default placeholder security settings which is not ideal in a production environment. One way to do it is to simply run the backend container alone with the configuration script: .. code:: bash docker run --rm --entrypoint /app/configure-backend.sh \ -e DB_URI=postgresql://aileron:pass@database/aileron \ -e CELERY_BROKER_URL=redis://redis:6379/0 \ -v ./instance:/app/instance \ registry.gitlab.com/decide.imt-atlantique/deseasion/backend:latest This will create the file `instance/config.py` on your system. You can provide the environment variables for the configuration script with `-e` options. .. warning:: If you already deployed and started using the application stack on the wrong database schema (e.g the default public schema), you need to migrate the tables in the new schema before changing the configuration. For that, with your original configuration intact, run the following command: .. code:: bash docker compose exec backend flask db migrate-schema Then, modify the `/app/instance/config.py` file to use your new SQL schema, and restart the whole application stack (or at least the backend and worker containers).