docs: native Ubuntu install as primary; systemd and nginx
- install-ubuntu-24.04-native.md (production) and -docker.md (alternative) - deploy/systemd/sac-api.service, nginx/sac.conf.example, env.native.example - deployment, README, INDEX, work-plan, TZ updated
This commit is contained in:
@@ -0,0 +1,105 @@
|
||||
# Ubuntu 24.04 — установка SAC (Docker Compose)
|
||||
|
||||
**Альтернативный** способ. В KalinaMall для production используется **[native](install-ubuntu-24.04-native.md)**.
|
||||
|
||||
Docker удобен для локальной отладки или изолированного стенда.
|
||||
|
||||
---
|
||||
|
||||
## 0. Исходные данные
|
||||
|
||||
| Параметр | Пример |
|
||||
|----------|--------|
|
||||
| Каталог | `/opt/security-alert-center` |
|
||||
|
||||
---
|
||||
|
||||
## 1. Базовая ОС и ufw
|
||||
|
||||
Как в [native-руководстве](install-ubuntu-24.04-native.md) §1 (без PostgreSQL/nginx на хосте, если всё в контейнерах — nginx можно на хосте для TLS).
|
||||
|
||||
---
|
||||
|
||||
## 2. Git и клон
|
||||
|
||||
```bash
|
||||
sudo apt install -y git
|
||||
sudo git clone https://git.kalinamall.ru/PapaTramp/security-alert-center.git /opt/security-alert-center
|
||||
sudo chown -R "$USER:$USER" /opt/security-alert-center
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 3. Docker Engine + Compose
|
||||
|
||||
```bash
|
||||
sudo apt install -y ca-certificates curl gnupg
|
||||
sudo install -m 0755 -d /etc/apt/keyrings
|
||||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
|
||||
sudo chmod a+r /etc/apt/keyrings/docker.gpg
|
||||
|
||||
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu noble stable" | \
|
||||
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
||||
|
||||
sudo apt update
|
||||
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
|
||||
sudo usermod -aG docker "$USER"
|
||||
# перелогиниться
|
||||
docker compose version
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 4. Конфигурация
|
||||
|
||||
```bash
|
||||
sudo mkdir -p /etc/security-alert-center
|
||||
cp /opt/security-alert-center/deploy/.env.example /etc/security-alert-center/.env
|
||||
chmod 600 /etc/security-alert-center/.env
|
||||
nano /etc/security-alert-center/.env
|
||||
ln -sf /etc/security-alert-center/.env /opt/security-alert-center/deploy/.env
|
||||
```
|
||||
|
||||
Заполнить: `POSTGRES_PASSWORD`, `JWT_SECRET`, `SAC_PUBLIC_URL`, `SAC_BOOTSTRAP_API_KEY`.
|
||||
|
||||
---
|
||||
|
||||
## 5. Запуск
|
||||
|
||||
```bash
|
||||
cd /opt/security-alert-center/deploy
|
||||
docker compose up -d --build
|
||||
docker compose run --rm migrate
|
||||
docker compose ps
|
||||
curl -sS http://127.0.0.1:8000/health
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 6. Бэкап (Docker)
|
||||
|
||||
```bash
|
||||
sudo tee /etc/cron.d/sac-backup <<'EOF'
|
||||
0 3 * * * root docker compose -f /opt/security-alert-center/deploy/docker-compose.yml exec -T postgres pg_dump -U sac -Fc sac > /var/backups/sac/sac_$(date +\%Y\%m\%d).dump
|
||||
EOF
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 7. Обновление
|
||||
|
||||
```bash
|
||||
cd /opt/security-alert-center
|
||||
git pull
|
||||
cd deploy
|
||||
docker compose build
|
||||
docker compose up -d
|
||||
docker compose run --rm migrate
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## См. также
|
||||
|
||||
- [install-ubuntu-24.04-native.md](install-ubuntu-24.04-native.md) — основной путь
|
||||
- [../deploy/docker-compose.yml](../deploy/docker-compose.yml)
|
||||
Reference in New Issue
Block a user