Specific tools are used at each stage of DevOps:
- Planning: Jira handles planning with automated tasks triggered by repository activities (like commit, push, or pull).
- Coding: This GitHub repository is used for code management.
- Building: Docker is used to build containers.
- Testing: Python's unittest library is used for writing tests.
- Release: GitHub Actions handles continuous integration and deployment.
- Deployment: The application is deployed to Amazon Lightsail, a container-based service from AWS.
- Operations: Terraform manages infrastructure provisioning, and Ansible handles configuration.
- Monitoring: Nagios server is installed and configured for system monitoring.
- App: Includes the Docker-based microservices built with Flask in Python.
- Infrastructure: Houses the Terraform file for AWS Lightsail setup and the Ansible script for configuring the Nagios monitoring server.
- Tests: Contains unit tests for the three Python microservices.
- Workflows: Contains the CI/CD pipeline setup.
- apigateway: Acts as the entry point for the other two services (APIs), mapped to port 5000, allowing HTTP GET requests to be directed to paths /service1 and /service2.
- service1: Service 1, mapped to port 5001, returns a JSON string.
- service2: Service 2, mapped to port 5002, returns a JSON string.
- TerraformInf
- AnsibleConf
- 1 Amazon Linux 2 instance serving as the Nagios monitoring server on the infrastructure.
- 1 static IP address to be linked to the instance.
- 1 service container with two nodes, hosting the Flask Python microservices application.
The configuration has default checks for the local machine (localhost) and a new host, an Amazon Lightsail container called `my-container-service-1`. This setup includes an HTTP check on the apigateway service endpoint to confirm that all microservices can be accessed, meaning it checks if the apigateway is reachable.
Additionally, Apache redirect from the site root to the /nagios path has been configured. This allows accessing the Nagios console directly from the instance's public IP address without adding the /nagios path.
#Terraform commands
terraform -v
#terraform v1.2.5 on linux_amd64
terraform init
terraform validate
terraform apply
#Ansible commands
#open inventory.ini and set ansible_host (public instance ip) and ansible_ssh_private_key_file (instance ssh key path)
#open vars.yml and set HostName, HostAddress (container private domain) and NagiosPassword
ansible --version
#ansible [core 2.15.1]
ansible-playbook -i inventory.ini nagios_conf.yml
Production deployment is manual and done through the AWS console.







