This is a Pyramid web application that provides interfaces to enter and view health data for a small number of people.
It consists of a database and web interface for tracking the following information:
- Period/menstrual cycle, including
- Temperature
- Period intensity
- Menstrual flow rate
- Cervical fluid
- Height and weight
- Body temperature
- Blood pressure and heart rate
- General symptoms and notes
- Clone and change directory into your newly created project.
git clone https://github.com/jhaiduce/healthdata.git
cd healthdata
- Create a Python virtual environment.
python3 -m venv ../venv
export VENV=`pwd`/../venv
- Upgrade packaging tools.
$VENV/bin/pip install --upgrade pip setuptools
- Install the project in editable mode with its testing requirements.
$VENV/bin/pip install -e ".[testing]"
- Initialize and upgrade the database
$VENV/bin/initialize_healthdata_db development.ini
- Run unit tests.
$VENV/bin/pytest
- Start the application on a local test server
$VENV/bin/pserve development.ini
The project includes files and scripts to deploy the application to virtual machines on the Digital Ocean cloud services. The scripts use Docker Swarm to manage the application and its components.
- Generate secrets for the pre-deployment tests
$VENV/bin/python generate_secrets.py --secretsdir=integration_test_secrets --ini-filename=integration_test.ini --ini-template=integration_test.ini.tpl
- Run the pre-deployment tests
./test.sh
Make sure the above tests pass before continuing.
- Generate secrets for the production environment
$VENV/bin/python generate_secrets.py
- Generate site certificates
a. Install certbot on your development machine or another local system
b. Obtain site certificates for your production domain using certbot-dns-digitalocean
c. Locate the files privkey.pem
and fullchain.pem
in /etc/letsencrypt/live/example.com
and copy them to nginx/ssl_production
in your healthdata
project directory.
- Deploy the application to the production environment
./deploy-digitalocean.sh
- Run the pre-deployment tests
./test.sh
Make sure the above tests pass before continuing.
- Deploy the application to the production environment
./deploy-digitalocean.sh
-
Obtain new certificates following the instructions in the certbot-dns-digitalocean documentation.
-
Copy the files
privkey.pem
andfullchain.pem
from/etc/letsencrypt/live/example.com
tonginx/ssl_production
in yourhealthdata
project directory -
Change the names of the secrets
ssl_certificate
andssl_certificate_key
indocker-compose.yml
This is required because Docker secrets cannot be changed after creation. To work around this, we create new secrets by changing the secret names in docker-compose.yml
.
- Run the deployment script to copy the new certificates to the production environment and update the application to use them
./deploy-digitalocean.sh