Before we start to write any line of code, we should make sure, that out buildsystem is running and the CI process in our new project is automatted.
The CI pipline only is complete, when you deploy your project directly to your test , stage and liveservern.
One possibility is, to register your webserver as a slave on your buildserver.
In our case we are using jenkins as a master build server and a ubuntu webserver as a slave.
If everythings is correct, you will see yout slavenode on the jenkinsdashboard.
Our slave is called "docker_gitlab_webserver_1" our Jenkins server listens to "dockergitlab_jenkins_1" on port 8080
So let'shave a look on the configuration
Configure your new node
Create that folder a on the slave machine nd make it accessable for the master.
This configuration will use Java Webstart with Jnpl. This will do the trick on communication between slave and master.
After you save the configuration you will get a downloadlink for your "slave.jar" and a command, which you can execute on your slave
Execute on your slave
java -jar slave.jar -jnlpUrl http://dockergitlab_jenkins_1:8080/computer/dockergitlab_webserver_1/slave-agent.jnlp
This has to be executed in "/var/lib/jenkins"
Make sure you have java 7 installed
After that you can see your slave running "connected" on your jenkins master.
Great !
Install this startupscript as a serviceTo make that rebootsafe you have to create a service and add it to the ubuntu runlevels S and 2, 3 and 6
Create a file "/etc/init.d/jenkins-slave"
sudo chmod 755 /etc/init.d/jenkins-slave sudo chown root:root /etc/init.d/
jenkins-slave
sudo update-rc.d jenkins-slave defaults
Add it to Autostart
sudo ln -s /usr/lib/insserv/insserv /sbin/jenkins-slave
sudo insserv
jenkins-slave
This will set correct accessrights to your service Make sure, you have replaced the parameters with your data.
Keine Kommentare:
Kommentar veröffentlichen