Full-Devops-Project_Infrastructure

所属分类:Docker
开发工具:HCL
文件大小:0KB
下载次数:0
上传日期:2023-08-14 19:21:35
上 传 者sh-1993
说明:  一个完整的devops项目,在完整的gitflow中部署我的Asp.net核心web应用程序(新闻应用程序)和mysql数据库,包括5个分支(测试、开发、预加载、发布)和作为基本代码的主分支。
(A full devops project to deploy my Asp.net core web app (news app) with mysql database in a full gitflow including 5 branches (test, dev, preprod, release) and the main branch to be the base code.)

文件列表:
Jenkins-Helm-Yaml-Files-With-Ansible/ (0, 2023-08-18)
Jenkins-Helm-Yaml-Files-With-Ansible/.vscode/ (0, 2023-08-18)
Jenkins-Helm-Yaml-Files-With-Ansible/.vscode/settings.json (56, 2023-08-18)
Jenkins-Helm-Yaml-Files-With-Ansible/Chart.yaml (193, 2023-08-18)
Jenkins-Helm-Yaml-Files-With-Ansible/ansible-helm-jenkins.yaml (185, 2023-08-18)
Jenkins-Helm-Yaml-Files-With-Ansible/templates/ (0, 2023-08-18)
Jenkins-Helm-Yaml-Files-With-Ansible/templates/master-deployment.yaml (1451, 2023-08-18)
Jenkins-Helm-Yaml-Files-With-Ansible/templates/master-service.yaml (352, 2023-08-18)
Jenkins-Helm-Yaml-Files-With-Ansible/templates/namespace.yaml (76, 2023-08-18)
Jenkins-Helm-Yaml-Files-With-Ansible/templates/serviceAccount.yaml (559, 2023-08-18)
Jenkins-Helm-Yaml-Files-With-Ansible/templates/slave-deployment.yaml (924, 2023-08-18)
Jenkins-Helm-Yaml-Files-With-Ansible/templates/slave.svc.yaml (214, 2023-08-18)
Jenkins-Helm-Yaml-Files-With-Ansible/templates/volume.yaml (509, 2023-08-18)
Jenkins-Helm-Yaml-Files-With-Ansible/values.yaml (18, 2023-08-18)
Salve-Pod-Dockerfile (2296, 2023-08-18)
Screenshots/ (0, 2023-08-18)
Screenshots/1.png (98631, 2023-08-18)
Screenshots/10.1.png (106646, 2023-08-18)
Screenshots/10.2.png (17578, 2023-08-18)
Screenshots/10.3.png (271102, 2023-08-18)
Screenshots/11.png (36509, 2023-08-18)
Screenshots/12.png (62931, 2023-08-18)
Screenshots/13.png (50813, 2023-08-18)
Screenshots/15.png (54020, 2023-08-18)
Screenshots/16.png (59829, 2023-08-18)
Screenshots/18.png (120505, 2023-08-18)
Screenshots/19.png (104976, 2023-08-18)
Screenshots/2.png (102032, 2023-08-18)
Screenshots/20.1.png (48777, 2023-08-18)
Screenshots/20.2.png (42017, 2023-08-18)
Screenshots/20.3.png (13905, 2023-08-18)
Screenshots/21.png (37463, 2023-08-18)
Screenshots/22.1.png (78059, 2023-08-18)
Screenshots/22.2.png (161489, 2023-08-18)
Screenshots/22.3.png (199107, 2023-08-18)
Screenshots/22.4.png (105629, 2023-08-18)
Screenshots/23.png (72782, 2023-08-18)
Screenshots/24.png (108021, 2023-08-18)
... ...

