Giter Club home page Giter Club logo

blue-green's Introduction

blue-green

PFB the User-Data

#!/bin/bash -xe

yum update -y

Apache install and index.html file creation

yum install httpd -y echo 'Hello' >> /var/www/html/index.html systemctl restart httpd

Code Deploy Agent Bootstrap Script##

exec > >(tee /var/log/user-data.log|logger -t user-data -s 2>/dev/console) 2>&1 AUTOUPDATE=false

function installdep(){

if [ ${PLAT} = "ubuntu" ]; then

apt-get -y update

Satisfying even ubuntu older versions.

apt-get -y install jq awscli ruby2.0 || apt-get -y install jq awscli ruby

elif [ ${PLAT} = "amz" ]; then yum -y update yum install -y aws-cli ruby jq

fi

}

function platformize(){

#Linux OS detection# if hash lsb_release; then echo "Ubuntu server OS detected" export PLAT="ubuntu"

elif hash yum; then echo "Amazon Linux detected" export PLAT="amz"

else echo "Unsupported release" exit 1

fi }

function execute(){

if [ ${PLAT} = "ubuntu" ]; then

cd /tmp/ wget https://aws-codedeploy-${REGION}.s3.amazonaws.com/latest/install chmod +x ./install

if ./install auto; then echo "Instalation completed" if ! ${AUTOUPDATE}; then echo "Disabling Auto Update" sed -i '/@reboot/d' /etc/cron.d/codedeploy-agent-update chattr +i /etc/cron.d/codedeploy-agent-update rm -f /tmp/install fi exit 0 else echo "Instalation script failed, please investigate" rm -f /tmp/install exit 1 fi

elif [ ${PLAT} = "amz" ]; then

cd /tmp/ wget https://aws-codedeploy-${REGION}.s3.amazonaws.com/latest/install chmod +x ./install

if ./install auto; then
  echo "Instalation completed"
    if ! ${AUTOUPDATE}; then
        echo "Disabling auto update"
        sed -i '/@reboot/d' /etc/cron.d/codedeploy-agent-update
        chattr +i /etc/cron.d/codedeploy-agent-update
        rm -f /tmp/install
    fi
  exit 0
else
  echo "Instalation script failed, please investigate"
  rm -f /tmp/install
  exit 1
fi

else echo "Unsupported platform ''${PLAT}''" fi

}

platformize installdep REGION=$(curl -s 169.254.169.254/latest/dynamic/instance-identity/document | jq -r ".region") execute

blue-green's People

Contributors

thecloudworldadmin 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.