Environment_Infrastructure/setup/05-test-runner-ve-deploy-onkosullari.md
Murat ÖZDEMİR bf8f011e43 Restructure setup documentation and refine environment bootstrapping
This commit introduces a reordered and renumbered set of setup documentation files to better reflect the deployment stages for both test and production environments.

Key changes include:
*   A new `setup-vs-roadmap-map.md` file to provide a clear mapping between roadmap tasks and their corresponding setup phases.
*   Significantly expanded Ansible bootstrap documentation for both test and production, detailing Docker, Swarm, security hardening, and StorageBox SSH key management roles.
*   Formalized database Docker and Swarm cluster setup instructions for test and production, including explicit steps for Swarm worker integration of DB nodes.
*   Updated roadmap documentation (`roadmap/prod-env/*`) to align with the refined setup, incorporating correct private IP addresses for Swarm joins, new node labels, and floating IP usage for GoDaddy DNS records.
2026-05-11 17:47:30 +03:00

96 lines
2.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 05 - Test Runner ve Deploy Ön Koşulları
Bu aşamanın amacı test ortamında Gitea Actions runner'ı (`act_runner`) systemd servisi olarak kurmak ve CI/CD pipeline'larının çalışabileceği ortamı hazırlamaktır.
## Runner Yerleşimi
Test ortamında maliyet ve basitlik için tek runner kullanılır:
| Host | Servis Adı | Label |
| --- | --- | --- |
| `iklim-app-01` | `gitea-act-runner` | `test-runner`, `iklim-app-01`, `docker` |
## 1. Runner Kullanıcısı ve Yetkiler
Runner, host üzerinde Docker komutlarını çalıştırabilmelidir.
```bash
# Kullanıcıyı oluştur
sudo useradd -m -s /bin/bash gitea-runner
# Docker grubuna ekle
sudo usermod -aG docker gitea-runner
```
## 2. act_runner Kurulumu
### Binary İndirme
```bash
wget -O act_runner https://dl.gitea.com/act_runner/0.2.10/act_runner-0.2.10-linux-amd64
sudo mv act_runner /usr/local/bin/
sudo chmod +x /usr/local/bin/act_runner
```
### Kayıt (Registration)
Gitea arayüzünden (Organization -> Settings -> Actions -> Runners) bir **Registration Token** alın.
```bash
# Config dosyasını oluştur
act_runner generate-config > config.yaml
# Kayıt işlemini gerçekleştir
act_runner register --instance https://git.tarla.io --token <TOKEN> --no-interactive
```
*Not: Kayıt sırasında label olarak `test-runner,iklim-app-01,docker` girildiğinden emin olun.*
## 3. Systemd Servisi
`/etc/systemd/system/gitea-act-runner.service` dosyasını oluşturun:
```ini
[Unit]
Description=Gitea Actions runner
After=network.target docker.service
[Service]
ExecStart=/usr/local/bin/act_runner daemon --config /etc/gitea-act-runner/config.yaml
WorkingDirectory=/var/lib/gitea-runner
User=gitea-runner
Group=gitea-runner
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
```
Servisi başlatın:
```bash
sudo systemctl daemon-reload
sudo systemctl enable --now gitea-act-runner
```
## 4. Deploy Ön Koşulları
Pipeline'ın `iklim-app-01` üzerinde başarılı deploy yapabilmesi için şu araçların kurulu olması şarttır:
- `docker-ce` ve `docker-compose-plugin`
- `gettext` (`envsubst` komutu için)
- `jq`
- `git`
## 5. Gitea Organization Secrets
Pipeline'ların çalışması için Gitea Organization seviyesinde şu secret'lar tanımlanmalıdır:
| Secret | Açıklama |
| --- | --- |
| `STORAGEBOX_SSH_PRIV` | StorageBox'a erişim için private key |
| `HARBOR_USERNAME` | Container registry kullanıcı adı |
| `HARBOR_PASSWORD` | Container registry şifresi |
## Kabul Kriterleri
1. Gitea Runners sayfasında `iklim-app-01` statusü **Idle** (yeşil) görünür.
2. Bir test workflow'u (`runs-on: test-runner`) başarıyla tetiklenir.
3. Runner, host üzerindeki Docker daemon'a erişip konteyner oluşturabilir.
4. `8200/tcp` (Vault) portu public internete kapalıdır.