Skip to content

πŸ›  [Work In Progress] Infrastructure pipeline for a Python service using Jenkins, Terraform, AWS, and Ansible

License

Notifications You must be signed in to change notification settings

ari-hacks/infra-pipeline

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

45 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Infrastructure pipeline

Pipeline Features

  • Jenkins
    • Server
    • Slack plugin (configuration link)
    • Integrate Github
  • Terraform
    • AWS EC2 instance resources
    • Remote state
  • AWS
    • Key Pair for SSH
    • Two EC2 instances
  • Ansible
    • Jenkins playbook
    • Web playbook
  • Docker
    • Containerized FastApi service
    • Build & Push tagged repo to docker hub
  • Terratest (Infrastructure testing)
    • Docker
    • Terraform

Set up

Requirements

Deploying infrastructure

  1. Create EC2 instances

    navigate to: \terraform\jenkins

     ➜ terraform init
    
     ➜ terraform plan
    
     ➜ terraform apply

    navigate to: \terraform\web

     ➜ terraform init
    
     ➜ terraform plan
    
     ➜ terraform apply
  2. Configure Ansible host configuration

    navigate to: \etc\ansible\host

    #servers and key config
    [jenkins]
    ubuntu@<public-dns> ansible_user=ubuntu ansible_ssh_key_private_file=~/.ssh/infra-key.pem
    [webservers]
    ubuntu@<public-dns> ansible_user=ubuntu ansible_ssh_key_private_file=~/.ssh/infra-key.pem 
    
  3. Run Playbooks

    navigate to: \ansible

    sudo ansible-playbook jenkins.yaml

    sudo ansible-playbook web.yaml

  4. Configure Jenkins and AWS EC2 instances

Running Tests

➜ cd test
➜ go test