Netguru
This contains a solution of the Netguru's recruiment task.
Local development
To unit test locally, just run:
docker-compose up -d unittest
To run locally just run:
docker-compose up -d run_local
Production
Links
Deployment
Deployment is handled automatically via a CI script.
Deployment is done to a Docker Swarm platform, since I'm a big fan, and I'm still learning Kubernetes.
I realize that Docker Swarm is a dead end, as it isn't supported anymore, but I've got 1,5-FTE worth of jobs on my hands.
Configuration
You need to provide your settings in following environment variables:
- DB_HOST (default is postgres)
- DB_USER (default is postgres)
- DB_PASS (default is postgres)
- DB_NAME (default is postgres)
- DB_PORT (default is 5432)
You should also pick a env called SECRET_KEY it should be a random sequence of characters. If you don't provide it, a reasonably default value is supplied, but since it has already been used it isn't safe anymore. CHANGE IT!
Volumes
The application needs a volume marked at
/data
to store files. Because storing
files in a database is an antipattern.
Monitoring
Logs
You will just have to forgive me that I failed to hook up any loggers for it. Any Python-based logger will do, I sincerely recommends seq-log
- full disclosure: I'm a contributor there
Metrics
The solution actively exports metrics at port 81. You can hook up Prometheus to it. It exports the metrics thanks to my excellent satella library and django-satella-metrics adapter.
Traces
The solution fully supports tracing. You can tweak the settings in settings.py file to install for example a Jaeger instance.
I failed to deploy that on your test environment since I'm pretty much strapped for time.
BTW: If you're not already doing tracing, you should totally consider it.