This repository uses Docker for building and deploying the application locally. It uses docker-compose
to achieve this. To build simply run
docker-compose build
You can specify individual services to build or to start / stop as part of the docker-compose command, i.e:
docker-compose build api
docker-compose up postgres
In order to run the application simply execute
docker-compose up
This will bring up all the necessary services for the UNI API to function. Currently these include:
- The Python API itself
- Redis cache
- Postgres container with the data modeling
The PostgreSQL database works using volumes which means that the data will be persisted in between restarts. This also means that if there are changes to the model in the database we need to manually rebuild the image and remove the volume so that the new changes are applied. In order to do that you can use the following set of commands:
- To remove data from tables (table structure will stay the same since it is tied to the image) you can simply run:
docker volume rm uni-wtb_db-contents - To make sure the database is recreated so the changes are applied you need to remove and recreate the image you need
to run above command and then:
docker volume rm uni-wtb_db-contents docker image rm uni-wtb_postgres docker-compose build postgres