Skip to main content

Database

Data is stored in MongoDB via Mongo Atlas Your local docker env will have a database called pixwel-dev pre-installed, but that’s not super useful because it’s not got real data in it.

Getting real data into your development environment

Log into your mongo container VERSION=latest docker-compose exec mongo bash then run cd utils. In this directory you’ll find two scripts to clone the staging or production database locally. You can run either db-copy-prod-to-local.sh or db-copy-staging-to-local.sh. Otherwise you can build your own custom script. The following template is given as example:
You will need to supply values for <DB>, <HOST>, <PORT>, <USERNAME> and <PASSWORD>. This will pull down the data, then pull the dump into your local mongodb. Alternatively, you can sync a snapshot of the most recent 5,000 documents from each collection from any existing database using api/_build/bin/mongo-sync.js:
You’ll then want to populate the search index. From the app container (docker-compose exec app bash):

Running Migrations

Migrations, stored in /api/_build/migrations, are not currently automated and should be run manually. Run a command like: mongo <host> <credentials> _build/migrations/<file>.js Please ensure your migrations are idempotent.
TODO There is a command to automatically flag deployments to master (not merged at the time of writing).

Back to docs index | Next page in recommended reading order >>