33## Architecture
44
55```
6- Feature Branches → dev branch → main branch
7- ↓ ↓ ↓
8- CI Tests Deploy DEV Build Docker Image
9- (Netlify) (auto push to GHCR)
10- ↓
11- Current Supabase
12-
13- ┌─────────────────────────────┐
14- │ Manual Release Workflow │
15- └─────────────────────────────┘
16- ↓
17- 1. Run Tests
18- ↓
19- 2. Run Migrations (optional)
20- ↓
21- 3. Deploy Edge Functions
22- ↓
23- 4. Build & Push Docker Image
24- ↓
25- 5. Create GitHub Release
6+ Feature Branches → main branch
7+ ↓ ↓
8+ CI Tests Build Docker Image
9+ (push to GHCR)
10+
11+ ┌─────────────────────────────────────────────┐
12+ │ Manual Release Workflow │
13+ └─────────────────────────────────────────────┘
14+ ↓
15+ 1. Run Tests
16+ ↓
17+ 2. Run Migrations (optional)
18+ ↓
19+ 3. Deploy Edge Functions
20+ ↓
21+ 4. Build & Push Docker Image
22+ ↓
23+ 5. Create GitHub Release
2624```
2725
2826## Environments
2927
30- | Environment | Frontend | Database | Trigger |
28+ | Environment | Frontend | Database | Purpose |
3129| -------------| ----------| ----------| ---------|
32- | ** DEV** | Netlify | Current Supabase | Push to ` dev ` |
33- | ** PROD** | Docker Image (GHCR) | New Supabase (EU) | Manual release workflow |
30+ | ** DEV** | Lovable | Current Supabase | Development & testing |
31+ | ** PROD** | Docker (Hetzner) | New Supabase (EU) | Production |
32+ | ** Local** | Docker | DEV or PROD Supabase | Local testing |
33+ | ** On-Premise** | Docker | Customer Supabase | Customer deployments |
3434
3535## Workflows
3636
3737| Workflow | Trigger | Purpose |
3838| ----------| ---------| ---------|
39- | ` ci.yml ` | PRs to dev/main | Lint, type-check, build, test |
40- | ` deploy-dev.yml ` | Push to ` dev ` | Auto-deploy frontend to Netlify |
39+ | ` ci.yml ` | PRs | Lint, type-check, build, test |
4140| ` deploy-prod.yml ` | Push to ` main ` | Auto-build Docker image to GHCR |
4241| ` release.yml ` | ** Manual** | Full controlled release with migrations |
4342
@@ -56,36 +55,17 @@ Feature Branches → dev branch → main branch
56552 . Set ` run_migrations: true `
57563 . Set ` deploy_functions: true `
58574 . Click ** Run workflow**
59- 5 . ** Approve** the migration step when prompted (GitHub Environment protection)
60-
61- ### Release Steps
62- ```
63- 1. Run Tests → Lint, type-check, build, unit tests
64- 2. Run Migrations → (if enabled) supabase db push to PROD
65- 3. Deploy Functions → (if enabled) Deploy Edge Functions to PROD
66- 4. Build Image → Build Docker with PROD config → push to GHCR
67- 5. Create Release → Tag version, generate changelog
68- ```
58+ 5 . ** Approve** the migration step (GitHub Environment protection)
6959
7060---
7161
7262## GitHub Secrets
7363
74- ### Development
7564| Secret | Value |
7665| --------| -------|
77- | ` VITE_SUPABASE_URL_DEV ` | Current Supabase URL |
78- | ` VITE_SUPABASE_ANON_KEY_DEV ` | Current Supabase anon key |
79- | ` SUPABASE_PROJECT_REF_DEV ` | ` vatgianzotsurljznsry ` |
80- | ` NETLIFY_SITE_ID_DEV ` | Netlify dev site ID |
81- | ` NETLIFY_AUTH_TOKEN ` | Netlify personal access token |
82-
83- ### Production
84- | Secret | Value |
85- | --------| -------|
86- | ` VITE_SUPABASE_URL_PROD ` | New Supabase URL (EU region) |
87- | ` VITE_SUPABASE_ANON_KEY_PROD ` | New Supabase anon key |
88- | ` SUPABASE_PROJECT_REF_PROD ` | New Supabase project ref |
66+ | ` VITE_SUPABASE_URL_PROD ` | Supabase URL (EU region) |
67+ | ` VITE_SUPABASE_ANON_KEY_PROD ` | Supabase anon key |
68+ | ` SUPABASE_PROJECT_REF_PROD ` | Supabase project ref |
8969| ` SUPABASE_ACCESS_TOKEN ` | Supabase CLI token |
9070
9171---
@@ -97,17 +77,11 @@ Feature Branches → dev branch → main branch
97772 . Create new project → Select ** EU region** (Frankfurt)
98783 . Note: project URL, anon key, project ref
9979
100- ### 2. Create Netlify Dev Site
101- 1 . Go to [ netlify.com] ( https://netlify.com )
102- 2 . Create site for dev environment
103- 3 . Get site ID and personal access token
104-
105- ### 3. Configure GitHub
80+ ### 2. Configure GitHub
106811 . Add secrets: Settings → Secrets → Actions
107822 . Create Environment "production" with required reviewers
108- 3 . Create ` dev ` branch from ` main `
10983
110- ### 4 . Initial Production Migration
84+ ### 3 . Initial Production Migration
11185``` bash
11286supabase link --project-ref YOUR_PROD_PROJECT_REF
11387supabase db push
@@ -117,35 +91,117 @@ supabase db push
11791
11892## Docker Image
11993
120- ### Available at GHCR
94+ ### Pull from GHCR
12195``` bash
12296# Latest
12397docker pull ghcr.io/sheetmetalconnect/eryxon-flow:latest
12498
12599# Specific version
126100docker pull ghcr.io/sheetmetalconnect/eryxon-flow:1.0.0
101+ ```
127102
128- # By commit SHA
129- docker pull ghcr.io/sheetmetalconnect/eryxon-flow:abc1234
103+ ### Run Locally (for testing)
104+ ``` bash
105+ docker run -p 8080:80 ghcr.io/sheetmetalconnect/eryxon-flow:latest
106+ # Open http://localhost:8080
130107```
131108
132- ### Run Anywhere
109+ ### Build Locally (custom Supabase)
133110``` bash
134- docker run -d -p 80:80 ghcr.io/sheetmetalconnect/eryxon-flow:latest
111+ docker build -t eryxon-flow \
112+ --build-arg VITE_SUPABASE_URL=https://your-project.supabase.co \
113+ --build-arg VITE_SUPABASE_PUBLISHABLE_KEY=your-anon-key .
114+
115+ docker run -p 8080:80 eryxon-flow
135116```
136117
137118---
138119
139- ## Future: Hetzner Deployment
120+ ## Hetzner Production Deployment
140121
141- When ready, add deploy step to ` release.yml ` :
122+ ### 1. Create Server
123+ 1 . [ Hetzner Cloud Console] ( https://console.hetzner.cloud )
124+ 2 . Create server: Ubuntu 24.04, CX22 (~ €4/mo), EU region
125+ 3 . Add SSH key
126+
127+ ### 2. Server Setup
128+ ``` bash
129+ ssh root@YOUR_SERVER_IP
130+
131+ # Install Docker
132+ curl -fsSL https://get.docker.com | sh
133+
134+ # Create app directory
135+ mkdir -p /opt/eryxon-flow
136+ cd /opt/eryxon-flow
137+
138+ # Login to GHCR
139+ docker login ghcr.io -u YOUR_GITHUB_USERNAME
140+
141+ # Create docker-compose.yml
142+ cat > docker-compose.yml << 'EOF '
143+ services:
144+ app:
145+ image: ghcr.io/sheetmetalconnect/eryxon-flow:latest
146+ container_name: eryxon-flow
147+ restart: unless-stopped
148+ expose:
149+ - "80"
150+
151+ caddy:
152+ image: caddy:alpine
153+ container_name: caddy
154+ restart: unless-stopped
155+ ports:
156+ - "80:80"
157+ - "443:443"
158+ volumes:
159+ - ./Caddyfile:/etc/caddy/Caddyfile:ro
160+ - caddy_data:/data
161+
162+ volumes:
163+ caddy_data:
164+ EOF
165+
166+ # Create Caddyfile
167+ cat > Caddyfile << 'EOF '
168+ app.yourdomain.com {
169+ reverse_proxy app:80
170+ }
171+ EOF
172+
173+ # Start
174+ docker compose up -d
175+ ```
142176
143- 1 . Create Hetzner server (CX22, ~ €4/mo, EU)
144- 2 . Install Docker on server
145- 3 . Add secrets: ` HETZNER_HOST ` , ` HETZNER_USERNAME ` , ` HETZNER_SSH_KEY `
146- 4 . Use prepared files:
147- - ` docker-compose.prod.yml ` - With Caddy SSL
148- - ` Caddyfile ` - Reverse proxy
177+ ### 3. DNS
178+ Point ` app.yourdomain.com ` → Server IP. Caddy handles SSL automatically.
179+
180+ ### 4. Update Production
181+ ``` bash
182+ cd /opt/eryxon-flow
183+ docker compose pull
184+ docker compose up -d --remove-orphans
185+ ```
186+
187+ ---
188+
189+ ## Customer On-Premise Deployment
190+
191+ Same Docker image, customer provides their own Supabase:
192+
193+ ``` bash
194+ # Build with customer's Supabase
195+ docker build -t eryxon-flow-customer \
196+ --build-arg VITE_SUPABASE_URL=https://customer-project.supabase.co \
197+ --build-arg VITE_SUPABASE_PUBLISHABLE_KEY=customer-anon-key .
198+
199+ # Or use docker-compose with env vars
200+ cat > .env << EOF
201+ SUPABASE_URL=https://customer-project.supabase.co
202+ SUPABASE_ANON_KEY=customer-anon-key
203+ EOF
204+ ```
149205
150206---
151207
@@ -154,30 +210,27 @@ When ready, add deploy step to `release.yml`:
154210```
155211.github/workflows/
156212 ci.yml # PR checks
157- deploy-dev.yml # Dev → Netlify (auto)
158213 deploy-prod.yml # Main → Docker image (auto)
159214 release.yml # Manual release with migrations
160215Dockerfile # Multi-stage build
161216nginx.conf # SPA routing
162217docker-compose.yml # Simple deployment
163218docker-compose.prod.yml # With Caddy SSL
164219Caddyfile # Caddy config
165- netlify.toml # Netlify config
166220```
167221
168222---
169223
170224## Developer Workflow
171225
172226``` bash
173- # Daily development
174- git checkout dev && git pull
175- git checkout -b feature/my-feature
176- # ... work ...
177- git push -u origin feature/my-feature
178- # Create PR → CI runs → Merge → Auto-deploys to Netlify DEV
179-
180- # Ready for production
181- # Create PR: dev → main → Merge → Auto-builds Docker image
182- # Then: Actions → Release → Run workflow (choose options)
227+ # Development (use Lovable)
228+ # Push to GitHub → Lovable auto-syncs
229+
230+ # Ready for production release
231+ # Actions → Release → Run workflow
232+ # Docker image built and pushed to GHCR
233+
234+ # Deploy to Hetzner
235+ ssh root@server " cd /opt/eryxon-flow && docker compose pull && docker compose up -d"
183236```
0 commit comments