TypeScript Shell Python JavaScript CSS HTML
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.


license GitHub release Build Status codecov Dependency Status Codacy Badge Maintenance Donate

This repo is a production ready seed project. The app shows a list of users.


  • The client service is a build of the client directory. It contain an Angular app, built with Angular-Cli, ngrx to handle state, Angular Material as a design library, have service worker, and AOT compiled. The app shows the users from the Django api.
  • The server service is a build of the server directory. It contain a simple Django app that expose an api of Django users with Django REST framework. The Python serve through a gunicorn server installed in the container.
  • There is a postgres service for the Django database. The database directory contains the automatic backup script.
  • There is an nginx service to serve static files (the client app).
  • There is an haproxy service to get all the HTTP requests and do load balancing between the containers in the services.
  • There are a separate containers for the ELK Stack for logging. The server and the client logs sent to logstash, and saved in elasticsearch. There is also a kibana instance to check and analyze all the logs.
  • There is a visualizer container to visualize where is each container is located at (on which server).

All the parts are in a separate Docker containers and we use Docker Swarm to manage them.

Pre Requirements

  1. install docker.


Automatic installation of the project with docker.

  1. If you work on win or mac please comment the lines of the database -> volumes in docker-compose.yml, this share volume with linux system only.
  2. In client directory run docker build -t client . to build the Docker image.
  3. In server directory run docker build -t server . to build the Docker image.
  4. To create a swarm docker swarm init.
  5. Download all docker images:
    • docker pull dockercloud/haproxy
    • docker pull postgres
    • docker pull dockersamples/visualizer:stable
    • docker pull elasticsearch:5.4.3
    • docker pull kibana:5.4.3
    • docker pull logstash:5.4.3
  6. Run docker stack deploy --compose-file=docker-compose.yml prod
  7. Open the browser at http://localhost to see your Angular (client) app.
  8. Open the browser at http://localhost:8000 to see your Django (server) app.
  9. Open the browser at http://localhost:8080 to see the visualizer.
  10. Open the browser at http://localhost:5601 to see Kibana and check your logs.

If you want to install the project manually, go to the /client or /server directories and read the README file.

Our Stack

Tools we use

Django Admin

  • When install the project with docker, there is an entrypoint.sh script that runs in the server container. It'll migrate the database and create a new super user with a username admin and a password pass.
  • We use django-admin-honeypot to fake the default Django admin login screen to log and notify admins of attempted unauthorized access. So the real Django admin login screen will be under /secret-admin.
  • We also use django-flat-responsive to make the Django admin screens responsive to mobile.


There is already tests for the server and the client, we currently at +90 percent coverage.

To run the client tests and lint run the commands below in the client directory.

npm run lint
npm run test

To run the server tests and lint run the commands below in the server directory.

pycodestyle --show-source --max-line-length=120 --show-pep8 .
python manage.py test

Load Tests

We also write some tests for doing load test with locust, you can find it under server/locustfile.py.

To do a load test just install locust (it's in the requirements.txt file) go to server directory and run

locust --host=http://localhost

Then open up Locust’s web interface http://localhost:8089.

Rolling Updates

To update any of the containers that are in a service with a new image just create a new image, for example

docker build -t server:v2 .

And then update the service with the new image

docker service update --image server:v2 prod_server

Database Backups

Each day a backup of the PostgreSQL database will be created. The daily backups are rotated weekly, so maximum 7 backup files will be at the daily directory at once.

Each Saturday morning a weekly backup will be created at the weekly directory. The weekly backups are rotated on a 5 week cycle.

Each month at the 1st of the month a monthly backup will be created at the monthly directory. Monthly backups are NOT rotated

The backups are saved at /var/backups/postgres at the host machine via a shared volume. It can be configured in the docker-compose.yml at volumes section of the database service.


Just fork and do a pull request (;