Skip to content

Commit e4fa4ad

Browse files
committed
docs: Add dual storage configuration for MinIO and Supabase
- Add comprehensive storage configuration guide - Add Supabase bucket setup SQL script - Add Supabase storage troubleshooting guide - Add .env.supabase.example template for production - Add docker-compose.local.yml for MinIO development - Update .gitignore to exclude credentials and temp files MinIO (local dev): Fully functional and ready to use Supabase (production): Configuration ready, needs S3 protocol verification
1 parent d9bb567 commit e4fa4ad

6 files changed

Lines changed: 442 additions & 1 deletion

.env.supabase.example

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# NCA Toolkit - Supabase Storage Configuration (Production)
2+
# Copy this to .env.supabase for production deployment
3+
4+
# API Security
5+
API_KEY=your-production-api-key-here
6+
7+
# Supabase Storage Configuration (S3-Compatible)
8+
# From your Supabase dashboard: Storage > Configuration > S3
9+
10+
# S3 Endpoint
11+
# Format: https://[project-ref].supabase.co/storage/v1/s3
12+
S3_ENDPOINT=https://YOUR_PROJECT_REF.supabase.co/storage/v1/s3
13+
14+
# S3 Access Credentials
15+
# Generate these by clicking "+ New access key" in Storage > Configuration > S3
16+
S3_ACCESS_KEY=YOUR_ACCESS_KEY_ID_HERE
17+
S3_SECRET_KEY=YOUR_SECRET_ACCESS_KEY_HERE
18+
19+
# Bucket Configuration
20+
S3_BUCKET=nca-videos
21+
S3_REGION=YOUR_REGION_HERE
22+
23+
# SSL Configuration
24+
USE_SSL=true
25+
26+
# Performance Settings
27+
MAX_WORKERS=4
28+
TIMEOUT=600
29+
30+
# ==============================================================================
31+
# SETUP INSTRUCTIONS:
32+
# ==============================================================================
33+
# 1. Click "+ New access key" in Supabase Storage > Configuration > S3
34+
# 2. Copy the Access Key ID and Secret Access Key
35+
# 3. Copy this file: cp .env.supabase.example .env.supabase
36+
# 4. Edit .env.supabase and replace all YOUR_* placeholders with actual values
37+
# 5. Update API_KEY with your production API key
38+
#
39+
# Example values:
40+
# - S3_ENDPOINT: https://pzlfrolcibae3hlicaecdj.supabase.co/storage/v1/s3
41+
# - S3_REGION: eu-west-2 (or us-east-1, etc.)
42+
# - S3_BUCKET: nca-videos
43+
# ==============================================================================

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
.env_variables.json
22
.DS_Store
33
.env_shell.json
4-
.env
4+
.env
5+
.env.supabase
6+
.env.local.minio
7+
temp/

docker-compose.local.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
services:
2+
# MinIO - S3-compatible local storage
3+
minio:
4+
image: minio/minio:latest
5+
container_name: nca-minio
6+
ports:
7+
- "9000:9000" # API
8+
- "9001:9001" # Console
9+
environment:
10+
MINIO_ROOT_USER: minioadmin
11+
MINIO_ROOT_PASSWORD: minioadmin123
12+
command: server /data --console-address ":9001"
13+
volumes:
14+
- minio_data:/data
15+
networks:
16+
- nca-network
17+
18+
# NCA Toolkit API
19+
nca-toolkit:
20+
build: .
21+
container_name: nca-toolkit-api
22+
ports:
23+
- "8080:8080"
24+
environment:
25+
# API Security
26+
API_KEY: local-dev-api-key-12345
27+
28+
# MinIO S3 Configuration
29+
S3_ENDPOINT: http://minio:9000
30+
S3_ACCESS_KEY: minioadmin
31+
S3_SECRET_KEY: minioadmin123
32+
S3_BUCKET: nca-videos
33+
S3_REGION: us-east-1
34+
USE_SSL: "false"
35+
36+
# Performance
37+
MAX_WORKERS: 4
38+
TIMEOUT: 600
39+
depends_on:
40+
- minio
41+
networks:
42+
- nca-network
43+
volumes:
44+
- ./temp:/app/temp # Temporary processing files
45+
46+
volumes:
47+
minio_data:
48+
49+
50+
networks:
51+
nca-network:
52+
driver: bridge

docs/STORAGE_CONFIGURATION.md

