Ausnahme gefangen: SSL certificate problem: certificate is not yet valid ๐Ÿ“Œ Tooling Website deployment automation with Continuous Integration. Introduction to Jenkins

๐Ÿ  Team IT Security News

TSecurity.de ist eine Online-Plattform, die sich auf die Bereitstellung von Informationen,alle 15 Minuten neuste Nachrichten, Bildungsressourcen und Dienstleistungen rund um das Thema IT-Sicherheit spezialisiert hat.
Ob es sich um aktuelle Nachrichten, Fachartikel, Blogbeitrรคge, Webinare, Tutorials, oder Tipps & Tricks handelt, TSecurity.de bietet seinen Nutzern einen umfassenden รœberblick รผber die wichtigsten Aspekte der IT-Sicherheit in einer sich stรคndig verรคndernden digitalen Welt.

16.12.2023 - TIP: Wer den Cookie Consent Banner akzeptiert, kann z.B. von Englisch nach Deutsch รผbersetzen, erst Englisch auswรคhlen dann wieder Deutsch!

Google Android Playstore Download Button fรผr Team IT Security



๐Ÿ“š Tooling Website deployment automation with Continuous Integration. Introduction to Jenkins


๐Ÿ’ก Newskategorie: Programmierung
๐Ÿ”— Quelle: dev.to

Tooling Website deployment automation with Continuous Integration. Introduction to Jenkins

In previous Project 8 we introduced horizontal scalability concept, which allow us to add new Web Servers to our Tooling Website and you have successfully deployed a set up with 2 Web Servers and also a Load Balancer to distribute traffic between them. If it is just two or three servers - it is not a big deal to configure them manually. Imagine that you would need to repeat the same task over and over again adding dozens or even hundreds of servers.

DevOps is about Agility, and speedy release of software and web solutions. One of the ways to guarantee fast and repeatable deployments is Automation of routine tasks.

In this project we are going to start automating part of our routine tasks with a free and open source automation server - Jenkins. It is one of the mostl popular CI/CD tools, it was created by a former Sun Microsystems developer Kohsuke Kawaguchi and the project originally had a named "Hudson".

Acording to Circle CI, Continuous integration (CI) is a software development strategy that increases the speed of development while ensuring the quality of the code that teams deploy. Developers continually commit code in small increments (at least daily, or even several times a day), which is then automatically built and tested before it is merged with the shared repository.

In our project we are going to utilize Jenkins CI capabilities to make sure that every change made to the source code in GitHub https://github.com/<yourname>/tooling will be automatically be updated to the Tooling Website.

Side Self Study

Read about Continuous Integration, Continuous Delivery and Continuous Deployment.

Task

Enhance the architecture prepared in Project 8 by adding a Jenkins server, configure a job to automatically deploy source codes changes from Git to NFS server.

Here is how your update architecture will look like upon competition of this project:

Tooling Website deployment automation with Continuous Integration. Introduction to Jenkins

In previous Project 8 we introduced horizontal scalability concept, which allow us to add new Web Servers to our Tooling Website and you have successfully deployed a set up with 2 Web Servers and also a Load Balancer to distribute traffic between them. If it is just two or three servers - it is not a big deal to configure them manually. Imagine that you would need to repeat the same task over and over again adding dozens or even hundreds of servers.

DevOps is about Agility, and speedy release of software and web solutions. One of the ways to guarantee fast and repeatable deployments is Automation of routine tasks.

In this project we are going to start automating part of our routine tasks with a free and open source automation server - Jenkins. It is one of the mostl popular CI/CD tools, it was created by a former Sun Microsystems developer Kohsuke Kawaguchi and the project originally had a named "Hudson".

Acording to Circle CI, Continuous integration (CI) is a software development strategy that increases the speed of development while ensuring the quality of the code that teams deploy. Developers continually commit code in small increments (at least daily, or even several times a day), which is then automatically built and tested before it is merged with the shared repository.

