GithubHelp home page GithubHelp logo

bridgecrew-perf7 / deploy6 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ibrahima1289/kura-deployment-6

0.0 0.0 0.0 998 KB

This is a new repo created for the deployment 6.

JavaScript 97.40% CSS 0.74% HTML 1.85%

deploy6's Introduction

Deployment 6 - React App

This is the sixth deployment homework from kura labs.

1. Configure EC2 on AWS:

1.1 The first EC2 is the master where Jenkins is installed (Linux environment).

Configure the Security Groups (SG):

For the inbound rule: open port 22, and 8080
For the outbound rule: open all ports.

SSH into the master:

Intalling Jenkins in an EC2 using bash script

	#!/bin/bash
	sudo amazon-linux-extras install java-openjdk11
	sudo amazon-linux-extras install epel
	sudo wget -O /etc/yum.repos.d/jenkins.repo \
	https://pkg.jenkins.io/redhat-stable/jenkins.repo
	sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
	sudo yum upgrade -y
	sudo yum install epel-release java-11-openjdk-devel -y
	sudo yum install jenkins -y
	sudo systemctl start jenkins

Once Jenkins is installed, log in with the admin password to create an account.

Here is the bash script to find the admin password:

	#!/bin/bash
	sudo systemctl status jenkins
	sudo cat /var/lib/jenkins/secrets/initialAdminPassword

Now, install these plugins in Jenkins: NodeJs, EC2 plugins, and Maven.

Create the agents: you can find how to create agents in the documentation of the deployment 5.

1.2 The second EC2 is the first agent (Ubuntu OS)

Configure the Security Groups (SG):

For the inbound rule: open port 22, and 5000
For the outbound rule: open all ports.

SHH into the first agent:

Install requirements for Ubuntu EC2 - also called agent 1 using bash script.

  #!/bin/bash
  sudo apt-get update && sudo apt-get upgrade -y
  sudo apt-get install -y \
  default-jre \
  git \
  nodejs -y \
  npm -y

1.3 The third EC2 is the second agent (Ubuntu OS)

For the inbound rule: open port 22
For the outbound rule: open all ports.

SHH into the second agent (same method as agent 1):

Requirements for Ubuntu EC2 - also called agent 2 using bash script..

  #!/bin/bash
  sudo apt-get update && sudo apt-get upgrade -y
  sudo apt-get install -y \
  default-jre \
  git \
  nodejs \
  npm \
  maven \
  libgtk2.0-0 \
  libgtk-3-0 \
  libgbm-dev \
  libnotify-dev \
  libgconf-2-4 \
  libnss3 \
  libxss1 \
  libasound2 \
  libxtst6 \
  xauth \
  xvfb

Now, you will see on your Jenkins console all three EC2s connected as shown below.

2. Fork the repository where the codes are.

2.1 Create a new repository (I named it Deploy6)

Remove PDF, and README files.

2.2 Create the Jenkinsfile.

I placed all the files and folders from the original repository in the root directory to avoid errors.

2.3 Create a job in Jenkins and build it.
Here is the result:

2.4 Make a failed test.

For this, we will alter the result My Awesome Web Application into Awesome Web Application for the heading.

Here is the result:

After we fix it again, the buid is successfull.

3. Find and upload the video and screenshot files.

We will follow the procedure below:

Step 1: First, locate the video and screenshot files.

$ find /home -name *.mp4

Step 2: Move the files into the folder Deploy6.

$ cd /home/ubuntu/jenkins/workspace/Jk-Pipeline_main/cypress
$ mv videos screenshots videos 
$ cd ~/Deploy6

Step 3: SSH into Github repository from agent 2.
For this, follow these instructions.

Generate a ssh key for the agent.

$ cd ~
$ ssh-keygen
$ ls
$ cat deploy6.pub

Now, go to your github account > settings > SSH and GPG keys > New SSH key

Copy and paste public key (deploy6.pub)

Click > Add SSH key

Go back to the terminal, type the commands below to ssh into the github repository.

$ eval `ssh-agent -s`
$ ssh-add deploy6

Clone github account repository.

Go to the repo and copy the URL where the repo is located.
You can also do this by copying the SSH link shown in the picture below.

$ git clone [email protected]:ibrahima1289/Deploy6.git
$ ls

Now, upload the video and screenshot found in Deploy6 into the github repository Deploy6.
Follow the command below.

$ git add .
$ git commit -m "adding videos and scrennshots to repo"
$ git pull
$ git push origin main

Troubleshooting:

Before I was able to continue this deployment, I had many failing builds at the test phase of the pipeline. With my co-workers (Sai and Ricardo, I was able to identify that in the Jenkinsfile, I needed to update the first agent ( wich I had agent any instead of what is in the picture below.

deploy6's People

Contributors

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