Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/letran3691/cicdwithargicdgitlabregistry
https://github.com/letran3691/cicdwithargicdgitlabregistry
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/letran3691/cicdwithargicdgitlabregistry
- Owner: letran3691
- Created: 2024-03-15T07:42:38.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-04-01T11:14:47.000Z (9 months ago)
- Last Synced: 2024-04-02T04:25:34.986Z (9 months ago)
- Size: 29.2 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
### install gitlab on redhat9
dnf -y install curl vim policycoreutils python3-policycoreutils git
cat > /etc/yum.repos.d/gitlab_gitlab-ce.repo >> END
[gitlab_gitlab-ce]
name=gitlab_gitlab-ce
baseurl=https://packages.gitlab.com/gitlab/gitlab-ce/el/8/$basearch
repo_gpgcheck=1
gpgcheck=1
enabled=1
gpgkey=https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey
https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey/gitlab-gitlab-ce-3D645A26AB9FBD22.pub.gpg
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
[gitlab_gitlab-ce-source]
name=gitlab_gitlab-ce-source
baseurl=https://packages.gitlab.com/gitlab/gitlab-ce/el/8/SRPMS
repo_gpgcheck=1
gpgcheck=1
enabled=1
gpgkey=https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey
https://packages.gitlab.com/gitlab/gitlab-ce/gpgkey/gitlab-gitlab-ce-3D645A26AB9FBD22.pub.gpg
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
END
dnf install gitlab-ce -y
![](images/2024-03-15_10h53_47.png)#### config gitlab and registry
vim /etc/gitlab/gitlab.rbchange external_url 'https://gitlab.example.com' to your domain
change registry_external_url 'https://registry.example.com' to your domain
change letsencrypt['enable'] = nill to letsencrypt['enable'] = false
#### config ssl for gitlab and registry
copy your domains cert to /etc/gitlab/ssl
![img.png](images/img.png)Note: set certs name them same your domain
cd /etc/gitlab/ssl; chmod 400 *.key
cd /etc/gitlab/ssl; chmod 644 *.crt
gitlab-ctl reconfigure
#### check status gitgitlab-ctl status
#### get root password gitla
cat /etc/gitlab/initial_root_password
#### login to gitlab with domain your setup
![img.png](images/img1.png)
#### install gitlab-runner and docker on server gitlab
curl -LJO "https://s3.dualstack.us-east-1.amazonaws.com/gitlab-runner-downloads/latest/rpm/gitlab-runner_amd64-fips.rpm"
rpm -ivh gitlab-runner_amd64-fips.rpmsystemctl enable --now gitlab-runner.service
yum install -y yum-utils
yum-config-manager --add-repo https://download.docker.com/linux/rhel/docker-ce.repo
yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
systemctl enable --now docker### docker login
docker login -u user -p passwd registry.mbageas.life/code-repo#### Install docker on all cluster nodes
yum install -y yum-utils
yum-config-manager --add-repo https://download.docker.com/linux/rhel/docker-ce.repo
yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
systemctl enable --now docker#### Test docker login all cluster nodes
docker login -u user -p passwd registry.mbageas.life/code-repo
#### deploy Argocd
kubectl create ns argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yamlnote: change argocd server to mode NodePort
kubectl edit service/argocd-server -n argocd
![img_1.png](manifest-repo-main/img_1.png)#### get argocd admin password
kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d
#### login argocd with user/passs
![img_1.png](images/img_2.png)
#### config ssh to gitlab repo
on gitlab server ssh-key
ssh-keygen -t rsa![](images/2024-03-15_12h51_31.gif)
#### create gitlab repo contain gitlab-ci and dockerfile
![img_1.png](images/img_1.png)
allow push
![img_3.png](images/img_3.png)
#### create gitlab repo contain helm chart to deploy k8s
Create a Variables
![](images/2024-03-15_13h34_43.gif)#### create secret for docker registry
kubectl create secret docker-registry regcred-loginapp --docker-server=registry.mbageas.life --docker-username=k8s --docker-password=gldt-ZhQzbMVN1pgdUMCySfdL -n default
Note: in repo helm chart have secret file, maybe edit it
#### connect argocd to gitlab repo helm chart
![](images/2024-03-15_14h11_18.gif)
#### Argocd create application
![](images/2024-03-15_14h30_26.gif)
Note summary
change:
APP_NAME
IMAGE_TAG
git clone
cd
sed -i
git addAdd private key to code-repo