100-Days-Of-DevOps-Challenge-KodeKloud

Jenkins Deploy Pipeline

The development team of xFusionCorp Industries is working on to develop a new static website and they are planning to deploy the same on Nautilus App Servers using Jenkins pipeline. They have shared their requirements with the DevOps team and accordingly we need to create a Jenkins pipeline job. Please find below more details about the task:

Click on the Jenkins button on the top bar to access the Jenkins UI. Login using username admin and password Adm!n321.

Similarly, click on the Gitea button on the top bar to access the Gitea UI. Login using username sarah and password Sarah_pass123. There under user sarah you will find a repository named web_app that is already cloned on Storage server under /var/www/html. sarah is a developer who is working on this repository.

  1. Add a slave node named Storage Server. It should be labeled as ststor01 and its remote root directory should be /var/www/html.

  2. We have already cloned repository on Storage Server under /var/www/html.

  3. Apache is already installed on all app Servers its running on port 8080.

  4. Create a Jenkins pipeline job named datacenter-webapp-job (it must not be a Multibranch pipeline) and configure it to:

    • Deploy the code from web_app repository under /var/www/html on Storage Server, as this location is already mounted to the document root /var/www/html of app servers. The pipeline should have a single stage named Deploy ( which is case sensitive ) to accomplish the deployment.

LB server is already configured. You should be able to see the latest changes you made by clicking on the App button. Please make sure the required content is loading on the main URL https://<LBR-URL> i.e there should not be a sub-directory like https://<LBR-URL>/web_app etc.

Note:

Steps

  1. Update plugins and restart jenkins
  2. Install following plugins:
    • SSH Build Agent
    • Pipeline
  3. Add storage server credential; Manage Jenkins > Credentials > System > Global > Add credentials:
    • username: natasha
    • Password: Bl@kW
    • ID: ststor01
  4. Add agent:
    • name: Storage Server
    • remote dir: /var/www/html
    • label: ststor01
    • Launch Method: SSH
      • host: ststor01
      • credential: natasha/pass
      • host key: no verification
    • Save
  5. Login into Storage server and install java

     sudo yum install java-21-openjdk -y
    

    Add the permission of /var/www/html directory:

     sudo chown -R natasha:natasha /var/www/html
    
  6. Create a jenkins pipeline job:
  7. Build

Good to Know?

Jenkins Pipelines

Pipeline Components

Deployment Pipelines

Best Practices