There are a number of Jenkins plugins that can effectively assist us in creating snapshot backups. You will need to choose the one that best suits your specific needs. All of the above listed plugins are available from the Jenkins Manage Plugins screen. The following screenshot shows some of the available backup plugins on the Jenkins Manage Plugins screen:. Installing any of the available backup plugins or any plugin for that matter can be accomplished by simply marking the appropriate checkbox and clicking on the Download now and install after restart button.
Once the plugin has been installed, it is highly recommended that you read any usage instructions and documentation. If resources are available, another disaster-recovery option might be to set up a Jenkins mirror.
A Jenkins mirror replicates a primary Jenkins instance in real time onto another host. This way, if there is an outage on the primary Jenkins instance, we can simply alternate traffic over to the mirror. The Jenkins master can then be swapped with the mirror if there is a failure, or even if the primary instance is undergoing maintenance that requires downtime. To begin the implementation of a Jenkins mirroring solution, we will need two systems with matching configurations OS, disk, RAM, and so on.
The first system will have Jenkins installed and may already be in production use. This system will be referred to as the Jenkins-Primary. The second system will need to be preconfigured with a basic installation of Jenkins which will be replaced later. This system will be referred to as the Jenkins-Mirror.
Once Jenkins is installed on the Jenkins-Mirror, we will need to shut down the Jenkins service. Our next step in creating a Jenkins mirroring solution is to install the rsync and openssh-clients packages on both hosts primary and mirror.
Rsync is a widely utilized file and folder synchronization tool that replicates files, folders, and data across devices. It has the ability to synchronize entire folder structures or just the deltas. This makes it an optimal tool for our implementation of the Jenkins mirroring solution. The openssh-clients package works in tandem with rsync and enables rsync to perform its synchronization tasks over the SSH protocol.
Let's take a minute to get these installed on the Jenkins primary and mirror systems. Once rsync has been installed, let's verify that it is operating properly.
Execute the following commands in the command-line terminal:. If everything is functioning correctly, RSYNC will return an output similar to the examples provided here for both primary and mirror :.
To accomplish this, we need to use the command sudo to access the root user account on the Jenkins-Mirror, and have rsync fetch the contents from the Jenkins-Primary. Enter the following commands into the terminal on the Jenkins-Mirror replace jenkinsprimary in the following command with your Jenkins-Primary IP address :.
Upon completion, you should see something similar to the following message in your terminal:. Once rsync has completed, we need to verify that the initial transfer was successful by starting the Jenkins service on the Jenkins-Mirror. We should inspect it to make sure it looks identical to the Jenkins-Primary server. Enter the following commands into the command line terminal to fire up Jenkins on the Jenkins-Mirror:.
To get SSH key-based authentication implemented we will need to create SSH keys and share them across our server solutions. This includes the Jenkins-Primary and Jenkins-Mirror hosts. It is important to mention that this step may not be necessary if your host already has the RSA or DSA keys generated for the root user account.
Once this step has been completed successfully, we should have the proper prerequisites in place to connect bidirectionally via SSH without being prompted for a password. Let's test this functionality by executing the following commands on both the Jenkins-Primary and Jenkins-Mirror hosts:.
Once the SSH key authentication has been verified, we will need to implement our synchronization solution on a schedule. Once the authentication has been verified, we will need to implement our syncing on a scheduled basis for this we will use the CRON tab.
Finally, we can configure our CRON tab to execute rsync. This will enable the Jenkins-Mirror to automatically retrieve the filesystem deltas once every 30 minutes. To achieve this, we need to open the crontab on the mirror crontab —e and add a directive, like the one shown here:. Once the crontab entry has been input and saved, we should see data transferred from the Jenkins-Primary server to Jenkins-Mirror every 30 minutes.
This will ensure that changes to the jobs are tracked and recoverable on the mirror if they were to be corrupted for any reason. This installer has a similar guided installation wizard as the Microsoft Windows one, and allows us to specify the traditional installation details. For users who wish to alter the Jenkins listening port or memory options, some command-line magic will be required. To alter the Jenkins listening port, we need to explicitly define the port in the following properties file:.
To accomplish this we will need to create the winstone. An example of how to set httpPort in the winstone. Once created, the winstone.
The winstone. There are other options available for customization as well. These options include logfile , httpListenAddress , and more. To obtain a complete list of the available override options, you can run the following commands from your OS X terminal:. The launch daemon retrieves the values stored in this properties file. If no such file exists, the system will use the built-in defaults.
On Mac OS X, this plist file will typically reside in the following location:. Adjusting the Java memory options for Jenkins involves modifying the appropriate property entries inside the org. To modify this file, we can use the OS X defaults command. This command allows us to read and write entries in the plist file without fear of corruption or improper formatting. A few example descriptions and use cases for this command are detailed in the sections below.
To view all settings in the plist file, execute the following command in the command-line terminal:. To retrieve the value of the heapSize setting from the plist file, execute the following command in the command-line terminal:. To set the value of the heapSize setting in the plist file, execute following command in the command-line terminal:.
If any alterations are made to the org. To restart Jenkins from the OS X command line terminal enter the following commands in the terminal:. The Jenkins community recognizes that installing an edge release may be risky, and upgrading weekly the default option may pose a bit of an overhead in maintenance. The Jenkins LTS release is delivered once every 12 weeks instead of every week and is selected by community vote.
The Jenkins LTS release represents a community- voted selection of the most stable Jenkins release within the past 12 weeks. The Jenkins platform features a streamlined upgrade process, and typically provides all upgrades through the Jenkins UI. To convert a Jenkins installation over to the LTS line, there are two options available:. Uninstall and replace the existing latest and greatest installation with the LTS package immediate, but nuclear, option.
This section will focus on converting an existing installation over to the LTS release line. This is because uninstalling and reinstalling the Jenkins platform is a straightforward process and is already documented in a number of places. To migrate our Jenkins installation to the LTS release line, we will need to modify hudson. The Hudson. The contents of this XML file are shown here:. Let's replace the existing update center URL with the one shown here:.
Once the file is modified and saved, we need to restart the Jenkins service to complete the switchover to the LTS release line for all future updates. The LTS release comes out every 12 weeks. We will need to wait for this cycle to complete before our Jenkins instance is completely switched over.
This means that if the target setup is new, we can leverage the LTS Docker container if desired to perform the duties of the Jenkins master. Configuration data in Jenkins is persisted to disk via XML files.
These XML files contain information describing how the Jenkins instance will behave. Understanding how Jenkins implements configuration XML files and manages the data they contain can prove to be valuable in debugging issues and keeping the system stable. In Jenkins, persistent configuration data is serialized into XML and subsequently written to disk. The primary Jenkins subsystem serializes its data into config.
These config. The primary config. An example of this configuration file is provided here taken from an Apple OS X installation of Jenkins :. As we can see, the nodes defined in the XML file provide configuration definitions for the overall Jenkins system. The nodes govern the overall behavior of the Jenkins system.
Some of the configuration highlights include:. The second configuration XML we will investigate is dedicated to Jenkins jobs. Each config. As we can see from the sample config. This includes information related to SCM solutions, triggers , builders , publishers , buildWrappers, and more. It is highly recommended that all Jenkins configuration files are committed to source control.
This will ensure that changes and history are preserved properly. This solution will also provide the ability to revert changes to a Jenkins job when needed. In this chapter, we have focused on techniques that taught us how to create and manage a Jenkins instance.
A basic understanding of the core elements of Jenkins is required to make the best use of this book. This site comply with DMCA digital copyright. We do not store files not owned by us, or without the permission of the owner. We also do not have links that lead to sites DMCA copyright infringement. If You feel that this book is belong to you and you want to unpublish it, Please Contact us.
Mastering Jenkins. Download e-Book. The book begins with giving you high-level architectural fundamentals surrounding Jenkins and Continuous Integration. You will cover the different installation scenarios for Jenkins, and see how to install it as a service, as well as the advanced XML configurations.
By the end of this book, you will have all the knowledge necessary to be the definitive resource for managing and implementing advanced Jenkins automation solutions for your organization. If you are a novice or intermediate-level Jenkins user who has used Jenkins before but are not familiar with architecting solutions and implementing it in your organization, then this is the book for you.
A basic understanding of the core elements of Jenkins is required to make the best use of this book. Save my name, email, and website in this browser for the next time I comment.
Notify me of follow-up comments by email. Notify me of new posts by email. This site uses Akismet to reduce spam. Learn how your comment data is processed. Programmer Books. Home Machine learning Books Mastering Jenkins.
0コメント