A full devops project to deploy my Asp.net core web app (news app) with mysql database in a full gitflow including 5 branches (test, dev, preprod, release) and the main branch to contain the base code. Using these technologies and tools: - `GCP (Google Cloud Platform)` - `Dotnet core 7` - `Mysql` - `Terraform` - `Ansible` - `Helm` - `Jenkins` - `Docker` - `Kubernates` - `Github` ## You can find all the detailed steps on the readme files on the following repos ## Infrastructure: https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure ## Dotnet App: https://github.com/mohamedsamirspot/Full-Devops-Project_Dotnetcoreapp # Full-Devops-Project_Infrastructure: in this infrastructure we are going to prepair the gcp infra using terraform for our kubernates cluster to deploy our jenkins and our app to it. ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/Draw.io.jpg) https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/assets/71722372/8ae2b7a6-e9e5-4de7-ad06-e16acdfdb530 ## GCP Infrastructure includes: - 1 VPC - Backend for saving the tfstate file of terraform - 2 subnets (management subnet & restricted subnet): - NAT gateway over the restricted subnet - Management subnet has the following: - Public VM - Restricted subnet has the following: - private standard GKE cluster (private control plane and private worker nodes) Firstly creating the required service account for our terraform ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/1.png) ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/2.png) ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/3.png) ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/4.png) ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/5.png) ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/6.png) ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/7.png) - Creating my key to access the public vm (bastian host) using ssh for ansible ssh-keygen -t ed25519 -C -f /Terraform-folderpath/full-devops-proj-bastian-host-key/ ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/10.1.png) now copy the contents of the public key ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/11.png) ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/12.png) - Now put the public key content in the public vm creation key part ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/13.png) - Now run the script.sh bash file to create the infra using terraform (including the bucket backend to store the state file) and configure the bastian host also using ansible and deploying the jenkins infra using ansible and helm ./script.sh ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/16.png) in case of you saw this error ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/10.3.png) empty this file (known_hosts) ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/10.2.png) ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/8.2.png) - Now remove your local terraform.tfstate and terraform.tfstate.backup files you don't need them - Build and push the jenkins slave dockerfile with all the required tools installed on it --> [Salve-Pod-Dockerfile](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Salve-Pod-Dockerfile) ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/15.png) docker build --build-arg JENKINS_PASSWORD= -t mohamedsamirebrahim/enhanced-slave-image:latest -f Salve-Pod-Dockerfile . docker push mohamedsamirebrahim/enhanced-slave-image:latest - Now ssh to this public vm to get the public ip of the jenkins service load balancer kubectl get all -n jenkins ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/18.png) - And now at this point we have our infrastructure up and running with jenkins and its slaves as deployment on our GKE cluster - Now access master jenkins pod using the service loadbalancer ip ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/19.png) ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/20.1.png) kubectl exec -it jenkins-master-pod-name -n jenkins -- bash cat /var/jenkins_home/secrets/initialAdminPassword or just get it from logs kubectl logs jenkins-master-dep-6c68d86f64-qqvq2 -n jenkins ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/20.2.png) ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/20.3.png) ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/21.png) - preparing the branches of your app including the jenkins file, docker file and the helm chart to deploy the app ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/22.1.png) ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/22.2.png) ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/22.3.png) ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/22.4.png) - Go to security and enable proxy compatibility ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/23.png) - Now go to credentials and create username and password credential for the slave jenkins user that we created before in the dockerfile of the slave ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/24.png) ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/25.png) ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/26.png) ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/27.png) - Now set up the jenkins agent (slave) ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/28.png) ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/29.png) ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/30.png) ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/31.png) ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/32.png) ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/33.png) ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/34.png) ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/35.png) - Create dockerhub credential ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/36.png) ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/37.png) - Get the kubeconfig from any of the connectors to the api-server (node or pod that runs this before gcloud container clusters get-credentials --zone --project ) cat ~/.kube/config ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/38.png) - now create a kubeconfig file with this content ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/39.png) - then create a secretfile credential to use this kubeconfig file content on Jenkinsfile as the service account is working inside the pod w can create anything but it doesn't work inside the jenkins file so it is useless in our project it require a plugin ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/40.png) ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/41.png) - create the database credential for mysql of type secret text (Note: must be in base 64 format) - which will be passed in the jenkinsfile helm command as a value variable to be passed to the creation of the db-secret yaml file in the cluster, then to be passed to the app, database deployments containers - in my case i will create 4 secrets one in each namespace and use it through the current env ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/42.png) create multibranch pipeline ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/43.png) ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/44.png) ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/45.png) ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/46.png) ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/47.png) ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/48.png) ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/49.png) ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/50.png) ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/51.png) ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/52.1.png) ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/52.2.png) ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/52.png) ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/53.png) ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/54.png) ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/55.png) ![Image Description](https://github.com/mohamedsamirspot/Full-Devops-Project_Infrastructure/blob/master/Screenshots/56.png)

近期下载者

相关文件


收藏者