To run locally application, install docker
and docker compose
.
Run docker compose up -d
to start app.
Check the following endpoints:
$ curl localhost:8080/-/healthy -w "%{http_code}"
{}
200
$ curl localhost:8080/-/ready -w "%{http_code}"
{}
200
$ curl localhost:8080/user -w "%{http_code}"
[...]
200
Application is made of:
- a Web Server for API Calls. The web server can be started with
flask run --host 0.0.0.0 --port 8080
- migration script to confugure the database. The migration script can be run with
flask db upgrade
Application needs a PostgreSQL database to run.
The following environment variable allow to configure application:
POSTGRES_USERNAME
: username of PostgreSQLPOSTGRES_PASSWORD
: password of PostgreSQLPOSTGRES_HOST
: hostname or IP of PostgreSQLPOSTGRES_PORT
: listening port of PostgreSQLPOSTGRES_DATABASE
: name of the database
The following endpoints are available
GET localhost:8080/-/healthy
: return200
when server is upGET localhost:8080/-/ready
: return200
when server is upGET localhost:8080/user
: return list of users in databasePOST localhost:8080/user
: create a user in database. The request must contain a body:{'username': 'my_username', 'email': 'my_email'}
- Create a GitLab CI pipeline that build the docker image.
- Suggest improvement of this pipeline.
- Suggest optimizations on the Dockerfile
- Create Helm chart templates to deploy application
- A minimum of 2 pods are required for web server
- don't forget to run migration scripts at deployment
- After installation, the endpoint
/user
works well.
- Are liveness & readiness probes correctly implemented? Why?
- What improvement can be done in your Helm Chart?