Skip to content

Commit 141b01d

Browse files
Merge pull request #394 from SheetMetalConnect/claude/one-click-setup-VQDOc
2 parents d9ea4c1 + a8ffe90 commit 141b01d

33 files changed

+1550
-754
lines changed

.env.example

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,13 @@ VITE_SUPABASE_PROJECT_ID="your-project-id"
2626
# VITE_DEFAULT_LANGUAGE="en"
2727

2828
# =============================================================================
29-
# CAPTCHA CONFIGURATION (Required for auth)
29+
# CAPTCHA CONFIGURATION (Optional - recommended for production)
3030
# =============================================================================
3131
# Cloudflare Turnstile site key - get from Cloudflare dashboard
3232
# https://dash.cloudflare.com/?to=/:account/turnstile
33+
# If not set, auth will work without captcha protection
3334

34-
VITE_TURNSTILE_SITE_KEY="your-turnstile-site-key"
35+
# VITE_TURNSTILE_SITE_KEY="your-turnstile-site-key"
3536

3637
# =============================================================================
3738
# DOCUMENTATION URL (Optional - for self-hosters)

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ __pycache__/
4242

4343
# === Security: Sensitive Files ===
4444

45-
# Supabase configuration (contains project ID)
46-
supabase/config.toml
45+
# Supabase temp files
4746
supabase/.temp/
4847

4948
# Environment files (contains credentials)

DEPLOY.md

Lines changed: 98 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,120 @@
1-
# Deploy Eryxon Flow
1+
# Deployment Guide
2+
3+
## Quick Start (Automated)
4+
5+
The fastest way to deploy Eryxon MES:
6+
7+
```bash
8+
chmod +x scripts/setup.sh
9+
./scripts/setup.sh
10+
```
11+
12+
This interactive script handles all setup steps. For manual setup, continue reading.
213

314
## Prerequisites
415

