This repo combines the backend, frontend and database part of the DyHealthNet platform and is purely used to build + deploy the resulting docker containers.
Warning
Clone the repo with the submodules. To do that, use this command:
git clone --recurse-submodules https://github.com/DyHealthNet/dhn-docker.git
After cloning the repo, just copy the .example.env to .env and fill out all the necessary values.
Afterwards, you can do:
docker-compose up -dand everything will build and start automatically.
For the website to work and be filled, all scores need to be calculated and the database needs to be filled. This is done automatically on startup. If something went wrong and you need to reinitialize the database, you can do so by running:
docker-compose exec backend python manage.py initialise_db -fMake sure everything is working by doing a healthcheck:
docker-compose exec backend python manage.py healthcheckTo deploy the stack in a docker swarm, you can do the following:
First, build the images:
docker build -t dhn-backend -f backend/Dockerfile .
docker build -t dhn-frontend -f frontend/Dockerfile frontend
docker build -t dhn-celery -f backend/Dockerfile.celery .Make sure you fill out the .env file with the necessary values.
Then, you need to initialize the swarm:
docker swarm initAfterwards, you can deploy the stack:
docker stack deploy -c docker-compose.yml dhn_stackCheck the status of the stack:
docker stack ps dhn_stackNote that the first time you deploy the stack, the backend will need to calculate all the scores and fill the database. This can take a while.
You can also remove the stack again via:
docker stack rm dhn_stackScaling the backend and celery workers is also easy, it will automatically distribute the load:
docker service scale dhn_stack_backend=2
docker service scale dhn_stack_celery=4Lastly, leave the swarm:
docker swarm leave --force