Powered by Jenkins.
- Deploy with docker-compose
- Login to Jenkins
- Use build pipelines
You can:
- Easy Configuration
- Available Plugins
- Extensible
- Easy Distribution
- Free Open Source
Uses a number of open source projects to work properly:
- [jenkins] - open source continuous integration and continuous delivery, automation tool.
Open your favorite Terminal and run these commands.
First, if necessary:
$ mkdir ./cicd
Second:
$ git cicd
Third:
$ git clone [email protected]:molupini/jenkinsBuiler.git
Forth:
$ mkdir ./.jenkins_vol
$ mkdir ./.sock
Making any change in your source file will update immediately.
Before we begin, required environment variables:
$ vi ./.env/app.env
# # TERRAFORM
# SEE DOCKER FILE
# # JENKINS
TZ=Africa/Johannesburg
# # AWS
AWS_ACCESS_KEY=?
AWS_SECRET_KEY=?
AWS_REGION=?
# # PYTHON SCRIPTS, WEB SERVICES FOR IAC BUILDS
IAC_ENDPOINT_PROTOCOL=?
IAC_ENDPOINT_HOSTNAME=?
IAC_ENDPOINT_PORT=?
Easily done in a Docker container. Make required changes within Dockerfile + compose files if necessary. When ready, simply use docker-compose to build your environment. This will create the ocean-blue, ... services with necessary dependencies.
For dev, docker compose:
$ docker-compose build
$ docker-compose up
Verify the deployment by navigating to your address in your preferred browser. Enter the password in the requested location.
$ curl http://localhost:8080
$ docker-compose exec ocean-blue cat /var/jenkins_home/secrets/initialAdminPassword
For prod, build:
$ docker build -f blue.Dockerfile -t mauriziolupini/ocean-blue:prod .
Commit prod, push docker builds:
$ docker push mauriziolupini/ocean-blue:prod
Get prod, pull docker builds:
$ docker pull mauriziolupini/ocean-blue:prod
Run prod, either docker run:
docker network create --driver bridge jenkins_network
docker run -d -p 8080:8080 mauriziolupini/ocean-blue:prod
Run prod, or docker swarm:
docker stack deploy -c builder.yml IAC
See [KUBERNETES.md] coming soon.
- TBD.
If making use of a private [git] repository. await plug-in installation, container restart
[git] is a distributed version-control system for tracking changes in source code during software development. Pre-installed within ocean-blue, ... will require ssh authentication. Follow, https://docs.gitlab.com/ee/ssh/; https://gitlab.com/help/ssh/README#generating-a-new-ssh-key-pair Note, similar with GitHub Used majority of pipeline(s).
Two options 1. New ssh key must add to git repository, within container See example below, preferred
# ACCEPT DEFAULT FILE PATH
# jenkins container will login with the same user.
$ docker exec -it ocean-blue_1 bash
# ED25519 SSH KEYS ARE PREFERRED AND BEST PRACTICE.
$ ssh-keygen -t ed25519 -C "[email protected]"
# RSA WHICH ONLY RECOMMENDED IF ISSUES WITH ABOVE.
# $ ssh-keygen -o -t rsa -b 4096 -C "[email protected]"
# ADD BELOW OUTPUT TO YOUR GIT REPO
$ cat /var/jenkins_home/.ssh/id_rsa.pub
# VERIFY SSH CONNECTIVITY
$ ssh -T [email protected]
Existing ssh key must add to git repository, copy to container Follow, https://gitlab.com/help/ssh/README#generating-a-new-ssh-key-pair See example below
$ docker cp ./.key/. ocean-blue_1:/var/jenkins_home/.ssh/.
Assign permissions, Using chown command to change the user/group ownership of the jenkins_home directory. If not followed you can expect to get the following Error, java.nio.file.AccessDeniedException: /var/jenkins_home/workspace/item-name with your pipelines
$ docker exec -u root ocean-blue_1 chown -R jenkins:jenkins /var/jenkins_home
MIT
Want to contribute? Great! See repo git-repo-url from Maurizio Lupini -Author, Working at ...
[jenkins]: <https://jenkins.io/ [terraform]: https://www.terraform.io/ [git]: https://git-scm.com/