Giter Club home page Giter Club logo

projet-devops's Introduction

Projet DevOps - Mise en oeuvre dʼAnsible, Docker & Terraform

Group IGS IPI Toulouse
Master IL 2023/2025
Devops & Cloud
Priscilla Joly

Create and manage an AWS virtual machine using Ansible and Terraform.

Create a Docker Image containing a README and a web-server application.

Requirements

  • Node.js version >= v18.17.0 is required.
  • Have an AWS Account
  • Docker install on your machine (local test)

🚀 Launch project

NextJS application

Start application

cd client

Install packages :

npm install

Run app :

npm run dev # Or see cleint/REAMDE.md

Localhost

☁️️ AWS

AWS service name
Virtual Machine (VM) EC2
Subnet VPC
Key pair EC2

Connect AWS CLI

You have to already have a secret key and an access key Easy goto to create key

aws configure

🐳 Docker

File : Dockerfile

  • Create a Docker Image of my application

Check if Docker is running on your computer

docker build DOCKERFILE_PATH

# docker build DOCKERFILE_PATH -t TAG_NAME

List Docker Images and get Image ID

docker images
docker run -p LOCAL_PORT:CONTAINER_PORT IMAGE-ID

# or docker run -p LOCAL_PORT:CONTAINER_PORT TAG_NAME

Localhost

🛠 Terraform

Folder : terraform-aws

  • Create VM on AWS
cd terraform-aws

💡Generate a SSH key

Easy goto to create key

💡You can add your own variables value in prod.tfvars

terraform init
terraform plan
terraform apply

# or terraform apply -var-file {FILE NAME VARS}
terraform destroy

# or terraform apply -var-file {FILE NAME VARS}

Try to connect to your EC2 instance

Terraform will return your Instance Public IP

Easy goto to connect

🧰 Ansible

Folder : ansible

  • Install Docker
  • Build and push Docker Image on AWS VM

🚨 In ansible/inventory add the ansible_hostname corresponding to your EC2 Adress IP

Run playbook

ansible-playbook -i inventory.ini playbook.yml

Access to your application :

http://YOUR_ADRESS_IP:3000/

Others

Generate a SSH public key

ssh-keygen -t rsa -b 2048 -f my-key-name

Connect to your EC2 instance

Documentation AWS EC2

Connexion à votre instance Linux depuis Linux ou macOS à l’aide de SSH

Connectez-vous à votre instance Linux

ssh -i private-key username@IP-adress

💡 username is ubuntu

💡 Terraform will return your Instance Public IP or Get IP adresse

💾 Resources

Default NextJS home page

Get IP Adress from AWS EC2

AWS EC2 - Resources

AWS EC2 - Instance

Get Access Key and Secret Key from AWS

Access to your access keys Root user access Create key Get information about key

Copy / past your secret key

You can also download CSV file to save it in your computer

projet-devops's People

Contributors

sekmset avatar

Stargazers

Lord Robin Crombez avatar

Watchers

 avatar Lord Robin Crombez 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.