DevOps Classroom notes 30/Oct/2024

Deployment of a Simple Website

  • We need a linux server
    • This can be an azure vm or aws ec2 instance
  • We need to install webserver software
    • apache
    • nginx
  • We need to copy the website Refer Here to particular
    • /var/www/html

Manual Steps

  • Install nginx
sudo apt update
sudo apt install nginx -y
  • Now webserver should be installed
sudo systemctl status nginx
  • Now we can access the webserver over http => http://publicip
  • Now lets download the website into /tmp
cd /tmp
wget https://www.free-css.com/assets/files/free-css-templates/download/page295/antique-cafe.zip
  • Install unzip
sudo apt install unzip -y
  • Now unzip the antique-cafe
unzip antique-cafe.zip
  • Now lets copy the folder 2126_antique_cafe to /var/www/html/cafe/
sudo mv 2126_antique_cafe/ /var/www/html/cafe
  • Now access http://<public-ip>/cafe

Possible Options to automate the website deployment

  1. Shell Scripts:
  2. Procedural in nature (i.e. define how it has to be done)
  3. Are not idempotent by default
  4. Solution:
#!/bin/bash
WEB_DESIGN_ZIP='https://www.free-css.com/assets/files/free-css-templates/download/page295/antique-cafe.zip'
SITE_NAME='cafe'
sudo apt update
sudo apt install nginx -y
cd /tmp
wget $WEB_DESIGN_ZIP
sudo apt install unzip -y
unzip antique-cafe.zip
sudo mv 2126_antique_cafe/ /var/www/html/$SITE_NAME
  1. Configuration Management
  2. Declarative in nature (what we want )
  3. Most of the ansible is idempotent

Setup Ansible (on Azure VM)

  • Installation overview
  • For guided creation watch classroom video
  • Installation Refer Here and Refer Here for distro based installation
  • Refer Here for ubuntu based steps
sudo apt update
sudo apt install software-properties-common
sudo add-apt-repository --yes --update ppa:ansible/ansible
sudo apt install ansible -y
  • To verify the installation
ansible --version

Ansible ping test

  • This is used to check if the ansible control node can communicate with the node or not
  • Create an inventory file with node ip in it
  • Now execute the following command
ansible -i hosts -m ping all


* In the above case we have not passed credentials

Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a comment

Turn on JavaScript to leave a comment.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Social Media Icons Powered by Acurax Web Design Company
Exit mobile version
%%footer%%