- Fork this repository on GitHub
git clone https://github.com/*you*/anyway-backend
- Add the main repository as your upstream remote:
git remote add upstream https://github.com/hasadna/anyway-backend
Read more about DOCKER at Offical docs or at Github project
There are 2 Dockerfiles in this project :
- The PostgreSQL DB docker at the "db_docker" folder
- The actual backend application docker is the Dockerfile
If you change the docker files and want to re-run the docker-compose you need to:
docker-compose build
and then: docker-compose up
For the first time, and for any postgres schema changes (we are using alembic), run, when containers are up:
docker exec -it anyway-backend_anyway_1 alembic upgrade head
docker-postgis - Dockerfile, initdb-postgis.sh and update-postgis.sh where inspired from here:
https://github.com/appropriate/docker-postgis/tree/f6d28e4a1871b1f72e1c893ff103f10b6d7cb6e1/10-2.4
- Copy the following cbs data directory into data (hence data will be in the path: data/cbs/...)
- make sure the docker is up - run
docker-compose up -d
docker exec -it anyway-backend_anyway_1 bash -c "python main.py process road-segments"
docker exec -it anyway-backend_anyway_1 bash -c "python main.py process cbs"
- Grab a cup of coffee, this will take ~1 hour
For Adding a schema: create a schema revision, for example
For Adding or modifying a table: When creating a patch that alters the database schema, you should use generate the appropriate Alembic revision by running:
docker exec -it anyway-backend_anyway_1 bash -c "alembic revision --autogenerate -m 'Description of the change'"
Make sure to commit your revision together with the code.