The modern era has advanced a lot. It is all because of the newest forms of infrastructure that has developed and introduced in the IT sector. These innovations is done for good and that is indeed making a great change in different business areas. Well, with this said, today in this blog we will be assisting you step-by-step with the method and flow as to how to configure Hybrid Jenkins in PHP application.
Nowadays each one of us are aware about the fact that majority of the server are getting migrated over AWS i.e. Amazon Web Services. We at Cloud-Stack Group is expert provider of AWS services that serves its clients across the globe. With the experience for over years we understand the need and importance of the service and thus it is necessary to assist our clients in each and every stages. Well, with this said let us check on the process and steps as to how to configure Hybrid Jenkins in PHP applications.
Setup the server
The very first thing that needs to be done is to create a new Ubuntu server. Usually it is like we can ise a 512mb box but if it is like that you are using Jenkins for multiple production project, then the team at Cloud Stack Group indeed recommend to use a server that is at least having a RAM of 2GB that assist to keep your builds speedy.
Once the server has powered up then SSH in. We’re going to need a few tools installed:
Now proceeding further, it is that Jenkins run on default port of 8080. Thus here we are going to set up an Nginx proxy which listens on port 80 and proxies to Jenkins. We’ll also point a subdomain at it.
With my DNS provider I setup an DNS A record for jenkins.alexbilbie.com pointing at the IP address of my server
The next is to update the command with the following set up.
Command: /etc/nginx/sites-enabled/default with the following set up.
server {
listen 80;
server_name jenkins.alexbilbie.com;
location / {
proxy_pass http://localhost:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_connect_timeout 150;
proxy_send_timeout 100;
proxy_read_timeout 100;
proxy_buffers 4 32k;
client_max_body_size 8m;
client_body_buffer_size 128k;
}
}
Now to bounce Nginx service nginx restart and start Jenkins service jenkins start.
Once this step is taken into consideration, the next what needs to be done is to open up the Jenkins in the browser. Some what of below mentioned command would be coming up,

Security
The first thing that needs to be done is to secure Jenkins. Well in this it is like if you are working with and in a team by far the best and easiest way is to use Github so as to secure your Jenkins using OAuth.
There is a need to install few plugins so as to enable Github security up this is with regards to the set up on the left hand side click on Manage Jenkins then Manage Plugins.
Click on the Available tab then select the following plugins (you can use the search field to narrow down the list):
- Github OAuth Plugin
- Github Plugin
Click Download now and install after restart. Jenkins will now download the plugins and restart itself.
Whilst Jenkins is doing that head over to Github, go to Settings then Applications. Click Register new application.

We can use some of the following settings as mentioned below.
- Application name: jenkins.alexbilbie.com
- Homepage URL: http://jenkins.alexbilbie.com
- Authorization callback URL: http://jenkins.alexbilbie.com:8080/securityRealm/finishLogin
Finally click Register application.
Back in Jenkins click on Manage Jenkins then Configure Global Security. Check the Enable security checkbox.
Under Security Realm click on Github Authentication Plugin.
I used the following settings:
- GitHub Web URI: https://github.com
- GitHub API URI: https://api.github.com
- Client ID: (the client ID that Github gave you for your application)
- Client Secret: (the client secret that Github gave you for your application)
Under Authorization choose Github Commiter Authorization Strategy.
Update the following:
- Admin User Names: (your Github username)
- Enable Grant READ permissions for /github-webhook (so that Github can ping your Jenkins install)
- Click Save. You’ll now be sent to Github to sign-in:

Install Composer
We need to install Composer so whilst SSH-d into the server run the following (as root):
su jenkins
mkdir ~/bin
cd ~/bin
curl -sS https://getcomposer.org/installer | php
mv composer.phar composer
By installing Composer as the jenkins user we can keep it updated easily with Jenkins itself.
Create an SSH key for Jenkins
Jenkins needs an SSH key in order to make sure and commit back to Github (if that’s what you want). The options available are two, either create a new Github user or add a deploy key to the repository.
As the Jenkins user run the following – ssh-keygen -t rsa -C “jenkins”. We opt to not create a password for the key.
Next is to copy the public key and that is (~/.ssh/id_rsa.pub)to your clipboard and add it as a deploy key in your Github repository:

