You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
PCoder 79dbc2aa7f Remove title case in template 3 months ago
ansible nginx ipv6 support 2 years ago
bin Project name 6 years ago
docs Added screenshot 4 years ago
feedler Add migration 9 months ago
publichealth Remove title case in template 3 months ago
tests Wagtail 2.13 tweaks 2 years ago
vagrant Clean up ruby install 4 years ago
.dockerfile Bumped Python ver and yarn 3 years ago
.dockerignore Deployment optimized 3 years ago
.editorconfig Bootstrap SASS theme 6 years ago
.gitignore Merge remote-tracking branch 'upstream/master' into loleg-wagtail-2.15 1 year ago Update Changelog 7 months ago
Gruntfile.js Updated Bootstrap 3 frontend components 3 years ago Added license, updated README 6 years ago
Makefile Create a new Makefile 2 years ago
Makefile.docker-compose Get changes to original Makefile before merge 2 years ago
Makefile.native Create a new Makefile 2 years ago
Pipfile Wagtail 2.15.1 1 year ago
Pipfile.lock Wagtail 2.15.1 1 year ago
Procfile Db config 6 years ago Update 2 years ago
Vagrantfile Project name 6 years ago
ansible.cfg Remove comments model due to django sites error 3 years ago
bitbucket-pipelines.yml bitbucket-pipelines.yml added 6 years ago Project name 6 years ago Wagtail 2 support 4 years ago
package.json node-sass replaced with Dart Sass 1 year ago
requirements-test.txt Wagtail 2.13, Django-Redis 5, and minor dep updates 2 years ago
requirements.txt Wagtail 2.15.1 1 year ago
runtime.txt Python version 6 years ago
stellar.yaml Project name 6 years ago
yarn.lock node-sass replaced with Dart Sass 1 year ago

Public Health Schweiz

Website of the Swiss Society for Public Health, developed by datalets,ch using the open source, Django-based Wagtail CMS. The frontend is implemented by moving water using Bootstrap framework.

This project is open source under the MIT License.

Dependency Status

Development environment

An easy way to set up your machine could be to use Vagrant, then in the project folder in the terminal type: vagrant up. Then when it is ready, follow instructions for publichealth/static/org/archive-message.html#Database setup. To set up a full development environment using Docker or native components, follow all these instructions.

Frontend setup

Use the LTS version of node.js (we recommend using with nave use lts), then:

npm install -g yarn grunt-cli
yarn install

The first command (..install -g..) may require sudo if you installed node.js as a system package. Afterwards, to compile the frontend, you should be able to run:


If you are only working on the frontend, you can start a local webserver and work on frontend assets without the backend setup described below. There is a grunt browser-sync setup for working with frontend assets.

(In a Vagrant shell, use the alias watch)

Backend setup

If not using Vagrant: after installing Python 3, from the project folder, deploy system packages (here shown for Ubuntu users) for the development libraries of Python, libJPEG and libPQ (Postgres Client):

sudo apt-get install python3-dev libjpeg-dev libpq-dev

Create a virtual environment as below:

sudo apt-get install python3-venv

pyvenv env
. env/bin/activate

pip install -U pip
pip install -r requirements.txt

At this point your backup is ready to be deployed.

Database setup

Once your installation is ready, you can get a blank database set up and add a user to login with.

If you are using Vagrant, enter the shell of your virtual machine now with vagrant ssh

Run these commands:

./ migrate
./ createsuperuser

You will be asked a few questions to create an administrator account.

Starting up

If you have one installed, also start your local redis server (service redis start).

After completing setup, you can use:

./ runserver

(In a Vagrant shell, just use djrun)

Now access the admin panel with the user account you created earlier: http://localhost:8000/admin/


Issues with migrating database tables in SQLite during development? Try ./ migrate --fake

Trouble installing packages with npm or yarn? Add IPv6 addresses to your hosts:

2606:4700:10::6814:162e 2606:4700::6810:1823 2606:4700::6810:1123 2a0a:e5c0:2:10::8c52:790a

Production notes

Currently the project has two main production deployment strategies: native and Docker Compose, the latter optionally managed by Ansible. Native is currently the default one. To switch to Docker Compose, change the symbolic Makefile link to point to Makefile.docker-compose or run your make commands as follows:

$ make -f Makefile.docker-compose <command>

Deployment with Ansible and Docker Compose

This project supports Ansible and Docker Compose for automated deployment. To get started, copy ansible/roles/web/templates/docker-compose.j2 to /docker-compose.yml and fill in all {{ variables }}. This can also be done automatically in Ansible.

To update all roles from Ansible Galaxy used in our install scripts:

ansible-galaxy install `ls ansible/roles -x -I wagtail` --force

To check that the scripts and roles are correctly installed, use this command to do a "dry run":

ansible-playbook ansible/*.yaml -i ansible/inventories/lagoon --list-tasks

If you only want to run a certain set of actions, subset the tags which you see in the output above. For example, to only update the NGINX configuration:

ansible-playbook ansible/web.yaml -i ansible/inventories/lagoon --tags "nginx_template_config"

To do production deployments, you need to obtain SSH and vault keys from your system administrator (who has followed the Ansible guide to set up a vault..), and place these in a .keys folder. To deploy a site:

ansible-playbook ansible/*.yaml -i ansible/inventories/lagoon

For an update release with a specific version (tag or branch), use (the -v parameter showing output of commands):

ansible-playbook ansible/site.yaml -i ansible/inventories/lagoon --tags release -v -e gitversion=<v*.*.*>

You can also use the gitrepo parameter to use a different fork of the source code.

Once the basic system set up, i.e. you have an ansible user in the sudoers and docker group, you are ready to run the playbook.

Production releases

Start a release with Ansible, then complete it using make, i.e.:

ansible-playbook -i ansible/inventories/lagoon --tags release ansible/wagtail.yaml
ssh -i .keys/ansible.pem ansible@<server-ip> "cd <release_dir> && make release"

This is already part of the normal release cycle, but if you wish to update the Docker images to the latest versions separately, use:

make upgrade

Restoring a data backup

For development, it's handy to have access to a copy of the production data. To delete your local database and restore from a file backup, run:

rm publichealth-dev.sqlite3
python migrate
python loaddata publichealth.home.json

You might want to createsuperuser again at this point.