Simple application to present basic concepts of CI/CD, orchestratrion, service discovery and load balancing.
- Python 3 with Flask
- HashiCorp Nomad as the Orchestrator
- HashiCorp Consul as the Service Discovery
- Fabio LB as the Load Balancer
- Github as Docker image repository
- Docker
- Virtualenv
- Basic HTML
- Install Docker on your server
- Download Nomad https://www.nomadproject.io/downloads
- Unzip the package and move the single binary to /usr/local/bin/nomad
- Open a terminal and type:
nomad agent -dev
. One important note — in dev mode, Nomad will not persist any data. That’s fine for experimenting and prototyping, but not something you should do in production. - Open Nomad dashboard accessing
http://localhost:4646
- At Jobs section, click "Run Job" and paste the content of the file
infra/consul.nomad
- At Jobs section, click "Run Job" and paste the content of the file
infra/fabio.nomad
- At Jobs section, click "Run Job" and paste the content of the file
infra/word_counter.nomad
- Access
http://localhost:9999
to access the word counter serice UI
- Access
http://localhost:4646
to monitor the jobs being orchestrated - Access
http://localhost:8500
to monitor the services being discovered - Access
http://127.0.0.1:9998
to monitor the services being balanced
- Click on
j-word-counter
job at Nomad Dashboard and hitStop
- Access the file
infra/word_counter.nomad
and changescaling min max
as needed - At Jobs section, click "Run Job" and paste the content of the file
infra/word_counter.nomad
- Some configurations are set to consider a debug or dev environment. At a production environment, some changes would be required.
- About CI/CD, the most important file is
word_counter.yml
, that is anGithub Action
and theDockerfile
. - CI/CD and Github Actions is not the focus of this README.md, but were all implemented in the repository.
- Github as image repository requires some specific configurations that was not covered in this README.md