Thank you for considering contributing to QGIS Feed! We welcome contributions of all kinds, including bug fixes, feature requests, documentation improvements, and more. Please follow the guidelines below to ensure a smooth contribution process.
For development purposes only, you can run this application in debug mode with docker compose. Some of the docker compose commands are already configured in the Makefile.
This project requires Docker and Docker Compose to run the development and production environments. Please ensure both are installed on your system before proceeding.
You can check your installation with:
docker --version
docker-compose --version- Clone git repo
git clone https://github.com/qgis/QGIS-Feed-Website.git - Run
$ pwdin order to get your current directory - Path to your repo should be
<your current directory>/QGIS-Feed-Website - Go to dockerize directory
cd QGIS-Feed-Website
This repository uses pre-commit to automate code quality checks before each commit. To set it up:
-
Install pre-commit (if not already installed):
pip install pre-commit
-
Install the hooks defined in
.pre-commit-config.yaml:pre-commit install
Now, the configured checks (such as linting and formatting) will run automatically when you commit changes.
For Nix/NixOS users, you can run the following command on this project root folder:
nix-shell
./vscode.shTODO: Install all dependecies when running nix-shell.
- Build the docker the container
$ make dev-build- Create
settings_local.pyint theqgisfeedprojectdirectory, configure the media folder as in the example below:
# Settings local for docker compose production settings
import os
MEDIA_ROOT = '/shared-volume/media/'
MEDIA_URL = '/media/'
STATIC_ROOT = '/shared-volume/static/'
STATIC_URL = '/static/'
if not os.path.exists(MEDIA_ROOT):
os.mkdir(MEDIA_ROOT)
if not os.path.exists(STATIC_ROOT):
os.mkdir(STATIC_ROOT)- Generate the
.envfromenv.templateand edit it with your email variables:
cp env.template .env
nano .envDon't forget to specify the QGISFEED_MEDIA_VOLUME with your media directory
See https://docs.djangoproject.com/en/2.2/topics/email/#module-django.core.mail for further email configuration.
- To prevent DDOS attacks there is limit in the number of returned records (defaults to 20): it can be configured by overriding the settings in
settings_local.pywith:
QGISFEED_MAX_RECORDS=40 # default value is 20IMPORTANT NOTE: For new Django variables, please use the settings_local_override.py as the .env file is not supported by the new production infrastructure.
- Create settings_local_override.py file
$ cp settings_local_override.py.templ settings_local_override.py- Edit settings_local_override.py file and set your environment variables
IMPORTANT NOTE: As we are migrating to a declarative based infrastructure, it is preferable to use the settings_local_override.py file for all new Django variables. This file is ignored when commiting so please make sure you define your new variables with an example value (NOT THE REAL ONE FOR SECRETS AND PASSWORDS) inside the settings_local_override.py.templ file.
- Start the docker the container
$ make dev-start- Run migrations:
$ make dev-migrate- Create an admin user and set a password:
$ make dev-createsuperuser- Show the development server logs:
$ make dev-logsA set of test data will be automatically loaded and the application will be available at http://localhost:8000
To enter the control panel http://localhost:8000/admin, two test users are available:
- Super Admin: the credentials are
admin/admin - Staff (News Entry Author): the credentials are
staff/staff
🧪 Run all tests
To run all tests cases in the qgisfeed app, from the main directory:
$ make dev-runtests🧪 Run a specific test
To run each test case class in the qgisfeed app:
$ docker-compose -f docker-compose.dev.yml exec qgisfeed python qgisfeedproject/manage.py test qgisfeed.tests.QgisFeedEntryTestCase
$ docker-compose -f docker-compose.dev.yml exec qgisfeed python qgisfeedproject/manage.py test qgisfeed.tests.QgisUserVisitTestCase
$ docker-compose -f docker-compose.dev.yml exec qgisfeed python qgisfeedproject/manage.py test qgisfeed.tests.HomePageTestCase
$ docker-compose -f docker-compose.dev.yml exec qgisfeed python qgisfeedproject/manage.py test qgisfeed.tests.LoginTestCase
$ docker-compose -f docker-compose.dev.yml exec qgisfeed python qgisfeedproject/manage.py test qgisfeed.tests.FeedsItemFormTestCase
$ docker-compose -f docker-compose.dev.yml exec qgisfeed python qgisfeedproject/manage.py test qgisfeed.tests.FeedsListViewTestCase⚙️ Production Environment Installation
For production, you can run this application with make commands or docker compose:
Docker configuration should be present in .env file in the main directory,
an example is provided in env.template:
# This file can be used as a template for .env
# The values in this file are also the default values.
# Host machine persistent storage directory, this path
# must be an existent directory with r/w permissions for
# the users from the Docker containers.
QGISFEED_DOCKER_SHARED_VOLUME=/shared-volume
# Number of Gunicorn workers (usually: number of cores * 2 + 1)
QGISFEED_GUNICORN_WORKERS=4
# Database name
QGISFEED_DOCKER_DBNAME=qgisfeed
# Database user
QGISFEED_DOCKER_DBUSER=docker
# Database password
QGISFEED_DOCKER_DBPASSWORD=docker$ make startA set of test data will be automatically loaded and the application will be available at http://localhost:80
To enter the control panel http://localhost:80/admin, two test users are available:
- Super Admin: the credentials are
admin/admin - Staff (News Entry Author): the credentials are
staff/staff
- Generate key using openssl in dhparam directory
openssl dhparam -out /home/web/qgis-feed/dhparam/dhparam-2048.pem 2048- Run the container
$ make start- Update
config/nginx/qgisfeed.confto include the new config file inconfig/nginx/ssl/qgisfeed.conf
include conf.d/ssl/*.conf;
- Restart nginx service
nginx -s reload
- To enable a cronjob to automatically renew ssl cert, add
scripts/renew_ssl.shto crontab file.
📧 Email-sending setup
- Generate the
.envfromenv.templateand edit it with the production email variables:
cp env.template .env
nano .env🛠️ Troubleshooting SSL in production
Sometimes it seems our cron does not refresh the certificate. We can fix like this:
Gentle Way
ssh feed.qgis.org
cd /home/web/qgis-feed
scripts/renew_ssl.sh
Now check if your browser is showing the site opening with no SSL errors: https://feed.qgis.org
More crude way
ssh feed.qgis.org
cd /home/web/qgis-feed
make start c=certbot
make restart c=nginx
Now check if your browser is showing the site opening with no SSL errors: https://feed.qgis.org
Please visit the private Sysadmin documentation for more details about the deployment of https://feed.qgis.org
If something goes terribly wrong, we keep 7 nights of backups on hetzner and daily backups on a storage box.
If those are also not useful there are a collection of snapshot backups on hetzner and on a storage box
Last resort: Tim and Lova makes backups to his local machine on a semi-regular basis.

