No description
Find a file
2017-05-03 16:10:13 +02:00
ansible Redirect logicio 2017-05-03 15:29:07 +02:00
bin Project name 2016-12-09 06:13:01 +01:00
docs Production settings 2017-04-06 09:42:47 +02:00
mockup Removed Gruntfile 2017-05-03 15:28:20 +02:00
publichealth Mailto contact form 2017-05-03 16:10:13 +02:00
tests Added basic test suite 2017-03-13 16:59:47 +01:00
vagrant Clean mockup assets 2017-05-03 08:51:43 +02:00
.bowerrc Bootstrap SASS theme 2016-12-12 23:43:20 +01:00
.buildpacks Buildpacks 2017-03-27 23:51:01 +02:00
.dockerfile Docker instructions 2017-03-28 23:21:54 +02:00
.editorconfig Bootstrap SASS theme 2016-12-12 23:43:20 +01:00
.gitignore Clear mockup css 2017-05-03 08:53:42 +02:00
ansible.cfg Ansible deployment 2017-04-24 14:22:51 +02:00
bitbucket-pipelines.yml bitbucket-pipelines.yml added 2017-01-18 14:26:48 +00:00
bower.json Base template initial release 2017-01-27 17:06:53 +01:00
fabfile.py Project name 2016-12-09 06:13:01 +01:00
Gruntfile.js Clean mockup assets 2017-05-03 08:51:43 +02:00
Makefile Release instructions 2017-04-26 15:57:01 +02:00
manage.py Project name 2016-12-09 06:13:01 +01:00
package.json Procfile 2017-03-28 00:02:05 +02:00
Procfile Db config 2017-03-28 00:43:55 +02:00
README.md Clean mockup assets 2017-05-03 08:51:43 +02:00
requirements-test.txt Added basic test suite 2017-03-13 16:59:47 +01:00
requirements.txt Updated to Wagtail 1.9.1 2017-05-03 09:04:43 +02:00
runtime.txt Python version 2017-03-27 23:32:32 +02:00
stellar.yaml Project name 2016-12-09 06:13:01 +01:00
Vagrantfile Project name 2016-12-09 06:13:01 +01:00

Public Health Schweiz

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

Nota bene: this is a work in progress, licensing details and live site coming soon!

Development environment

The easiest way to set up your machine would be to use Vagrant, then in the project folder in the terminal type: vagrant liverun.

To set up a full development environment, follow all these instructions.

Frontend setup

You will need to have Ruby and SASS installed on your system, e.g.:

sudo yum install rubygem-sass

Make sure a recent version of node.js (we recommend using nave.sh), then:

npm install -g bower grunt-cli
npm install
bower install

The first command (..install -g..) may require sudo if you installed node.js as a system package.

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. Mock content is at mockup, and there is a grunt browser-sync setup for working with frontend assets.

Backend setup

After installing Python 3, from the project folder, deploy system packages and create a virtual environment as detailed (for Ubuntu users) below:

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

pyvenv env
. env/bin/activate

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

./manage.py migrate
./manage.py 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).

Run this after completing setup:

./manage.py runserver

A default browser should open pointing to the default home page.

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

Troubleshooting

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

Production notes

We use Ansible and Docker Compose for automated deployment.

You need to obtain SSH and vault keys, and place these in a .keys folder - then to deploy a site:

ansible-playbook -s ansible/<*.yaml> -i ansible/inventories/production

We use a StackScript to deploy to Linode, the basic system set up is to have a user in the sudoers and docker group, and a few basic system packages ready.

For example, on Ubuntu:

apt-get install -q -y zip git nginx python-virtualenv python-dev

The order of deployment is:

  • docker.yaml (base system)
  • node.yaml
  • site.yaml
  • harden.yaml

For further deployment and system maintenance we have a Makefile which automates Docker Compose tasks. This should be converted to use Ansible Container. In the meantime, start a release with Ansible, then complete it using make, i.e.:

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