Template for large application.
Running of this project locally requires the following tools to be present on the host system:
docker(version 23.05.0+)docker compose(version 2.21.0+)
To run development environment
-
Go into
docker/development/folder -
Execute
docker compose up
API description can be accessed on development environment via swagger on
http://localhost:8000/api/swagger/.
-
Build development environment as described above
-
Execute
docker exec -it large-application-template-backend-development make
CAUTION: Performance tests are not included
neither in automated tests nor in CI/CD pipeline.
-
Build development environment as described above
-
Execute
docker exec -it large-application-template-backend-development locust --locustfile "tests/performance/PATH_TO_TESTS_PER_MODULE" --host "http://localhost:8000"
-
Open http://localhost:8089/ in browser
-
[Optional step] Correct provided data
-
Run tests by Locust web interface
To build production docker image :
-
Navigate to the root directory of the project.
-
Execute
docker build -f docker/production/Dockerfile -t large-application-template-backend-production --build-arg {REQUIRED ARGUMENTS} .
The built image can be used as image for:
application-run-production.shas Docker CMD to run applicationworker-run-worker.shasDocker CMDto run worker
POSTGRES_DB_HOST - Host of the postgres database
POSTGRES_DB_PORT - Port of the postgres database
POSTGRES_DB_NAME - Name of the postgres database
POSTGRES_DB_USER - User of the postgres database
POSTGRES_DB_PASSWORD - Password of the postgres database
BROKER_URL - URL of broker passing messages between application and worker
TZ - TimeZone identifier (e.g. Europe/Warsaw)
Database migrations are managed by alembic.
-
Go into
migrations/folder -
Execute
alembic revision --autogenerate -m "<MIGRATION_MESSAGE>"
-
Go into
migrations/folder -
Execute
alembic upgrade head
backendfolder must be marked asSources RootinIDEto make imports work
-
For Chrome/ Chromium web-browsers the application is not available over
0.0.0.0address (development environment), becausePrivate Network Accessis disabled forHTTPprotocol for those browsers. More details can be found here. Nevertheless, the application still can be accessed overlocalhostaddress. -
Running development environment on
Windowsmay require additional steps to be taken. scripts indocker/development/scripts/path may not be found, due to invalidEOFcharacters in shell scripts. (more details can be found here).There are a few solutions to this issue:
- Manually change
EOFcharacters fromCRLF(Windows) format toLF(Unix) format - Run
dos2unix
program on scripts in
docker/development/scripts/path
- Manually change