Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,6 @@ docker/supabase/volumes/storage/

# TypeScript
*.tsbuildinfo

# Claude Code (réglages personnels, non partagés)
.claude/settings.local.json
4 changes: 2 additions & 2 deletions DEPLOY.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ Services :
|---------|--------------|------------------|
| Front Next.js | 3000 (localhost) | Via Nginx → `swor.fr` |
| Supabase API (Kong) | 54321 | Via Nginx → `api.swor.fr` |
| Studio / Directus | 54323 / 8055 | Bloquer en prod ou VPN uniquement |
| Supabase Studio | 54323 | Bloquer en prod ou VPN uniquement |
| PostgreSQL | 54322 | Localhost / jamais exposé |

## 5. Nginx (HTTPS)
Expand Down Expand Up @@ -109,7 +109,7 @@ sudo ufw allow 443
sudo ufw enable
```

Ne pas ouvrir les ports 54321, 54322, 54323, 8055 publiquement — Nginx fait le proxy.
Ne pas ouvrir les ports 54321, 54322, 54323 publiquement — Nginx fait le proxy.

## Dépannage

Expand Down
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ swor/
├── front/ # Application principale (Next.js, port 3000)
├── back/ # Back-office admin (Next.js, port 3001)
├── supabase/ # Migrations et seeds SQL
└── docker/ # Supabase auto-hébergé, Directus, compose racine
└── docker/ # Supabase auto-hébergé, compose racine
```

| Service | Port | Description |
Expand All @@ -35,7 +35,6 @@ swor/
| Supabase API | 54321 | Kong (REST, Auth, Realtime, Storage) |
| Supabase Studio| 54323 | Interface de gestion de la BDD |
| PostgreSQL | 54322 | Base de données |
| Directus | 8055 | CMS / administration des données |

## Prérequis

Expand Down Expand Up @@ -79,7 +78,6 @@ npm run docker:up

- Front : [http://localhost:3000](http://localhost:3000)
- Supabase Studio : [http://localhost:54323](http://localhost:54323)
- Directus : [http://localhost:8055](http://localhost:8055) (`admin@example.com` / `password` par défaut)

### En local (développement)

Expand Down Expand Up @@ -130,7 +128,6 @@ La simulation IA nécessite `OPENAI_API_KEY` ou `GEMINI_API_KEY` dans `front/.en

**Backend & données**
- Supabase (PostgreSQL, Auth, Realtime, Storage)
- Directus (CMS)
- Schéma : personnages, forums hiérarchiques, factions, inventaire, économie, vaisseaux

## Structure du front
Expand Down
28 changes: 2 additions & 26 deletions docker/supabase/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ services:
PGPASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: postgres
POSTGRES_USER: postgres
AUTHENTICATOR_PASSWORD: ${AUTHENTICATOR_PASSWORD}
volumes:
- ./volumes/db/data:/var/lib/postgresql/data
- ./volumes/db/init:/docker-entrypoint-initdb.d
Expand Down Expand Up @@ -81,7 +82,7 @@ services:
db:
condition: service_healthy
environment:
PGRST_DB_URI: postgres://authenticator:postgres@db:5432/postgres
PGRST_DB_URI: postgres://authenticator:${AUTHENTICATOR_PASSWORD}@db:5432/postgres
PGRST_DB_SCHEMA: public
PGRST_DB_ANON_ROLE: anon
PGRST_JWT_SECRET: ${JWT_SECRET}
Expand Down Expand Up @@ -133,31 +134,6 @@ services:
volumes:
- ./volumes/storage:/var/lib/storage

directus:
container_name: directus
image: directus/directus:10.13.1
ports:
- "8055:8055"
depends_on:
db:
condition: service_healthy
environment:
KEY: "directus-key-for-star-wars-rp"
SECRET: "directus-secret-for-star-wars-rp"
DB_CLIENT: "pg"
DB_HOST: "db"
DB_PORT: "5432"
DB_DATABASE: "postgres"
DB_USER: "postgres"
DB_PASSWORD: "${POSTGRES_PASSWORD}"
# Directus needs to access the public schema
DB_SCHEMA: "public"
# Enable all features
ADMIN_EMAIL: "admin@example.com"
ADMIN_PASSWORD: "password"
# To allow Directus to see Supabase tables
DB_METADATA_IGNORE: "false"

studio:
container_name: supabase-studio
image: supabase/studio:latest
Expand Down
3 changes: 3 additions & 0 deletions docker/supabase/env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
POSTGRES_PASSWORD=postgres
POSTGRES_PORT=54322

# Mot de passe du rôle Postgres "authenticator" (utilisé par PostgREST)
AUTHENTICATOR_PASSWORD=postgres

KONG_PORT=54321
KONG_ADMIN_PORT=54325
STUDIO_PORT=54323
Expand Down
3 changes: 2 additions & 1 deletion docker/supabase/volumes/db/init/00_roles.sql
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ BEGIN
CREATE ROLE supabase_admin WITH SUPERUSER CREATEROLE CREATEDB REPLICATION BYPASSRLS;
END IF;
IF NOT EXISTS (SELECT FROM pg_catalog.pg_roles WHERE rolname = 'authenticator') THEN
CREATE ROLE authenticator NOINHERIT LOGIN PASSWORD 'postgres';
-- Le mot de passe est défini par 00z_set_authenticator_password.sh (variable AUTHENTICATOR_PASSWORD)
CREATE ROLE authenticator NOINHERIT;
END IF;
END
$$;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
# Définit le mot de passe du rôle authenticator depuis l'environnement,
# pour ne pas le committer en dur dans les scripts SQL.
set -e

psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" \
-c "ALTER ROLE authenticator WITH LOGIN PASSWORD '${AUTHENTICATOR_PASSWORD:-postgres}'"
Loading