Giter VIP home page Giter VIP logo

nodejs-aws-codedeploy-pipeline's Introduction

nodejs-aws-codedeploy-pipeline

How to set ci/cd for nodejs app with aws codeDeploy and aws codePipeline

Installation instructions

1. Launch amazon linux server in aws

2. ssh to linux to install packages

ssh -i <key.pem> ec2-user@<ip-address> -v

3. Update and Upgrade linux machine and install node, nvm and pm2

sudo yum update
sudo yum upgrade
sudo yum install -y git htop wget

3.1 install node

To install or update nvm, you should run the [install script][2]. To do that, you may either download and run the script manually, or use the following cURL or Wget command:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash

Or

wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash

Running either of the above commands downloads a script and runs it. The script clones the nvm repository to ~/.nvm, and attempts to add the source lines from the snippet below to the correct profile file (~/.bash_profile, ~/.zshrc, ~/.profile, or ~/.bashrc).

3.2 Copy & Past (each line separately)

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

3.3 Verify that nvm has been installed

nvm --version

3.4 Install node

nvm install --lts # Latest stable node js server version

3.5 Check nodejs installed

node --version

3.6 Check npm installed

npm -v

4. Clone nodejs-aws-codedeploy-pipeline repository

cd /home/ec2-user
git clone https://github.com/saasscaleup/nodejs-aws-codedeploy-pipeline.git

5. Run node app.js (Make sure everything working)

cd nodejs-aws-codedeploy-pipeline
npm install
node app.js

6. Install pm2

npm install -g pm2 # may require sudo

7. Set node, pm2 and npm available to root

sudo ln -s "$(which node)" /sbin/node
sudo ln -s "$(which npm)" /sbin/npm
sudo ln -s "$(which pm2)" /sbin/pm2

8 Starting the app as sudo (Run nodejs in background and when server restart)

sudo pm2 start app.js --name=nodejs-express-app
sudo pm2 save     # saves the running processes
                  # if not saved, pm2 will forget
                  # the running apps on next boot

8.1 IMPORTANT: If you want pm2 to start on system boot

sudo pm2 startup # starts pm2 on computer boot

9. Install aws code deploy agent

sudo yum install -y ruby 
wget https://aws-codedeploy-us-east-1.s3.us-east-1.amazonaws.com/latest/install
chmod +x ./install
sudo ./install auto
sudo service codedeploy-agent start

10. Continue in AWS console...

Watch the rest of the youtube video...

Support ๐Ÿ™๐Ÿ˜ƒ

If you Like the tutorial and you want to support my channel so I will keep releasing amzing content that will turn you to a desirable Developer with Amazing Cloud skills... I will realy appricite if you:

  1. Subscribe to My youtube channel and leave a comment: http://www.youtube.com/@ScaleUpSaaS?sub_confirmation=1
  2. Buy me A coffee โค๏ธ : https://www.buymeacoffee.com/scaleupsaas

Thanks for your support :)

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.