In our project we are going to utilize Jenkins CI capabilities to make sure that every change made to the source code in GitHub https://github.com/<yourname>/tooling will be automatically be updated to the Tooling Website.

Side Self Study

Read about Continuous Integration, Continuous Delivery and Continuous Deployment.

Task

Enhance the architecture prepared in Project 8 by adding a Jenkins server, configure a job to automatically deploy source codes changes from Git to NFS server.

Here is how your update architecture will look like upon competition of this project:

add_jenkins

Instructions On How To Submit Your Work For Review And Feedback

To submit your work for review and feedback - follow this instruction.

Step 1 - Install Jenkins server

  1. Create an AWS EC2 server based on Ubuntu Server 20.04 LTS and name it "Jenkins"

  2. Install JDK (since Jenkins is a Java-based application)

sudo apt update
sudo apt install openjdk-11-jre
#Confirm Java installation
java -version
  1. Install Jenkins

Refer to official Jenkins documentation for more details.

curl -fsSL https://pkg.jenkins.io/debian/jenkins.io-2023.key | sudo tee \
  /usr/share/keyrings/jenkins-keyring.asc > /dev/null
echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \
  https://pkg.jenkins.io/debian binary/ | sudo tee \
  /etc/apt/sources.list.d/jenkins.list > /dev/null
sudo apt-get update
sudo apt-get install -y jenkins

Make sure Jenkins is up and running

sudo systemctl status jenkins
  1. By default Jenkins server uses TCP port 8080 - open it by creating a new Inbound Rule in your EC2 Security Group

open_port8080

  1. Perform initial Jenkins setup.

From your browser access http://<Jenkins-Server-Public-IP-Address-or-Public-DNS-Name>:8080

You will be prompted to provide a default admin password

unlock_jenkins

Retrieve it from your server:

sudo cat /var/lib/jenkins/secrets/initialAdminPassword

Then you will be asked which plugings to install - choose suggested plugins.

jenkins_plugins

Once plugins installation is done - create an admin user and you will get your Jenkins server address.

The installation is completed!

Jenkins_Ready

Step 2 - Configure Jenkins to retrieve source codes from GitHub using Webhooks

In this part, you will learn how to configure a simple Jenkins job/project (these two terms can be used interchangeably). This job will will be triggered by GitHub webhooks and will execute a 'build' task to retrieve codes from GitHub and store it locally on Jenkins server.

  1. Enable webhooks in your GitHub repository settings

webhook_github

  1. Go to Jenkins web console, click "New Item" and create a "Freestyle project"

create_freestyle

To connect your GitHub repository, you will need to provide its URL, you can copy from the repository itself

github_url

In configuration of your Jenkins freestyle project choose Git repository, provide there the link to your Tooling GitHub repository and credentials (user/password) so Jenkins could access files in the repository.

github_add_jenkins

Save the configuration and let us try to run the build. For now we can only do it manually.
Click "Build Now" button, if you have configured everything correctly, the build will be successfull and you will see it under #1

jenkins_run1

You can open the build and check in "Console Output" if it has run successfully.

If so - congratulations! You have just made your very first Jenkins build!

But this build does not produce anything and it runs only when we trigger it manually. Let us fix it.

  1. Click "Configure" your job/project and add these two configurations

Configure triggering the job from GitHub webhook:

jenkins_trigger

Configure "Post-build Actions" to archive all the files - files resulted from a build are called "artifacts".

archive_artifacts

Now, go ahead and make some change in any file in your GitHub repository (e.g. README.MD file) and push the changes to the master branch.

You will see that a new build has been launched automatically (by webhook) and you can see its results - artifacts, saved on Jenkins server.

build_success_archive

You have now configured an automated Jenkins job that receives files from GitHub by webhook trigger (this method is considered as 'push' because the changes are being 'pushed' and files transfer is initiated by GitHub). There are also other methods: trigger one job (downstreadm) from another (upstream), poll GitHub periodically and others.

