Skip to content

Commit 3dcf0ee

Browse files
committed
feat(install): add jenkins and gitlab installation
1 parent 95e8dda commit 3dcf0ee

File tree

17 files changed

+287
-20
lines changed

17 files changed

+287
-20
lines changed

app/main.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@
33
from app.routes.helm import *
44
from app.routes.ansible import *
55
from app.routes.jcasc import *
6-
from app.routes.docker import *
6+
from app.routes.docker import *
7+
from app.routes.jenkins import *
8+
from app.routes.gitlab import *
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# sudo mkdir -p /srv/gitlab
2+
# export GITLAB_HOME=/srv/gitlab
3+
4+
version: '3.6'
5+
services:
6+
gitlab:
7+
image: gitlab/gitlab-ee:<version>-ee.0
8+
container_name: gitlab
9+
restart: always
10+
hostname: 'gitlab.example.com'
11+
environment:
12+
GITLAB_OMNIBUS_CONFIG: |
13+
# Add any other gitlab.rb configuration here, each on its own line
14+
external_url 'https://gitlab.example.com'
15+
16+
# you can also use custom HTTP and SSH port. if you you want to do that, follow the below syntax
17+
18+
# external_url 'http://gitlab.example.com:8929'
19+
# gitlab_rails['gitlab_shell_ssh_port'] = 2424
20+
21+
ports:
22+
# - '8929:8929' # Custom HTTP Port
23+
# - '2424:22' # Custom SSH Port
24+
- '80:80'
25+
- '443:443'
26+
- '22:22'
27+
volumes:
28+
- '$GITLAB_HOME/config:/etc/gitlab'
29+
- '$GITLAB_HOME/logs:/var/log/gitlab'
30+
- '$GITLAB_HOME/data:/var/opt/gitlab'
31+
shm_size: '256m'
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
sudo wget -O /etc/yum.repos.d/jenkins.repo \
2+
https://pkg.jenkins.io/redhat-stable/jenkins.repo
3+
sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io-2023.key
4+
sudo yum upgrade -y
5+
# Add required dependencies for the jenkins package
6+
sudo yum install -y fontconfig java-17-openjdk
7+
sudo yum install -y jenkins
8+
sudo systemctl daemon-reload
9+
sudo systemctl enable --now jenkins
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
version: '3.8'
2+
services:
3+
jenkins:
4+
image: jenkins/jenkins:lts
5+
privileged: true
6+
user: root
7+
ports:
8+
- 8080:8080
9+
- 50000:50000
10+
container_name: jenkins
11+
volumes:
12+
- /home/${myname}/jenkins_compose/jenkins_configuration:/var/jenkins_home
13+
- /var/run/docker.sock:/var/run/docker.sock
14+
15+
# Replace "/home/${myname}/jenkins_compose/jenkins_configuration" with the path you want to use to store your jenkins data
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
sudo wget -O /etc/yum.repos.d/jenkins.repo \
2+
https://pkg.jenkins.io/redhat-stable/jenkins.repo
3+
sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io-2023.key
4+
sudo dnf upgrade -y
5+
# Add required dependencies for the jenkins package
6+
sudo dnf install -y fontconfig java-17-openjdk
7+
sudo dnf install -y jenkins
8+
sudo systemctl daemon-reload
9+
sudo systemctl enable --now jenkins
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
sudo apt update -y
2+
sudo apt install -y fontconfig openjdk-17-jre
3+
4+
5+
sudo wget -O /usr/share/keyrings/jenkins-keyring.asc \
6+
https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key
7+
echo "deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc]" \
8+
https://pkg.jenkins.io/debian-stable binary/ | sudo tee \
9+
/etc/apt/sources.list.d/jenkins.list > /dev/null
10+
sudo apt-get update -y
11+
sudo apt-get install -y jenkins
12+
sudo systemctl enable --now jenkins

app/media/MyBash/bash.sh

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
1-
#!/bin/bash
2-
sudo apt-get update -y
3-
sudo apt-get install ca-certificates curl -y
4-
sudo install -m 0755 -d /etc/apt/keyrings
5-
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
6-
sudo chmod a+r /etc/apt/keyrings/docker.asc
7-
8-
# Add the repository to Apt sources:
9-
echo \
10-
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
11-
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
12-
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
13-
sudo apt-get update -y
1+
sudo apt update -y
2+
sudo apt install -y fontconfig openjdk-17-jre
143

154

16-
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
5+
sudo wget -O /usr/share/keyrings/jenkins-keyring.asc \
6+
https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key
7+
echo "deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc]" \
8+
https://pkg.jenkins.io/debian-stable binary/ | sudo tee \
9+
/etc/apt/sources.list.d/jenkins.list > /dev/null
10+
sudo apt-get update -y
11+
sudo apt-get install -y jenkins
12+
sudo systemctl enable --now jenkins
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# sudo mkdir -p /srv/gitlab
2+
# export GITLAB_HOME=/srv/gitlab
3+
4+
version: '3.6'
5+
services:
6+
gitlab:
7+
image: gitlab/gitlab-ee:<version>-ee.0
8+
container_name: gitlab
9+
restart: always
10+
hostname: 'gitlab.example.com'
11+
environment:
12+
GITLAB_OMNIBUS_CONFIG: |
13+
# Add any other gitlab.rb configuration here, each on its own line
14+
external_url 'https://gitlab.example.com'
15+
16+
# you can also use custom HTTP and SSH port. if you you want to do that, follow the below syntax
17+
18+
# external_url 'http://gitlab.example.com:8929'
19+
# gitlab_rails['gitlab_shell_ssh_port'] = 2424
20+
21+
ports:
22+
# - '8929:8929' # Custom HTTP Port
23+
# - '2424:22' # Custom SSH Port
24+
- '80:80'
25+
- '443:443'
26+
- '22:22'
27+
volumes:
28+
- '$GITLAB_HOME/config:/etc/gitlab'
29+
- '$GITLAB_HOME/logs:/var/log/gitlab'
30+
- '$GITLAB_HOME/data:/var/opt/gitlab'
31+
shm_size: '256m'

app/models/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,6 @@
44
from .ansible_models import *
55
from .jcasc import *
66
from .compose_models import *
7-
from .docker_installation_models import *
7+
from .docker_installation_models import *
8+
from .jenkins import *
9+
from .gitlab_models import *

app/models/gitlab_models.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from typing import List, Optional
2+
from pydantic import BaseModel, validator, ValidationError
3+
4+
5+
6+
class GitLabInstallation(BaseModel):
7+
8+
9+
environment:str = 'Docker'
10+
11+
12+
@validator("environment")
13+
def validator_environment(cls, value):
14+
env = ['Docker']
15+
if value not in env:
16+
raise ValueError(f"your selected Environemnt must be in {env}")
17+
return value

0 commit comments

Comments
 (0)