Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shnartho/go-jenkins-argocd
A website built with Go, server by nginx, backed by a Jenkins and ArgoCD-managed CI/CD pipeline.
https://github.com/shnartho/go-jenkins-argocd
argocd aws docker golang jenkins kubernetes nginx
Last synced: about 6 hours ago
JSON representation
A website built with Go, server by nginx, backed by a Jenkins and ArgoCD-managed CI/CD pipeline.
- Host: GitHub
- URL: https://github.com/shnartho/go-jenkins-argocd
- Owner: shnartho
- Created: 2023-10-01T23:19:05.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-10-08T08:00:22.000Z (about 1 year ago)
- Last Synced: 2023-10-09T00:23:14.419Z (about 1 year ago)
- Topics: argocd, aws, docker, golang, jenkins, kubernetes, nginx
- Language: Go
- Homepage:
- Size: 3.21 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## A website built with Go, server by nginx, backed by a Jenkins and ArgoCD-managed CI/CD pipeline.✌️
### 🔰 Overview
#### 🟢 The website is running in localhost. To update and push the changes in the server, I have Jenkins for CI and argoCD for CD.
![](./images/a.png)
#### 🟢 Here I prepared the Jenkins server for CI
![](./images/ec2.png)#### 🟢 As the CICD configured, updating code and pushing code to repo will trigger the webhook.
![](./images/codeb.png)
![](./images/webhook.png)#### 🟢 As soon as the code repo updated, jenkins job will start executing, pull repo, build docker image, push image to docker with new build number and also update the deployment.yaml file in deployment github repository which argoCD will use for kubernetes deployment.
![](./images/j11.png)
![](./images/j2.png)
![](./images/j3.png)
![](./images/j4.png)#### 🟢 Docker images pushed to dockerhub.
![](./images/dh1.png)
![](./images/dh2.png)#### 🟢 The deployment.yaml file in "go-jenkins-argocd-deployment" repository also got updated by jenkins.
![](./images/d1.png)
![](./images/d2.png)
![](./images/d3.png)
![](./images/jserver.png)#### 🟢 The application is deployed on argoCD namespace in kubernetes. This is the previous version 1.0.0 which is running.
![](./images/acd/app-service-port.png)
![](./images/acd/v1d.png)
![](./images/acd/v1acd.png)
![](./images/acd/v1.png)#### 🟢 As soon as deployment.yaml file got updated with new image tag 14, argoCD will sync, pull image from dockerhub and deploy new updated container based on the image build number 14.Therefore, version 3.1.2 is now being servered by argoCD and service file is doing the load balancing and inside each container nginx is doing reverse proxy.
![](./images/acd/v3d.png)
![](./images/acd/outofsync.png)
![](./images/acd/v3acd.png)
![](./images/acd/v3.png)
![](./images/acd/v3logs.png)
![](./images/acd/v3logss.png)#### 🟢 Therefore, we have achieved complete automated CI/CD software delivery.
### 🖥️ Servers Setup
1. EC2: To connect using aws ec2 instances, first check if "etc/ssh/sshd_config -> PasswordAuthentication yes", incase it is set to no then change it to yes otherwise using putty you cant connet to the ec2 instances.
2. Jenkins: Install java runtime environment. For Jenkins installing follow https://www.jenkins.io/doc/book/installing/linux/.
3. ArgoCD: For argocd installation follow🎯 In summary, Updating code and pushing it to git repository will trigger the webhook, jenkins will pull the updated code repo in the project workspace and execute necessary shell comands for port and running the website.
### 🖥️ Error Hanlidng
1. Css and static files were not being served. Solution: Make sure to get and set working directory is the executables directory and then use relative path in your code. (os.Chdir(exeDir), templates/index.html, static/styles.css etc)
2. Jenkins issues: sudo usermod -aG docker $username, for example "sudo usermod -aG docker jenkins" and "newgrp docker". And reboot the server. so jenkins will be able to access docker comands. Use t2.small, the t2.micro stuck in the dokcer build stage.