Skip to content

Instantly share code, notes, and snippets.

@paul58914080
Created August 15, 2020 07:33
Show Gist options
  • Save paul58914080/5b7df6c6ad3361c94decf868b7183217 to your computer and use it in GitHub Desktop.
Save paul58914080/5b7df6c6ad3361c94decf868b7183217 to your computer and use it in GitHub Desktop.
Jenkins setup and pipeline

Jenkins

Installing jenkins is quite simple. The easiest way to install it is through docker. You can check the official documentation for more details. In this documentation I will share with you what I did to install jenkins and setup my ci pipelines.

Installing with docker

There are two kinds of versioning supported by jenkins long term support and regular release. You can directly install and run jenkins as war. Here we will try to use the container concept and use docker to help us install jenkins and boot the same.

Checkout the documentation at https://www.jenkins.io/doc/book/installing/. I tried replicating the steps of On macOS and Linux

I tried to install the regular release(2.252) and exposed jenkins with 49000 port. The command to do so (step 4 from documentation)

docker container run --name jenkins-2.252 --rm --detach \
  --network jenkins --env DOCKER_HOST=tcp://docker:2376 \
  --env DOCKER_CERT_PATH=/certs/client --env DOCKER_TLS_VERIFY=1 \
  --volume jenkins-data:/var/jenkins_home \
  --volume jenkins-docker-certs:/certs/client:ro \
  --publish 49000:8080 --publish 50000:50000 jenkins/jenkins:2.252

Configuring jenkins for the first time

You would then need to perform post-installation setup

Go to http://localhost:49000

if you would like to follow the logs you can try this command

docker logs --follow jenkins-2.252

Exposing your port to outside world fot github webhooks

Reference

Head on over to https://ngrok.com/ and signup for an account, using whichever method you choose. Then you should be greeted with the screen below showing how to unzip and run it.

Start your ngrok with the following command

./ngrok http 49000

This would output something like

ngrok by @inconshreveable
Session Status                online
Account                       Paul Williams (Plan: Free)
Version                       2.3.35
Region                        United States (us)
Web Interface                 http://127.0.0.1:4040
Forwarding                    http://dfghfdhqw4.ngrok.io -> http://localhost:49000
Forwarding                    https://sdfsdfsdf.ngrok.io -> http://localhost:49000
Connections                   ttl     opn     rt1     rt5     p50     p90
                              32      0       0.08    0.07    9.42    14.31
HTTP Requests
-------------

Now you can test if the requests are being forwarded to with https://sdfsdfsdf.ngrok.io and see if your jenkins page is rendered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment