2025-05-08 07:17:50 +00:00
# Devops Makinası kurulumu
## VS Code -> Extensions kı smı nda "Docker" kurulmalı dı r.
## VS Code -> Extensions kı smı nda "Save as Root in Remote" kurulmalı dı r.
## VS Code üzerinden SSH parolası sabitleme (Firewall ve SSH)
- Windows Terminal üzerinde ssh_keygen komutu çalı ştı rı lı r.
- C:\Users\sedat.ozturk\.ssh klasörün altı nda id_rsa ve id_rsa.pub isimli 2 dosya oluşturur.
- C:\Users\sedat.ozturk\.ssh dosyası nı n içerisindeki id_rsa.pub dosyası nı n içeriğini ~/.ssh klasöründeki authorized_keys içeriğine kopyalanı r.
- Bu sayede VS Code üzerinden bağlanı rken her defası nda ssh paroları yazmak durumunda olmayı z.
## Docker kurulumu
- sudo apt update
- sudo apt install apt-transport-https ca-certificates curl software-properties-common
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
2025-05-08 10:59:06 +00:00
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
2025-05-08 07:17:50 +00:00
- sudo apt update
- apt-cache policy docker-ce
- sudo apt install docker-ce
- sudo systemctl status docker
- sudo usermod -aG docker ${USER}
- su - ${USER}
- sudo reboot
2025-05-08 10:59:06 +00:00
- sudo su
- cd /etc/docker
- touch daemon.json
daemon.json dosyası nı n içerisine aşağı daki satı rlar eklenecek.
{
"insecure-registries": ["devops.sozsoft.com"]
}
- sudo systemctl restart docker
- /etc/hosts dosyası açı lacak ve içerisine `127.0.1.1 devops.sozsoft.com` eklenecek
- docker login devops.sozsoft.com
2025-06-10 12:06:26 +00:00
## Wildcard için Sertifika alma
2025-05-08 07:17:50 +00:00
- sudo apt-get remove certbot
- sudo snap install --classic certbot
- sudo ln -s /snap/bin/certbot /usr/bin/certbot
- sudo certbot certonly --manual --preferred-challenges=dns --email system@sozsoft.com --agree-tos -d sozsoft.com -d *.sozsoft.com
- sudo su
- cd /etc/letsencrypt/archive
- chgrp docker -R sozsoft.com
- chown ${USER} -R sozsoft.com
- cd /etc/letsencrypt/archive/sozsoft.com
- cp -R /etc/letsencrypt/archive/sozsoft.com /home/sedat/sozsoft.com
- exit
- cd sozsoft.com/
- sudo chmod 775 *
2025-06-10 12:06:26 +00:00
## Subdomainler için Otomatik Sertifika alma
- /configs/deployment/scripts/7-setup_ssl.sh içerisinde subdomainlerin otomatik ssl sertifikası oluşturulmaktadı r.
2025-05-22 14:34:40 +00:00
## Git Kurulumu
- cd ~
- git config --global http.sslVerify false
- git clone https://github.com/iamsedatozturk/kurs-platform.git
- cd kurs-platform/
- git config core.fileMode false
- chmod 775 *
- cd configs/deployment
- chmod 775 *
- cd configs
- chmod 775 *
- cd ..
- cd scripts
- chmod 775 *
- cd ~/kurs-platform/configs/deployment/scripts/
- İçerisindeki ihtiyaç olan scriptler çalı ştı rı lı r.
- n8n çalı şmayı nca n8n containerı nı çalı ştı rı r ve hı zlı ca `docker run --rm -v kurs-devops_n8n_data:/data alpine chown -R 1000:1000 /data` kodu çalı ştı rı lacak.
## Nginx Kurulumu
- sudo apt update
- sudo apt install nginx -y
- sudo systemctl status nginx
- sudo rm /etc/nginx/sites-enabled/default
- sudo rm /etc/nginx/sites-enabled/nginx.conf
- sudo cp ~/kurs-platform/configs/deployment/configs/nginx.conf /etc/nginx/sites-available/
- sudo ln -s /etc/nginx/sites-available/nginx.conf /etc/nginx/sites-enabled/
- sudo cp -r ./sozsoft.com /etc/ssl/sozsoft.com
- sudo systemctl restart nginx
- sudo nginx -t
2025-05-08 10:59:06 +00:00
## Forgejo kurulumu ayarları yapı lacak
- home klasöründeki `cd ~/forgejo/data/gitea/conf` klasörün altı ndaki app.ini dosyası na aşağı daki satı rlar eklenecek.
[server]
APP_DATA_PATH = /data/gitea
DOMAIN = devops.sozsoft.com
SSH_DOMAIN = devops.sozsoft.com
DISABLE_SSH = false
SSH_PORT = 222
SSH_LISTEN_PORT = 22
LFS_START_SERVER = true
LFS_JWT_SECRET = CDy3ldC2cTbYHalO_dH68QJseoD7dGvH9x0Zx9aq2J0
OFFLINE_MODE = true
PROTOCOL=http
HTTP_PORT = 3000
ROOT_URL = https://devops.sozsoft.com/
CERT_FILE = /etc/ssl/cert1.pem
KEY_FILE = /etc/ssl/privkey1.pem
- https://devops.sozsoft.com
- sedat.ozturk isimli kullanı cı tanı mlanacak.
- "kurs" isimli new organization tanı mlanacak.
- "kurs-platform" isimli repository kurs organizasyonunun içerisine tanı mlanacak.
2025-05-23 08:53:46 +00:00
- Fork üzerinden https://devops.sozsoft.com/user/settings/applications kı smı na "sozsoft.com" ismiyle Access Token ekle. Eklenen token bilgisi Fork içerisinde kullanı lacak.
- Fork üzerinden Remotes tanı mlaması yapı lacak.
Remote: devops.sozsoft.com
RepositoryUrl: https://sedat.ozturk:1b48921c4cc6cd5c79e8ac121ede9f78afd1d9be@devops.sozsoft.com/kurs/kurs-platform.git
- https://devops.sozsoft.com/user/settings/applications sayfası nda OAuth2 kı smı nda "sozsoft.com" ismiyle Application Name eklenecek. Redirect URL kı smı nda https://devops.sozsoft.com eklenecektir.
2025-05-08 07:17:50 +00:00
## docker-compose-devops.yml kurulumu
2025-05-08 10:59:06 +00:00
Bu kurulumu yapmak için home klasörü altı na 3 tane dosyaya ihtiyaç duyuyor.
- Klasör yapı sı
cd ~/
mkdir kurs-platform
cd kurs-platform
mkdir configs
cd configs
mkdir deployment
cd deployment
mkdir configs
- Dosya yapı sı
2025-05-08 07:17:50 +00:00
-> kurs-platform->configs->deployment->configs->nginx-devops.conf
-> kurs-platform->configs->deployment->docker-compose-devops.yml
-> kurs-platform->configs->deployment->Dockerfile
2025-05-08 10:59:06 +00:00
cd ~/kurs-platform/configs/deployment
chmod 775 *
cd ~/kurs-platform
docker compose -f ./docker-compose-devops.yml up -d
docker compose -f ./docker-compose-devops.yml down
docker compose -f ./docker-compose-devops.yml up -d
2025-05-15 12:02:39 +00:00
## hosts yönlendirme
2025-05-22 14:34:40 +00:00
- 192.168.0.2 devops.sozsoft.com
- 192.168.0.2 chat.sozsoft.com
- 192.168.0.2 ai.sozsoft.com
- 192.168.0.2 sozsoft.com
- 192.168.0.2 demo.sozsoft.com
- 192.168.0.2 kurs.sozsoft.com
- 192.168.0.2 kurs-api.sozsoft.com
- 192.168.0.2 kurs-cdn.sozsoft.com
`ipconfig /flushdns`