Add problem + solution explanation when app is in production.
App has been broken into 3 different docker images (frontend, backend and mysql db). Docker-compose has been set-up to allow the quick spin up and spin down of containers.
Make sure you have the following installed:
-
Python:
>= 3.12
- Check with:
python --version
- Install from: python.org
- Check with:
-
Docker:
>= 27.3
- Check with:
docker --version
- Install from: docker.com
- Check with:
Create environment:
cp .env.template .env
cd app/backend
python -m venv venv
Then load the environment in your IDE.
Install dependencies:
pip install -r requirements.txt
docker-compose up --build
docker-compose up
docker-compose down
docker-compose down —-volumes
Running bash inside a container:
docker exec -it <mycontainer> sh
eg.
docker exec -it pubpoint-backend-1 sh
I have made various bash scripts which give other ways of running code inside a docker container (see populate_pubs.sh
as an example).
Hot reload has been enabled on both front and backend.
Docker desktop must be opened before running docker-compose up
.
Recommend forking the project for initial experimentation. When ready to contribute, write access to the main repo can be set-up.
When wanting to use local dev mysql database edit .env to have MOCK_MODE=true (capitalisation is not important).
This is persistent between container spin up and spin down due to image volume storage. This can be cleared using the above given command docker-compose down —-volumes
.
Template .env file provided called ".env.template". Placeholder values have been added for the variables and these should be updated.
To update:
-
cp .env.template .env
-
Update values. Mock database set-up as desired (recommend to leave as placeholder valies). API KEY look at below instructions for google developer api set-up.
I have set-up various utils endpoints to populate the dev local mysql tables for the persistent container volume storage.
To populate pubs: postman has populate pubs endpoint set-up. Will load in London pubs. Endpoint is http://localhost:5001/utils/populate-pubs with a PUT request.
-
Google developer account with activated api key added to .env.
-
Set up ".env".
-
Docker Desktop installed.
-
Postman (ask TS to be added to repo for existing endpoints).
-
Access to notion (ask to be added, contains planning info).
-
Access to github (obviously). When ready to contribute, write access to the main repo can be set-up.
-
Docker-compose file shows the host ports for accessing containers.
-
MySql workbench for viewing database.
-
Head to "https://console.cloud.google.com/welcome".
-
APIs and services.
-
Create Project, name it e.g. pubPoint.
-
Enabled APIs and services
-
Enable “Routes API” and “Places API (New)”
-
Credentials.
-
CREATE CREDENTIALS (towards top), Api Key.
-
Recommended, set up restrictions → click 3 dots, go to edit, restrict key to selected api, needed ones are “Routes API” and “Places API (New)”.
-
Add this to .env, I have provided template .env for this, DO NOT HARD CODE INTO CHECKED IN FILES.
Add an epic/your-feature
branch. Merge into main
using a PR. Commits should be atomic. Tag commits in main
with version for release.