This template includes:
- a nginx server as frontend
- a small web service written in Flask
- a MySQL db backend
- basic starter configurations for both Docker & Kubernetes deployment
The application follows a Clean Architecture design.
-
Set environment variables & substitute your docker account as necessary:
export APP_ENV=development or export APP_ENV=production export DOCKER_ACCT=vatie
(for standard Windows command shell use
set
instead ofexport
)or in Windows Powershell use:
$env:APP_ENV = "development" $env:DOCKER_ACCT = "vatie"
-
Run
docker-compose build
-
Run
docker-compose up
-
Run the following to add the database passwords as secrets:
kubectl create secret generic db-passwords --from-literal=db-password='password' --from-literal=db-root-password='password'
Note: These are simple passwords used for demo purposes only. Use strong passwords for real setup!
-
Start everything:
kubectl create -f .k8s
-
Delete everything:
kubectl delete -f .k8s
In Linux, macOS or Windows WSL:
# Install Poetry
make setup
# Install app
make install
or using Windows Powershell / Command Prompt:
- Download & install Poetry
- Run installation:
poetry install
# Run all tests
make test
# Run unit tests only
make unit-test
# Run functional tests only
make functional-test
-
You can run the Flask web service locally. The local configuration uses an in-memory db.
# With Makefile (Linux, macOS or Windows WSL): make run-product-service # Or with Powershell / Command Prompt: poetry run python .\src\product_service\app.py --config config.yml
-
You can also run & debug the service directly in PyCharm or VSCode from app.py