What is it??
It is all about automating the entire process of taking the code that you implement from your system to the production
How do you do that??
Below are the things you need:
When any of the developer pushes the code to the github (branch: develop), jenkins (hello-dev job) will execute the pipeline defined in the JenkinsFile (available in your source code)
Note: hook missing in this example.
In this example, the pipeline is defined in such a way that the below mentioned steps get triggered
Note: hello-deployment project works charm in mac operation system with 16 GB RAM [Tested]
Make sure you merge the code from Github develop branch to qa branch and that should execute the pipeline defined in the JenkinsFile available in the qa enviroment. The steps are same to take it to the release environment as well.
Architecture
Environment Setup
Fork https://www.github.com/vmudigal/hello-deployment.git repository and then clone using "git clone -b develop git clone -b develop https://www.github.com/[YOUR_GIT_ID]/hello-deployment.git".
Go into "hello-deployment/DevVM/mac" and execute "./bootscript.sh"
Done and dusted!!
Technology stack
- Vagrant - tool for building and managing virtual machine environments in a single workflow.
- Virtualbox - virtualization product for enterprise
- Docker - Containerization platform
- Jenkins - open source automation server.
- Kubernetes - an open-source system for automating deployment, scaling, and management of containerized applications.
- Grafana - Data visualization & Monitoring
- InfluxDB - Open Source Time Series DB Platform for metrics and events (time series data).
- Github - a web-based Git or version control repository
- Springboot - Application framework
- Maven - build tool
- Java - programming language
Bintray Account
The docker images that are built during the automated build in Jenkins are stored in bintray as an artifacts.
- Sign up for a bintray account at https://bintray.com/signup/oss.
- Create an Organization
- Enter organization details and proceed.
- Create sandbox repository
- Enter sandbox repository details and proceed.
- Also create staging and release repositories.
- Now you have all the repositories needed.
- Select any repository and click on "Set ME UP".
Setting up your credentials
Setting up your credentials is only required when resolving from a private Docker repository. Use the Docker client login command to authenticate (please use Docker v1.6 and above):
docker login -u vijayendra -p <API_KEY> -e <EMAIL> mudigal-docker-hello-sanbox.bintray.io
Pulling Docker Images
Use the Docker client pull command to download an image (please use Docker v1.6 and above):
docker pull mudigal-docker-hello-sanbox.bintray.io/<NAMESPACE>/<PACKAGE_NAME>:<VERSION>
<NAMESPACE> - Optional. When not specified "library:" will be used as the prefix to the Bintray package name.
<VERSION> - Optional. When not specified "latest" will be used as the Bintray version name.
Pushing Docker Images
Tag your image according to the following convention by running the following command:
docker tag <IMAGE_ID> mudigal-docker-hello-sanbox.bintray.io/<NAMESPACE>/<PACKAGE_NAME>:<VERSION>
Use the Docker client push command to upload and publish your images (please use Docker v1.6 and above):
docker push mudigal-docker-hello-sanbox.bintray.io/<NAMESPACE>/<PACKAGE_NAME>:<VERSION>
<NAMESPACE> - Optional. When not specified "library:" will be used as the prefix to the Bintray package name.
<VERSION> - Optional. When not specified "latest" will be used as the Bintray version name.
- Note down API Key that you need to use to push artifacts.
Jenkins Setup
Jenkins is used as continous build, delivery and deployment server.
In you host system goto "http://localhost:8082" to access Jenkins and do the initial setup.
Kubernetes Dashboard
To access kubernetes dashboard, goto command prompt and execute "kubectl proxy". You can now access the dashboard at http://127.0.0.1:8001/ui
Access the deployed application at http://127.0.0.1:8001/api/v1/namespaces/development/services/hello:8040/proxy/
Grafana Dashboard
Access grafana dashboard at http://127.0.0.1:8001/api/v1/proxy/namespaces/kube-system/services/monitoring-grafana/
In case of any concerns, please feel free to drop me a message at vijayendrap@gmail.com