Build using Jenkins & Deploy using Nife
Before proceeding further, lets install Jenkins on top of EC2 instance and Configure Jenkins.
Installation process on Jenkins can be done using these steps
To deploy to Jenkins we essentially need four things.- The application you want to deploy.
- A runnable copy of nifectl.toml
- A nife.toml file.
- Your Nife API Token.
On Jenkins, the CI/CD system takes care of the first requirement for you.
Step 1- Lets create our First pipeline. Click on New Item.![Jenkins Deployment.](/assets/images/image1-861c6e38281f5b95d4aa701b60d79910.jpg)
Enter a job name and select Pipeline as shown in the image below.
![Jenkins Pipeline](/assets/images/image2-8581e3e8115d1b1738fff26a7b059799.jpg)
Step 2 -In the configuration page of Jenkins, enter the github repo URL.
![Jenkins configuration.](/assets/images/image3-0b2d3195e7129c9412d0c04270a9a630.jpg)
Step 3 -In the pipeline section, we have written a pipeline script.
![Jenkins Pipeline Script](/assets/images/image4-45d5df788a603e666dec87fba4cbadbd.jpg)
For Configuring with Nife
#
Prerequisite:- Before proceeding further we install nifectl with the command in the github actions.
- We need nife.toml file and an auth token.
For the API token use nifectl, using the token previously logged with.
Run nifectl auth token and this will display the token your session. Use this token value into NIFE_ACCESS_TOKEN environment variables inside the deployment.
![Environment variable](/assets/images/image5-7b2affdb9253c36401073a53cd62c71d.jpg)
Ready to Deploy
We are now ready to build the job. On the Jenkins web UI, head to dashboard. You will see jobs and the deployment job running.
Now Click on the running badges to see the progress.
Job’s DoneAnd that’s pretty much for deploying with Jenkins CI/CD system. There’s lot more functionality in there allowing you to structure the pipeline as you want and trigger different jobs at different times.