Dev hosting with Docker
The Dockerfile and docker-compose are configured for development purposes only, not intended for use in production.
Setup
Run:
$ docker-compose build
Then to migrate databases:
$ docker-compose run app node /home/app/src/bin/migrate-database.js
Run commands or NPM
To run any of the other app commands:
For NPM:
Database
To access the database with psql:
Database will persist between container restarts/rebuilds.
Run Webserver
Run
$ docker-compose run -l openactive-conformance-services-type=run -w /home/app -p 3000:3000 app npm run start-webserver-dev
The API should be available at "localhost:3000".
It will reload automatically when you make changes.
It will stay attached to the console and any output will be visible.
Use CTRL+C to stop it.
Running tests
To set up, open a database console and run:
app=# create database test;
Then run tests at any time with:
$ docker-compose run -l openactive-conformance-services-type=run -w /home/app -e DATABASE_URL="postgres://app:app@postgres:5432/test" app npm run test
Cleaning up Docker
Because we label containers when we run things, we can clean up old containers with:
$ docker container prune --filter label=openactive-conformance-services-type=run
Last updated