Next let Jenkins know about the private key. Click on Credentials then Global credentials (unrestricted) then Add Credentials.
Choose SSH Username with private key, add a username (I used jenkins) and add the private key (~/.ssh/id_rsa). Click OK.
Next steps
Now that you’ve got a successful build you can make use of some Jenkins plugins to make Jenkins more useful.
- To visualise PHP Unit code coverage then the Clover PHP will ingest a xml file created by PHPUnit and create a graph on the job home page. You can also use it to ensure a minimum amount of coverage or the project will be marked as unstable or even fail the build.
- There are other plugins that will be taken into consideration to create graphs and logs. This will be in the form and from PHPUnit and other QA tools include:
- Checkstyle (for processing PHP_CodeSniffer logfiles in Checkstyle format)
- Crap4J (for processing PHPUnit’s Crap4J XML logfile)
- DRY (for processing phpcpd logfiles in PMD-CPD format)
- JDepend (for processing PHP_Depend logfiles in JDepend format)
- Plot (for processing phploc CSV output)
- PMD (for processing PHPMD logfiles in PMD format)
- xUnit (for processing PHPUnit’s JUnit XML logfile)
- The HTML Publisher allows you to keep HTML reports generated by your tests and link to them from a job page.
- The AnsiColor plugin adds support for ANSI escape sequences, including color, to the build output.
- You can report build statuses back to Hipchat, Slack and IRC with respective plugins.
- This plugin allows you to run tasks like shell scripts after builds finish – I use it to stop Docker containers that I’ve used in my builds.
- The S3 publisher plugin will create an archive from a successful build and push it to Jenkins (which you could then automatically pull on to you servers to deploy new code).
- One of my favourite plugins is the Big Monitor plugin which I have running on a TV.
Jenkins can execute shell scripts as part of build jobs so that it can be used to perform pretty much of other tasks and also any tasks as per the clients need and requirements.This is from starting Docker containers, keeping Composer up to date , API testing, or just about anything else that you manually do on the command line.
There are plugins to automatically build pull requests and with this it can be easy to have the set up upstream and downstream jobs that are run before and after other jobs.
We and our team of engineers at cloud stack use this exclusive and extensive method so that when there is need to get this details pushed the same can be done and the process of the development of branch of one of the projects can be taken into consideration and can tests run which when they pass automatically merge develop into master.
Then we have another job which is to listen to master which then has other tests run and packages up the code into an archive on S3 on success. The final job here is to get it triggered to run that on an Ansible task to deploy the code on S3 onto all my servers.
One word of advice, once you’ve got a working Jenkins setup try to keep it that way; I’ve been burnt numerous times by plugin updates that have broken or significantly slowed down my builds. If that happens you can easily downgrade a plugin inside the plugin manager.
Hopefully you’ve learnt from this tutorial just how easy it is to get setup and running with Jenkins and I’m sure like me in time you’ll find it to be an invaluable part of your development stack.
Over to You:
On reading and understanding this blog, it is quite sensible to understand the basic of the service and thus for the same to get this installed in your organization, the best is you can outsource your work. The core reason to get the work outsourced is because you will get the team who is well experienced and understands the current market trend along with all the technical aspects that play a vital role.
The inhouse team at Cloud Stack Group is always at its service for the clients to serve them in the best possible way. To have an clear as well as deep understanding you can connect with us over phone or via email and within 24 business hours our team will be replying to you with all the necessary details and procedure.
Having said this we, assure our clients that their work is handed over to the right team of experienced and skilled engineers who are available for you 24*7 and all 365 days a week. Not only this we have our expertise in providing services like AWS Cost Optimization, DevOps Services, Cloud Latency, AWS Cloud management, Cloud Migration Strategy, and a lot many other cloud based services.