Production Server
Note
This guide explains how to set up a production server on Ubuntu 20.04.3 LTS (Focal Fossa). Other linux distributions should work just fine, but we don’t provide detailed instructions for them.
System requirements
Upgrade alls:
sudo apt update && sudo apt -y upgradeInstall system requirements:
sudo apt -y install python3-venv python3-pip libpq-dev ffmpeg
Integreat Compass CMS Package
Choose a location for your installation, e.g.
/opt/integreat-compass/
:sudo mkdir /opt/integreat-compass sudo chown www-data:www-data /opt/integreat-compassCreate config and log files and set more restrictive permissions:
sudo touch /var/log/integreat-compass.log /etc/integreat-compass.ini sudo chown www-data:www-data /var/log/integreat-compass.log /etc/integreat-compass.ini sudo chmod 660 /var/log/integreat-compass.log /etc/integreat-compass.iniChange to a shell with the permissions of the webserver’s user
www-data
:sudo -u www-data bashCreate a virtual environment:
cd /opt/integreat-compass python3 -m venv .venv source .venv/bin/activateInstall the integreat-compass cms inside the virtual environment:
pip3 install integreat-compassCreate a symlink to the https://github.com/digitalfabrik/integreat-compass/blob/develop/integreat-compass_cms/core/wsgi.py file to facilitate the Apache configuration:
ln -s $(python -c "from integreat-compass_cms.core import wsgi; print(wsgi.__file__)") .Set the initial configuration by adding the following to
/etc/integreat-compass.ini
(for a full list of all possible configuration values, have a look at https://github.com/digitalfabrik/integreat-compass/blob/develop/example-configs/integreat-compass.ini):[integreat-compass] SECRET_KEY = <your-secret-key> FCM_KEY = <your-firebase-key> BASE_URL = https://cms.integreat-compass-app.de LOGFILE = /var/integreat-compass.logLeave the www-data shell:
exit
Static Files
Create root directories for all static files. It’s usually good practise to separate code and data, so e.g. create the directory
/var/www/integreat-compass/
with the sub-directoriesstatic
andmedia
:sudo mkdir -p /var/www/integreat-compass/{static,media}Make the Apache user
www-data
owner of these directories:sudo chown -R www-data:www-data /var/www/integreat-compassAdd the static directories to the config in
/etc/integreat-compass.ini
:STATIC_ROOT = /var/www/integreat-compass/static MEDIA_ROOT = /var/www/integreat-compass/mediaCollect static files:
cd /opt/integreat-compass sudo -u www-data bash source .venv/bin/activate integreat-compass-cli collectstatic exit
Webserver
Install an Apache2 server with mod_wsgi:
sudo apt -y install apache2 libapache2-mod-wsgi-py3Enable the
rewrite
andwsgi
:sudo a2enmod rewrite wsgiSetup a vhost for the integreat-compass by using our example config: https://github.com/digitalfabrik/integreat-compass/blob/develop/example-configs/apache2-integreat-compass-vhost.conf and edit the your domain and the paths for static files.
Database
Install a PostgreSQL database on your system:
sudo apt -y install postgresqlCreate a database user
integreat-compass
and set a password:sudo -u postgres createuser -P -d integreat-compassCreate a database
integreat-compass
:sudo -u postgres createdb -O integreat-compass integreat-compassAdd the database credentials to the config in
/etc/integreat-compass.ini
:DB_PASSWORD = <your-password>Execute initial migrations:
cd /opt/integreat-compass sudo -u www-data bash source .venv/bin/activate integreat-compass-cli migrate
Email configuration
Add your SMTP credentials to
/etc/integreat-compass.ini
(for the default values, see https://github.com/digitalfabrik/integreat-compass/blob/develop/example-configs/integreat-compass.ini):EMAIL_HOST = <your-smtp-server> EMAIL_HOST_USER = <your-username> EMAIL_HOST_PASSWORD = <your-password>