This is the repository for the code behind the website phenome10k.org.
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
.
Test coverage is very limited.
To run NodeJS tests (using Jest):
docker compose exec app-node npm run test
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.
- Install
hvac
: this is a Python library that needs to be installed with the same interpreter that ansible uses (probably your root/system Python) - Generate a vault token:
python ansible/get-token.py
- Export the token to apply it to your current shell environment:
Note that if you close your current shell, you'll have to do this again before Vagrant will work.
export VAULT_TOKEN=your-token-here
- Add
192.168.10.21 phenome10k.localhost
to/etc/hosts
.
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.
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