nginx reverse proxy with jenkins ci on archlinux
Setting up the Jenkins CI on archlinux is a dead simple affair.
At this time of writing, the package build is available on AUR here – https://aur.archlinux.org/packages.php?ID=46156.
I normally manage my AUR packages using `yaourt`.
If you are new to arch and arch’s default package manager `pacman`, `yaourt` is essentially a community contributed wrapper around pacman and gives us an easy interface to grab packages from AUR beyond the standard packages available on core, extra and community.
In order to use ‘yaourt’, my pacman.conf is usually updated to include:
[archlinuxfr] Server = http://repo.archlinux.fr/$arch
Once we have this repository available in our pacman.conf, we can grab `yaourt` via `pacman -S yaourt`; the `yaourt` package manager now becomes available for us to use, to grab jenkins.
yaourt -S jenkins ... ==>;; Continue installing jenkins ? [Y/n] ==>;; [v]iew package contents 1heck package with namcap ==>;; --------------------------------------------------- ==>;; Y loading packages... resolving dependencies... looking for inter-conflicts... Targets (1): jenkins-1.476-1 Total Installed Size: 47.42 MiB Proceed with installation? [Y/n] Y (1/1) checking package integrity [#########################################################################] 100% (1/1) loading package files [#########################################################################] 100% (1/1) checking for file conflicts [#########################################################################] 100% warning: could not get filesystem information for /var/lock (deleted): No such file or directory (1/1) checking available disk space [#########################################################################] 100% (1/1) installing jenkins [#########################################################################] 100% >;;>;;>;; Creating user and group and setting permissions... >;;>;;>;; >;;>;;>;; Jenkins can now be started via /opt/jenkins/bin/jenkins or via >;;>;;>;; /etc/rc.d/jenkins. >;;>;;>;; Jenkins is running by default on port 8070 and is bound to all interfaces, >;;>;;>;; you can change this in the /opt/jenkins/conf/wrapper.conf as well. >;;>;;>;; For additional information please visit http://jenkins-ci.org Optional dependencies for jenkins apache: a full featured webserver maven: a java project management and project comprehension tool
The post-installation notes is self-explanatory. Opening /opt/jenkins/conf/wrapper.conf, we can see
wrapper.app.parameter.2=--httpPort=8070
and since we want our jenkins to be available only through nginx, we simply add in
wrapper.app.parameter.3=--httpListenAddress=127.0.0.1
With these updated in our wrapper.conf, we can now start our jenkins instance:-
rc.d start jenkins Starting Jenkins Continuous build server...Waiting for Jenkins Continuous build server....... Jenkins Continuous build server started.
Correspondingly in our /etc/nginx/nginx.conf file, we should provide a proxy_pass to our jenkins instance when it begins running on 127.0.0.1:8070. Like this:-
server {
listen 80;
server_name jenkins.mysite.com;
charset utf-8;
location / {
proxy_pass 127.0.0.1:8070;
}
}
And reloading the nginx configuration will get us our Jenkins showing nicely on the domain name you are pointing to with nginx’s server_name attribute (in my above example, it is ‘jenkins.mysite.com’.