This project demonstrates the use of automation scripts, containerization with Docker, container orchestration with Kubernetes, and infrastructure provisioning using Terraform.
- Technologies Used
- Features
- Getting Started
- Notes
- Troubleshooting
- Contributing
- Contact
- Python/Bash
- Docker
- Kubernetes
- Terraform
- Automated deployment pipeline with Python or Bash scripts
- Docker containerization for applications
- Kubernetes deployment and service configuration
- Terraform infrastructure provisioning
git clone https://github.com/mariarodr1136/DevOpsAutomator.git
Before running the scripts, make sure the following tools are installed and configured on your machine:
Docker is required for containerization and managing application deployment.
- Install Docker
- Verify installation:
docker --version
Kubernetes is used for orchestrating containers in the deployment.
- Install Minikube
- Verify installation:
kubectl version --client
Terraform is used for provisioning infrastructure on cloud platforms.
- Install Terraform
- Verify installation:
terraform --version
If using AWS as the provider for Terraform, configure the AWS CLI.
- Install AWS CLI
- Configure AWS CLI:
aws configure
If using Python automation scripts, make sure Python 3 is installed.
- Install Python
- Verify installation:
python3 --version
Docker Compose is used to manage multi-container Docker applications.
- Install Docker Compose
- Verify installation:
docker-compose --version
To build the Docker image, navigate to the Docker directory and use the docker-compose command:
docker-compose build
Ensure that your Kubernetes cluster is up and running. You can use Minikube or a managed Kubernetes service like GKE or EKS.
For Minikube:
minikube start
Configure:
kubectl config use-context minikube
If you're provisioning infrastructure on AWS or another cloud provider, navigate to the Terraform directory:
cd Terraform
Initialize Terraform:
terraform init
To deploy your application and provision the infrastructure, you can either use the Python or Bash script.
Using Python:
python3 Scripts/deploy_pipeline.py
Using Bash:
bash Scripts/provision_infrastructure.sh
Once the deployment is complete, you can access your application depending on how the Kubernetes services are configured:
If you're using a LoadBalancer type service, check the external IP:
kubectl get services
If you're using Minikube, you can access the application through the Minikube service URL:
minikube service myapp-service --url
- The Terraform script currently provisions an EC2 instance in AWS. Modify the main.tf file for additional infrastructure setups (e.g., VPC, S3, etc.).
- The Kubernetes configurations are set for a basic app deployment, but you can modify the deployment.yaml to include environment variables, secrets, or additional configurations like autoscaling.
- Docker Compose is set to run the containerized app on localhost:5000. Modify the ports in the docker-compose.yml file if needed.
-
Docker errors: If you encounter issues with Docker, ensure that Docker is running and properly configured.
- Check Docker logs for more details: docker logs <container_id>
-
Kubernetes errors: Check the status of Kubernetes pods and services with: kubectl get pods kubectl get services
-
Terraform errors: Terraform errors can often be related to missing provider credentials or syntax issues in the .tf files. Ensure your credentials are configured correctly and try re-running the Terraform commands.
Feel free to submit issues or pull requests for improvements or bug fixes. You can also open issues to discuss potential changes or enhancements. All contributions are welcome to enhance the app’s features or functionality!
To contribute, please follow these steps:
- Fork the repository.
- Create a new branch for your feature or bug fix:
git checkout -b feat/your-feature-name
- Alternatively, for bug fixes:
git checkout -b fix/your-bug-fix-name
- Make your changes and run all tests before committing the changes and make sure all tests are passed.
- After all tests are passed, commit your changes with descriptive messages:
git commit -m 'add your commit message'
- Push your changes to your forked repository:
git push origin feat/your-feature-name.
- Submit a pull request to the main repository, explaining your changes and providing any necessary details.
If you have any questions or feedback, feel free to reach out at mrodr.contact@gmail.com.