5-
- Supabase account
6-
- Cloudflare account (free tier)
16+
- Node.js 20+
17+
- [Supabase CLI](https://supabase.com/docs/guides/cli)
18+
- A [Supabase](https://supabase.com) project
719

8-
## Step 1: Create Supabase Project
20+
## Step 1: Supabase Setup
921

22+
### Create Project
23+
1. Go to [supabase.com](https://supabase.com) and create a new project
24+
2. Note your **Project URL**, **anon key**, and **service role key** from Settings > API
25+
26+
### Apply Database Schema
1027
```bash
11-
# 1. Go to supabase.com → Create project
12-
# 2. Get credentials from Settings → API:
13-
# - Project URL
14-
# - anon key
15-
# - Project Ref
28+
cp .env.example .env
29+
# Fill in VITE_SUPABASE_URL and VITE_SUPABASE_PUBLISHABLE_KEY
1630

17-
# 3. Apply schema
18-
supabase link --project-ref YOUR_REF
31+
supabase link --project-ref <your-project-ref>
1932
supabase db push
33+
```
2034

21-
# 4. Create storage
22-
supabase storage create parts-images
23-
supabase storage create issues
35+
### Set Up Storage & Cron Jobs
36+
```bash
37+
# Apply via SQL Editor in Supabase Dashboard, or:
38+
supabase db execute < supabase/seed.sql
39+
```
2440

25-
# 5. Deploy functions
41+
This creates storage buckets (`parts-images`, `issues`, `parts-cad`) and schedules cron jobs.
42+
43+
### Deploy Edge Functions
44+
```bash
2645
supabase functions deploy
2746
```
2847

29-
## Step 2: Deploy to Cloudflare Pages
48+
### Set Edge Function Secrets
49+
```bash
50+
supabase secrets set \
51+
SUPABASE_URL=<your-project-url> \
52+
SUPABASE_SERVICE_ROLE_KEY=<your-service-role-key>
53+
```
54+
55+
Optional secrets:
56+
| Secret | Purpose |
57+
|--------|---------|
58+
| RESEND_API_KEY | Email invitations via Resend |
59+
| APP_URL | Base URL for invitation links |
60+
| EMAIL_FROM | Sender email for invitations |
61+
| CRON_SECRET | Auth for monthly-reset-cron |
62+
| SELF_HOSTED_MODE | Set to "true" for self-hosted mode |
3063

64+
## Step 2: Deploy Frontend
65+
66+
### Option A: Local Development
3167
```bash
32-
# 1. Go to dash.cloudflare.com
33-
# 2. Pages → Create → Connect Git
34-
# 3. Select repo
35-
# 4. Build: npm run build
36-
# 5. Output: dist
68+
npm ci
69+
npm run dev
3770
```
3871

39-
**Environment Variables** (set in Cloudflare):
72+
### Option B: Cloudflare Pages
73+
1. Connect your Git repository to Cloudflare Pages
74+
2. Build command: `npm run build`
75+
3. Output directory: `dist`
76+
4. Add environment variables in Cloudflare Pages settings
77+
78+
### Option C: Docker
79+
```bash
80+
docker build \
81+
--build-arg VITE_SUPABASE_URL=<url> \
82+
--build-arg VITE_SUPABASE_PUBLISHABLE_KEY=<key> \
83+
-t eryxon-flow .
84+
85+
docker run -p 80:80 eryxon-flow
4086
```
41-
VITE_SUPABASE_URL = https://YOUR_REF.supabase.co
42-
VITE_SUPABASE_PUBLISHABLE_KEY = your-anon-key
43-
VITE_SUPABASE_PROJECT_ID = YOUR_REF
87+
88+
### Option D: Docker Compose (Production with SSL)
89+
```bash
90+
# Edit Caddyfile - replace domain with yours
91+
# Edit docker-compose.prod.yml if needed
92+
docker compose -f docker-compose.prod.yml up -d
4493
```
4594

46-
## Step 3: Custom Domain
95+
## Step 3: First Login
96+
97+
1. Navigate to your deployment URL
98+
2. Click "Sign Up" to create the first admin account
99+
3. The first user automatically becomes admin with their own tenant
100+
101+
## Optional: Cloudflare Turnstile (CAPTCHA)
102+
103+
Turnstile is optional. Without it, auth works but without bot protection.
104+
105+
To enable:
106+
1. Create a Turnstile widget at [Cloudflare Dashboard](https://dash.cloudflare.com/?to=/:account/turnstile)
107+
2. Set `VITE_TURNSTILE_SITE_KEY` in your environment
108+
3. Configure the Turnstile secret key in Supabase Dashboard > Auth > Captcha
109+
110+
## Verification
111+
112+
Run the verification script to check your setup:
113+
```bash
114+
chmod +x scripts/verify-setup.sh
115+
./scripts/verify-setup.sh
116+
```
47117

48-
In Cloudflare Pages:
49-
- Custom domains → Add domain
50-
- Enter: app.eryxon.eu
51-
- DNS: CNAME app → eryxon-flow.pages.dev
118+
## Full Documentation
52119

53-
Done.
120+
See [docs/SELF_HOSTING_GUIDE.md](docs/SELF_HOSTING_GUIDE.md) for the complete self-hosting guide including Docker, Cloudflare Pages, and troubleshooting.

Dockerfile

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,27 @@ RUN npm ci
1212
# Copy source code
1313
COPY . .
1414

15-
# Build arguments for Supabase config (passed at build time)
15+
# Build arguments for all VITE env vars (passed at build time)
1616
ARG VITE_SUPABASE_URL
1717
ARG VITE_SUPABASE_PUBLISHABLE_KEY
18+
ARG VITE_SUPABASE_PROJECT_ID
19+
ARG VITE_TURNSTILE_SITE_KEY
20+
ARG VITE_APP_TITLE
21+
ARG VITE_DEFAULT_LANGUAGE
22+
ARG VITE_DOCS_URL
23+
ARG VITE_CAD_SERVICE_URL
24+
ARG VITE_CAD_SERVICE_API_KEY
1825

1926
# Set as environment variables for Vite build
2027
ENV VITE_SUPABASE_URL=$VITE_SUPABASE_URL
2128
ENV VITE_SUPABASE_PUBLISHABLE_KEY=$VITE_SUPABASE_PUBLISHABLE_KEY
29+
ENV VITE_SUPABASE_PROJECT_ID=$VITE_SUPABASE_PROJECT_ID
30+
ENV VITE_TURNSTILE_SITE_KEY=$VITE_TURNSTILE_SITE_KEY
31+
ENV VITE_APP_TITLE=$VITE_APP_TITLE
32+
ENV VITE_DEFAULT_LANGUAGE=$VITE_DEFAULT_LANGUAGE
33+
ENV VITE_DOCS_URL=$VITE_DOCS_URL
34+
ENV VITE_CAD_SERVICE_URL=$VITE_CAD_SERVICE_URL
35+
ENV VITE_CAD_SERVICE_API_KEY=$VITE_CAD_SERVICE_API_KEY
2236

2337
# Build the app
2438
RUN npm run build
@@ -37,6 +51,6 @@ EXPOSE 80
3751

3852
# Health check
3953
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
40-
CMD wget --quiet --tries=1 --spider http://localhost/ || exit 1
54+
CMD wget --quiet --tries=1 --spider http://localhost/health || exit 1
4155

4256
CMD ["nginx", "-g", "daemon off;"]

0 commit comments

Comments
 (0)