Files
microdao-daarion/NODA1-SAFE-DEPLOY.md
Apple 0d8582d552 docs(node1): add safe deploy workflow and snapshot
Document canonical sync between GitHub and NODA1 and add a snapshot script to capture runtime state without editing production by hand.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-10 05:33:32 -08:00

72 lines
2.1 KiB
Markdown
Raw Permalink 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.
# NODA1 Safe Deploy (Canonical Workflow)
**Goal:** синхронізувати ноут ↔ GitHub ↔ NODA1 ↔ реальний Docker-стек так, щоб не ламати працюючий прод і не плодити "невидимі" гілки.
**Canonical source of truth:** GitHub `origin/main`.
---
## Ролі директорій на NODA1
- `/opt/microdao-daarion` — legacy checkout (може мати роз'їхавшу історію). Не використовувати для `git pull/rebase`, якщо є конфлікти.
- `/opt/microdao-daarion.repo` — canonical deployment checkout (git worktree на `origin/main`). Деплой робимо тільки звідси.
---
## Golden rules
1. Жодних ручних правок коду/доків на NODA1 (крім аварійного hotfix з наступним PR).
2. Жодних гілок/розробки на NODA1.
3. Docker compose завжди з однаковим project name: `-p microdao-daarion`.
4. Secrets не комітяться; для них тримати `*.example` + короткий опис розміщення.
---
## Safe sync (NODA1)
```bash
ssh root@144.76.224.179
cd /opt/microdao-daarion
git fetch origin
cd /opt/microdao-daarion.repo
git pull --ff-only
git rev-parse --short HEAD
```
---
## Safe deploy одного сервісу (мінімальний ризик)
### Router
```bash
cd /opt/microdao-daarion.repo
docker compose -p microdao-daarion -f docker-compose.node1.yml build router
docker compose -p microdao-daarion -f docker-compose.node1.yml up -d --no-deps --force-recreate router
curl -fsS http://127.0.0.1:9102/health
```
### Gateway
```bash
cd /opt/microdao-daarion.repo
docker compose -p microdao-daarion -f docker-compose.node1.yml build gateway
docker compose -p microdao-daarion -f docker-compose.node1.yml up -d --no-deps --force-recreate gateway
curl -fsS http://127.0.0.1:9300/health
```
---
## Runtime snapshot
```bash
cd /opt/microdao-daarion.repo
./scripts/node1/snapshot_node1.sh > "/opt/backups/node1_snapshot_$(date +%Y%m%d-%H%M%S).txt"
```