Lines changed: 203 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
# NCA Toolkit Storage Configuration Guide
2+
3+
## Overview
4+
The NCA Toolkit supports dual storage configuration:
5+
- **MinIO** for local development
6+
- **Supabase Storage** for production
7+
8+
Both use S3-compatible APIs, making it easy to switch between environments.
9+
10+
---
11+
12+
## MinIO Setup (Local Development)
13+
14+
### 1. Start Services
15+
```bash
16+
cd c:\development\github\compiled-growth\nca
17+
docker compose -f docker-compose.local.yml up -d
18+
```
19+
20+
### 2. Verify MinIO
21+
- **Console:** http://localhost:9001
22+
- **API:** http://localhost:9000
23+
- **Credentials:** minioadmin / minioadmin123
24+
25+
### 3. Bucket Configuration
26+
**Bucket Name:** `nca-videos`
27+
**Access Policy:** Public download (read-only)
28+
29+
**Status:** ✅ Created and configured
30+
31+
### 4. Test Access
32+
```bash
33+
# List buckets
34+
docker exec nca-minio mc ls local/
35+
36+
# Check bucket policy
37+
docker exec nca-minio mc anonymous get local/nca-videos
38+
```
39+
40+
### 5. Environment Configuration
41+
Use `.env.local.minio` for local development:
42+
```bash
43+
S3_ENDPOINT=http://localhost:9000
44+
S3_ACCESS_KEY=minioadmin
45+
S3_SECRET_KEY=minioadmin123
46+
S3_BUCKET=nca-videos
47+
```
48+
49+
---
50+
51+
## Supabase Storage Setup (Production)
52+
53+
### 1. Access Supabase Dashboard
54+
Navigate to your Supabase project dashboard
55+
56+
### 2. Create Storage Bucket
57+
58+
**Option A: Via Dashboard**
59+
1. Go to **Storage** section
60+
2. Click **New bucket**
61+
3. Name: `nca-videos`
62+
4. Set to **Public** bucket
63+
5. Click **Create bucket**
64+
65+
**Option B: Via SQL**
66+
```sql
67+
-- Create the bucket
68+
INSERT INTO storage.buckets (id, name, public)
69+
VALUES ('nca-videos', 'nca-videos', true);
70+
71+
-- Set public access policy
72+
CREATE POLICY "Public Access"
73+
ON storage.objects FOR SELECT
74+
USING (bucket_id = 'nca-videos');
75+
76+
-- Allow authenticated uploads
77+
CREATE POLICY "Authenticated Uploads"
78+
ON storage.objects FOR INSERT
79+
WITH CHECK (bucket_id = 'nca-videos' AND auth.role() = 'authenticated');
80+
```
81+
82+
### 3. Get S3 Credentials
83+
1. Go to **Project Settings** > **API**
84+
2. Scroll to **S3 Access Keys**
85+
3. Click **Generate new key**
86+
4. Save the Access Key ID and Secret Access Key
87+
88+
### 4. Configure Environment
89+
Update `.env.supabase.example` with your credentials:
90+
```bash
91+
S3_ENDPOINT=https://YOUR_PROJECT_REF.supabase.co/storage/v1/s3
92+
S3_ACCESS_KEY=YOUR_ACCESS_KEY_ID
93+
S3_SECRET_KEY=YOUR_SECRET_ACCESS_KEY
94+
S3_BUCKET=nca-videos
95+
USE_SSL=true
96+
```
97+
98+
### 5. Test Connection
99+
```bash
100+
# Using AWS CLI
101+
aws s3 ls s3://nca-videos \
102+
--endpoint-url https://YOUR_PROJECT_REF.supabase.co/storage/v1/s3 \
103+
--region us-east-1
104+
```
105+
106+
---
107+
108+
## Switching Between Environments
109+
110+
### Local Development
111+
```bash
112+
cp .env.local.minio .env
113+
docker compose -f docker-compose.local.yml up -d
114+
```
115+
116+
### Production
117+
```bash
118+
cp .env.supabase .env
119+
# Deploy to your production environment
120+
```
121+
122+
---
123+
124+
## Bucket Permissions
125+
126+
### MinIO (Local)
127+
- **Read:** Public (anyone can download)
128+
- **Write:** Authenticated via API key
129+
130+
### Supabase (Production)
131+
- **Read:** Public (anyone can download)
132+
- **Write:** Authenticated users only
133+
- **Delete:** Service role only
134+
135+
---
136+
137+
## Testing Both Storage Solutions
138+
139+
### Test MinIO
140+
```bash
141+
# Upload test file
142+
curl -X POST http://localhost:8080/api/v1/test-upload \
143+
-H "X-API-Key: local-dev-api-key-12345" \
144+
-F "file=@test-video.mp4"
145+
146+
# Verify in MinIO Console
147+
open http://localhost:9001/buckets/nca-videos/browse
148+
```
149+
150+
### Test Supabase
151+
```bash
152+
# Upload test file (production)
153+
curl -X POST https://your-api.com/api/v1/test-upload \
154+
-H "X-API-Key: your-production-key" \
155+
-F "file=@test-video.mp4"
156+
157+
# Verify in Supabase Dashboard
158+
# Go to Storage > nca-videos
159+
```
160+
161+
---
162+
163+
## Troubleshooting
164+
165+
### MinIO Issues
166+
- **Port 9000 in use:** Stop other MinIO instances
167+
- **Bucket not found:** Recreate via console or mc command
168+
- **Permission denied:** Check bucket policy is set to public
169+
170+
### Supabase Issues
171+
- **S3 credentials not working:** Regenerate keys in dashboard
172+
- **Bucket not accessible:** Verify bucket is set to public
173+
- **Upload fails:** Check RLS policies allow authenticated uploads
174+
175+
---
176+
177+
## Integration with n8n
178+
179+
Both storage solutions can be accessed from n8n workflows:
180+
181+
### MinIO (from n8n container)
182+
```javascript
183+
// Use host.docker.internal or MinIO container name
184+
const endpoint = 'http://host.docker.internal:9000';
185+
const bucket = 'nca-videos';
186+
```
187+
188+
### Supabase (from n8n)
189+
```javascript
190+
// Use Supabase Storage node or HTTP Request
191+
const endpoint = 'https://YOUR_PROJECT_REF.supabase.co/storage/v1';
192+
const bucket = 'nca-videos';
193+
```
194+
195+
---
196+
197+
## Next Steps
198+
199+
1. ✅ MinIO bucket created and configured
200+
2. ⏳ Create Supabase storage bucket
201+
3. ⏳ Test both storage solutions
202+
4. ⏳ Configure n8n workflows to use storage
203+
5. ⏳ Fix Supabase container restart issues

0 commit comments

Comments
 (0)