This docker-compose config was used for the demonstration portion of the presentation at https://www.slideshare.net/EricSmalling1/docker-based-jenkins-build-agents-78280169
The Jenkins server and executor agent configured below is for quick setup and demonstration purposes only. It is not secure in any way and it is in no way intended that these setup instructions be used in your environments.
If using a Docker swarm:
- Run
docker stack deploy ci -c swarm.yml
- Run
docker service logs ci_jenkins
and copy the Jenkins admin token for the next step.
If using docker-compose (non-swarm):
- Run
docker-compose up
and watch for the Jenkins admin token, copy it for next step.
This is to show the audience that this is a stock install (If short on time, you can set this up in advance and begin demo at Build demos below)
- Point your browser at http://localhost , wait for Jenkins to ask for the admin token and paste in what you copied above.
- Choose standard set of plugins
- Skip admin user setup, and click "Start using Jenkins"
- Go to http://localhost/computer/(master)/configure and change Usage to "Only build jobs with label...", click Save.
- Go to http://localhost/configureSecurity/ and set "Access Control->Authorization" to "Anyone can do anything", click Save.
- Go to http://localhost/pluginManager/available and select "Self-Organizing Swarm Plug-in Modules", click one of the "Install" options.
## Build demos The intent is to create a few projects, all using Pipeline from Jenkinsfile files inside their repositories. Feel free to use your own or the following 3 examples.
- Click "Create New Jobs"
- Give it a name, choose "Pipeline", click "OK"
- Choose Pipeline->Definition: "Pipeline script from SCM"
- SCM: Git
- Repository URL: https://github.com/ericsmalling/mvn-web-sample.git
- Click "Save"
- Click "Build Now"
- Click "Create New Jobs"
- Give it a name, choose "Pipeline", click "OK"
- Choose Pipeline->Definition: "Pipeline script from SCM"
- SCM: Git
- Repository URL: https://github.com/ericsmalling/clarity.git
- Click "Save"
- Click "Build Now"
- Click "Create New Jobs"
- Give it a name, choose "Pipeline", click "OK"
- Choose Pipeline->Definition: "Pipeline script from SCM"
- SCM: Git
- Repository URL: https://github.com/cloudbeers/multibranch-demo.git
- Click "Save"
- Click "Build Now"
If you feel the need, you can add additional executor-nodes via the following (replace the '3' below with the count you want):
- Swarm:
docker service scale ci_executor-node=3
- Non-Swarm:
docker-compose scale executor-node=3
When done, shut down the stack and optionally free up disk space:
- Swarm:
- run
docker stack rm ci
- run
- Non-Swarm:
- run
docker-compose stop;
(or just hit CTRL-C in the shell where you randocker-compose up
) - run
docker-compose rm
- run
- Run
rm -rf jenkins_home/* workspace/*
to remove the Jenkins server's home directory and executor workspaces.