Skip to main content

Deployement

The deployement is done with Docker and Docker Compose that package everything needed in containers.

The following are thus needed on the production server:

  • Docker Engine v20+
  • Docker Compose v2.12+

The two Docker Compose files staging.yml and production.yml with correctly configured environment variables give the possibility to have completely separate Docker containers and volumes, so that a staging and a production environment can be run on the same machine independently.

info

The SSL/TLS encryption is not done in one of the Docker layers of this application, so you will have to do it before the traffic hits the Traefik container entry point.

To start the deployement you need to clone the repository on your server:

git clone https://gitlab.com/koena/connect-access/connect-access.git

Environment variables

Most of the configuration is done through environment variables that are loaded by Docker Compose from files in .envs/ folder.

Create the files

First you need to copy .envs/production_template/ for production and staging environments:

cd connect-access
cp -r .envs/production_template .envs/.production
cp -r .envs/production_template .envs/.staging

Fill the values

You have to fill the values for all the 5 configuration files:

DATA_PLATFORM_NAME
The name of the platform that will appear publicly instead of "Connect Access".
DATA_PLATFORM_DOMAIN_NAME
The domain name of your website.
DATA_COMPANY_NAME, DATA_COMPANY_EMAIL
Your company name and email address, used when sending emails.
DATA_ADMIN_NAME, DATA_ADMIN_EMAIL
The name and email of the administrator, to send him/her emails when important errors occur.
DATA_LOGO_FILENAME

The name of the main logo in frontend/src/images/, with a recommended size of 178 x 80 pixels. If it is your own image, you have to add it there. You can let the default value for this environment variable and add your image at path frontend/src/images/logo_custom.png.

DATA_LOGO_FILENAME_SMALL

The name of the small logo in frontend/src/images/. This logo is shown in the admin panel when the menu is collapsed, and should be as square.

Create merged files

You can pass only one file containing environment variables to set to docker compose so you have to merge these files everytime you change something. This can be done with the following command:

python merge_production_dotenvs_in_dotenv.py

This will create the two files .env_production and .env_staging that are simply the concatenation of the 5 separate files you configured.

Build and deploy the application

Everytime you would like to execute a command, you have to specify the correct docker compose YAML configuration file and the correct environment variables merged file.

docker compose -f production.yml --env-file .env_production my_command

To build and start the application, run the following commands:

docker compose -f production.yml --env-file .env_production build
docker compose -f production.yml --env-file .env_production run django python backend/manage.py migrate
docker compose -f production.yml --env-file .env_production up -d

The application will start, and listen on the port specified by the APPLICATION_PORT environment variable.

The migrate command is executed on Django to create initially the database tables.

Configuration

Once the application is running, you can configure some elements through the Django admin panel that will be available at yourdomain.com/[DJANGO_ADMIN_URL]/.

But first you need to create an admin account with the following command (you will need to indicate some basic information like your name, email address and password):

docker compose -f production.yml --env-file .env_production run django python backend/manage.py createsuperuser

With the created account you can connect to the admin panel and fill some configuration information :

Information about the organization running the mediation service

Here you can fill information about your company that will appear on the footer of the Connect Access application, in "Contact us" section.

You can also add your terms of service, that will then appear at yourdomain.com/terms-of-service.

About mediation service information

Here you can add links that will appear in the "About" section of the footer. Each entry is one link.

The link's URL have to be either an external absolute URL (beginning with http of https) that will open a new window, or a relative URL that will not open a new window and not reload the page. If you fill the "Terms of service" page content in contact information section, the page URL you use here should be terms-of-service.

Sites
In this section, add an entry for your domain name.