By default, the artifacts are stored on Jenkins server locally

ls /var/lib/jenkins/jobs/tooling_github/builds/<build_number>/archive/

Step 3 - Configure Jenkins to copy files to NFS server via SSH

Now we have our artifacts saved locally on Jenkins server, the next step is to copy them to our NFS server to /mnt/apps directory.

Jenkins is a highly extendable application and there are 1400+ plugins available. We will need a plugin that is called "Publish Over SSH".

  1. Install "Publish Over SSH" plugin.

On main dashboard select "Manage Jenkins" and choose "Manage Plugins" menu item.

On "Available" tab search for "Publish Over SSH" plugin and install it

plugin_ssh_install

  1. Configure the job/project to copy artifacts over to NFS server.

On main dashboard select "Manage Jenkins" and choose "Configure System" menu item.

Scroll down to Publish over SSH plugin configuration section and configure it to be able to connect to your NFS server:

  1. Provide a private key (content of .pem file that you use to connect to NFS server via SSH/Putty)
  2. Arbitrary name
  3. Hostname - can be private IP address of your NFS server
  4. Username - ec2-user (since NFS server is based on EC2 with RHEL 8)
  5. Remote directory - /mnt/apps since our Web Servers use it as a mointing point to retrieve files from the NFS server

Test the configuration and make sure the connection returns Success. Remember, that TCP port 22 on NFS server must be open to receive SSH connections.

publish_ssh_config

Save the configuration, open your Jenkins job/project configuration page and add another one "Post-build Action"

send_build

Configure it to send all files produced by the build into our previously define remote directory. In our case we want to copy all files and directories - so we use **.
If you want to apply some particular pattern to define which files to send - use this syntax.

send_build1

Save this configuration and go ahead, change something in README.MD file in your GitHub Tooling repository.

Webhook will trigger a new job and in the "Console Output" of the job you will find something like this:

SSH: Transferred 25 file(s)
Finished: SUCCESS

To make sure that the files in /mnt/apps have been udated - connect via SSH/Putty to your NFS server and check README.MD file

cat /mnt/apps/README.md

If you see the changes you had previously made in your GitHub - the job works as expected.

Congratulations!

You have just implemented your first Continous Integration solution using Jenkins CI. Watch out for advanced CI configurations in upcoming projects.

...



๐Ÿ“Œ Tooling Website deployment automation with Continuous Integration. Introduction to Jenkins


๐Ÿ“ˆ 87.65 Punkte

๐Ÿ“Œ What is CI/CD? Learn Continuous Integration/Continuous Deployment by Building a Project


๐Ÿ“ˆ 46.6 Punkte

๐Ÿ“Œ Continuous Integration and Continuous Deployment (CI/CD) for AI-Enabled IoT Systems


๐Ÿ“ˆ 46.6 Punkte

๐Ÿ“Œ 10 Years of Zuul Continuous Integration/Continuous Delivery rises to new successes


๐Ÿ“ˆ 34.64 Punkte

๐Ÿ“Œ VS Team Services Continuous Deployment Plugin on Jenkins config.xml information disclosure


๐Ÿ“ˆ 33.84 Punkte

๐Ÿ“Œ KDE neon, the installable KDE Linux with continuous integration and deployment, has migrated its base to Ubuntu 20.04 Long Term Support


๐Ÿ“ˆ 33.74 Punkte

๐Ÿ“Œ Continuous Integration, Delivery, and Deployment: Best Practises, Benefits, andย Tools


๐Ÿ“ˆ 33.74 Punkte

๐Ÿ“Œ Continuous Integration and Deployment for Data Platforms


๐Ÿ“ˆ 33.74 Punkte

๐Ÿ“Œ Extending GitOps: Effortless continuous integration and deployment on Kubernetes


๐Ÿ“ˆ 33.74 Punkte

๐Ÿ“Œ Security In 5: Episode 354 - DevSecOps, Differences Between Continuous Integration, Delivery and Deployment


