Giter VIP home page Giter VIP logo

microsvc's Introduction

CI-CD flow using Jenkins/Terraform/Ansible/Docker

This is a demo project for provisiong server, configuring server and deploying a backend app using Jenkins + Terraform + Ansible.

Notice: Docker image of the backend application is built automatically by Github Action.

Prerequisites

1. Install Jenkins server

Guide : https://www.digitalocean.com/community/tutorials/how-to-install-jenkins-on-ubuntu-20-04

2. Install Ansible and Terraform

Install Ansible

apt-get update && apt-get install -y ansible

Install Terraform

sudo apt-get update && sudo apt-get install -y gnupg software-properties-common curl
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
sudo apt-get update && sudo apt-get install terraform

3. Create a key for AWS Key Pair

This is a key used for connecting to AWS EC2 Instance provisioned using Terraform.

sudo su jenkins
ssh-keygen -f ~/.ssh/aws_key

4. Configure AWS credential file

This is a credential file for connecting to AWS services. This credential file is used by Terraform.

sudo su jenkins
mkdir ~/.aws
nano ~/.aws/credentials

And add the content below with the approriate values.

[default]
aws_access_key_id = <access_key>
aws_secret_access_key = <secret_key>

Configure Jenkins

Setup Ansible and Terraform tools

Install ansible and terraform plugins in Jenkins -> Manage Plugins -> Available.

Confirm the installation directory for ansible/terraform binaries inside Jenkins server. Then set the tool name and the installation directory under Ansible/Terraform in Jenkins -> Manage Plugins -> Global Tool Configuration.

Create a pipeline

Create a Pipeline job (New Item -> Pipeline) and set Jenkinsfile under Pipeline script from SCM.

image

Once a Pipeline job created, please build it. It will provision an AWS EC2 server and install everything, finally deploy the backend service.

Check Backend endpoint.

The final stage Backend Url of the pipeline should show the backend url. Then open it on web browser.

microsvc's People

Contributors

anaxdev avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.