Skip to content

NaturalHistoryMuseum/phenome-10k

Repository files navigation

Phenome10k

This is the repository for the code behind the website phenome10k.org.


Development

The development environment uses a Docker Compose configuration. This does not completely reflect the production server configuration.

To run for the first time:

RUN_INIT=TRUE docker compose up -d

On subsequent runs, RUN_INIT can be omitted.

An admin user will be created with the username/email admin and the password pass.

Tests

Test coverage is very limited.

To run NodeJS tests (using Jest):

docker compose exec app-node npm run test

Local staging

There is a Vagrant configuration that more accurately reflects the production server setup. It's provisioned using ansible.

As a staging environment, it requires some production values (e.g. hcaptcha keys) and can therefore only be run by individuals with access to certain Natural History Museum services.

Setup

  1. Install hvac: this is a Python library that needs to be installed with the same interpreter that ansible uses (probably your root/system Python)
  2. Generate a vault token:
    python ansible/get-token.py
  3. Export the token to apply it to your current shell environment:
    export VAULT_TOKEN=your-token-here
    Note that if you close your current shell, you'll have to do this again before Vagrant will work.
  4. Add 192.168.10.21 phenome10k.localhost to /etc/hosts.

Running Vagrant

vagrant up --no-parallel

The --no-parallel is particularly important if your system uses libvirt rather than Virtualbox.

The site will be available at phenome10k.localhost, and should reflect the production configuration of the service.


Production

The site's infrastructure is an HA architecture is composed of:

  • 2+ load balancers in active-passive HA configuration
  • 2+ application servers
  • 1 data server (db and nfs)

The system can be deployed to production via ansible:

ansible-playbook ansible/playbook.yml -i ansible/inventories/production.ini -k -K --user YOUR-USERNAME