๐Ÿ“ˆ 33.74 Punkte

๐Ÿ“Œ Continuous integration and deployment for desktop apps with GitHub Actions


๐Ÿ“ˆ 33.74 Punkte

๐Ÿ“Œ Part 5: Continuous Integration and Deployment (with examples)


๐Ÿ“ˆ 33.74 Punkte

๐Ÿ“Œ Continuous Integration: Jenkins sendet versehentlich anonyme Nutzungsdaten


๐Ÿ“ˆ 30.82 Punkte

๐Ÿ“Œ Continuous Integration: Jenkins sendet versehentlich anonyme Nutzungsdaten


๐Ÿ“ˆ 30.82 Punkte

๐Ÿ“Œ Continuous Integration: Jenkins sendet versehentlich anonyme Nutzungsdaten


๐Ÿ“ˆ 30.82 Punkte

๐Ÿ“Œ iX-Workshop: Continuous Integration mit Jenkins


๐Ÿ“ˆ 30.82 Punkte

๐Ÿ“Œ Workshop: Continuous Integration und Delivery mit Jenkins


๐Ÿ“ˆ 30.82 Punkte

๐Ÿ“Œ Continuous Integration: Jenkins sendet versehentlich anonyme Nutzungsdaten


๐Ÿ“ˆ 30.82 Punkte

๐Ÿ“Œ Continuous Integration: Jenkins-Grรผnder will Software in Cloud-ร„ra รผberfรผhren


๐Ÿ“ˆ 30.82 Punkte

๐Ÿ“Œ heise-Angebot: iX-Seminar: Einstieg in die Continuous Integration mit Jenkins


๐Ÿ“ˆ 30.82 Punkte

๐Ÿ“Œ heise-Angebot: Online-Workshop: Continuous Integration mit Jenkins


๐Ÿ“ˆ 30.82 Punkte

๐Ÿ“Œ Continuous Integration: Jenkins ist Klassenerster der Cloud Delivery Foundation


๐Ÿ“ˆ 30.82 Punkte

๐Ÿ“Œ heise-Angebot: Online-Workshop: Continuous Integration mit Jenkins


๐Ÿ“ˆ 30.82 Punkte

๐Ÿ“Œ heise-Angebot: Einsgtieg in die Continuous Integration mit Jenkins


๐Ÿ“ˆ 30.82 Punkte

๐Ÿ“Œ heise-Angebot: Einstieg in die Continuous Integration mit Jenkins


๐Ÿ“ˆ 30.82 Punkte

๐Ÿ“Œ heise-Angebot: Einstieg in die Continuous Integration mit Jenkins


๐Ÿ“ˆ 30.82 Punkte

๐Ÿ“Œ heise-Angebot: iX-Workshop: Continuous Integration und agile Softwareentwicklung mit Jenkins


๐Ÿ“ˆ 30.82 Punkte

๐Ÿ“Œ heise-Angebot: iX-Workshop: Continuous Integration und agile Softwareentwicklung mit Jenkins


๐Ÿ“ˆ 30.82 Punkte

๐Ÿ“Œ TeamCity vs Jenkins for Continuous Integration [2023 Update] | UpGuard


๐Ÿ“ˆ 30.82 Punkte

๐Ÿ“Œ heise-Angebot: iX-Workshop: Continuous Integration und agile Softwareentwicklung mit Jenkins


๐Ÿ“ˆ 30.82 Punkte

๐Ÿ“Œ heise-Angebot: iX-Workshop: Continuous Integration und agile Softwareentwicklung mit Jenkins


๐Ÿ“ˆ 30.82 Punkte

๐Ÿ“Œ Experience Continuous Integration with Jenkins | Ansible | Artifactory | SonarQube | PHP


๐Ÿ“ˆ 30.82 Punkte

๐Ÿ“Œ jenkins, gerrit, tooling


๐Ÿ“ˆ 27.33 Punkte











matomo