Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
bea64ef
Merge pull request #35 from TakCastel/main
TakCastel Jul 2, 2026
05c5836
Documente la migration Laravel (ADR #29) et le modèle de données forum.
TakCastel Jul 2, 2026
5325662
Initialise le monolithe Laravel 12 avec Inertia, React et le thème Swor.
TakCastel Jul 2, 2026
6b11843
Transcrit le schéma Swor en migrations Laravel, modèles et seeders.
TakCastel Jul 2, 2026
31f1fd2
Sépare Laravel dans api/ et branche l'auth Fortify + Sanctum sur le f…
TakCastel Jul 2, 2026
33ee804
Migre le front sur l'API Laravel et décommissionne Supabase, back/ et…
TakCastel Jul 3, 2026
87b350c
Versionne bootstrap/cache/.gitignore pour corriger la CI.
TakCastel Jul 3, 2026
8a5f550
Fixe APP_KEY de test dans phpunit.xml pour la CI.
TakCastel Jul 3, 2026
ad0d801
Merge pull request #42 from TakCastel/feature/29-migration-laravel-adr
TakCastel Jul 3, 2026
55be45b
Merge pull request #43 from TakCastel/feature/30-init-laravel-monolith
TakCastel Jul 3, 2026
04e7c5a
Merge pull request #44 from TakCastel/feature/31-swor-schema-migrations
TakCastel Jul 3, 2026
ac29ebd
Merge pull request #45 from TakCastel/feature/32-auth-fortify-sanctum
TakCastel Jul 3, 2026
5cb68a5
Merge pull request #46 from TakCastel/feature/41-api-jeu-decommission…
TakCastel Jul 3, 2026
69ad137
Purge les dernières références Supabase (lockfiles, docs, env d'exemp…
TakCastel Jul 3, 2026
64249fd
Régénère le lockfile depuis un état propre (binaires natifs Linux man…
TakCastel Jul 3, 2026
757bbb8
Merge pull request #47 from TakCastel/feature/41-purge-references-sup…
TakCastel Jul 3, 2026
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
4 changes: 2 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ node_modules
!.env.example
!.env.production.example
*.local
docker/supabase/volumes/db/data
docker/supabase/volumes/storage
*.tsbuildinfo
api/vendor
api/storage/logs
README.md
DEPLOY.md
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_size = 2

[docker-compose.yml]
indent_size = 4
30 changes: 1 addition & 29 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,31 +1,3 @@
# Variables d'environnement pour Docker Compose (racine du projet).
# Copiez ce fichier vers .env : npm run setup
# Gardez les mêmes valeurs que docker/supabase/.env

# Docker dev (Postgres uniquement) — voir docker-compose.yml
POSTGRES_PASSWORD=postgres
POSTGRES_PORT=54322

KONG_PORT=54321
KONG_ADMIN_PORT=54325
STUDIO_PORT=54323

# JWT Secret (au moins 32 caractères)
JWT_SECRET=super-secret-jwt-token-with-at-least-32-characters-long
JWT_EXPIRY=3600

# Clés API Supabase (doivent correspondre à front/.env.local et back/.env.local)
ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InN3b3ItdjIiLCJyb2xlIjoiYW5vbiIsImlhdCI6MTYwMDAwMDAwMCwiZXhwIjoyMDAwMDAwMDAwfQ.placeholder-anon-key
SERVICE_ROLE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InN3b3ItdjIiLCJyb2xlIjoic2VydmljZV9yb2xlIiwiaWF0IjoxNjAwMDAwMDAwMCwiZXhwIjoyMDAwMDAwMDAwfQ.placeholder-service-key

# Auth
SITE_URL=http://localhost:3000
OPERATOR_TOKEN=operator-token
ENABLE_EMAIL_SIGNUP=true
ENABLE_EMAIL_AUTOCONFIRM=true
SMTP_ADMIN_EMAIL=admin@example.com
SMTP_HOST=smtp.example.com
SMTP_PORT=587
SMTP_USER=user
SMTP_PASS=pass
SMTP_SENDER_NAME=Supabase
DB_MAX_POOL_SIZE=20
30 changes: 11 additions & 19 deletions .env.production.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,22 @@

# --- URLs publiques ---
SITE_URL=https://swor.fr
PUBLIC_SUPABASE_URL=https://api.swor.fr
API_URL=https://api.swor.fr

# --- Supabase (mêmes valeurs que docker/supabase/.env) ---
POSTGRES_PASSWORD=change-me-strong-password
POSTGRES_PORT=54322

KONG_PORT=54321
KONG_ADMIN_PORT=54325
STUDIO_PORT=54323
# --- Laravel ---
# Générer avec : cd api && php artisan key:generate --show
APP_KEY=base64:change-me
SANCTUM_STATEFUL_DOMAINS=swor.fr,www.swor.fr
SESSION_DOMAIN=.swor.fr

JWT_SECRET=change-me-jwt-secret-at-least-32-characters
JWT_EXPIRY=3600

ANON_KEY=your-anon-key-jwt
SERVICE_ROLE_KEY=your-service-role-key-jwt
# --- Postgres ---
POSTGRES_DB=swor
POSTGRES_USER=postgres
POSTGRES_PASSWORD=change-me-strong-password

# --- Auth / SMTP ---
OPERATOR_TOKEN=change-me-operator-token
ENABLE_EMAIL_SIGNUP=true
ENABLE_EMAIL_AUTOCONFIRM=false
# --- SMTP (emails transactionnels : vérification, reset password) ---
SMTP_ADMIN_EMAIL=noreply@swor.fr
SMTP_HOST=smtp.example.com
SMTP_PORT=587
SMTP_USER=
SMTP_PASS=
SMTP_SENDER_NAME=Swor
DB_MAX_POOL_SIZE=20
10 changes: 10 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
* text=auto eol=lf

*.blade.php diff=html
*.css diff=css
*.html diff=html
*.md diff=markdown
*.php diff=php

CHANGELOG.md export-ignore
README.md export-ignore
20 changes: 18 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,23 @@ on:
pull_request:

jobs:
api:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
extensions: mbstring, pdo_sqlite
coverage: none

- name: Install Composer dependencies
run: composer install -d api --no-interaction --prefer-dist

- name: Run API tests
run: cd api && php artisan test

front:
runs-on: ubuntu-latest
steps:
Expand All @@ -25,5 +42,4 @@ jobs:
- name: Build front
run: npm run build -w front
env:
NEXT_PUBLIC_SUPABASE_URL: http://localhost:54321
NEXT_PUBLIC_SUPABASE_ANON_KEY: placeholder-anon-key-for-ci
NEXT_PUBLIC_API_URL: http://localhost:8000
20 changes: 16 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,24 @@ next-env.d.ts
.env.local
.env*.local

# Docker local volumes (Postgres data, storage)
docker/supabase/volumes/db/data/
docker/supabase/volumes/storage/

# TypeScript
*.tsbuildinfo

# Claude Code (réglages personnels, non partagés)
.claude/settings.local.json

# Laravel (api/)
api/vendor/
api/public/build
api/public/hot
api/public/storage
api/storage/*.key
api/database/database.sqlite
api/bootstrap/cache/*.php
api/.env
.phpunit.result.cache
/auth.json
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
api/resources/js/components/ui/*
59 changes: 24 additions & 35 deletions DEPLOY.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
# Swor — déploiement VPS (Docker)

Guide pour remplacer l’ancienne app Laravel sur [swor.fr](https://swor.fr) par le stack Next.js + Supabase.
Stack production : front Next.js + API Laravel + PostgreSQL, derrière Nginx.

> ⚠️ La stack Docker de production (`api/Dockerfile`, `docker-compose.prod.yml`)
> a été réécrite lors de la migration Laravel et n'a pas encore été validée sur
> le VPS — à tester au prochain déploiement.

## Prérequis serveur

- Ubuntu 22.04+ (ou équivalent)
- Docker et Docker Compose v2
- Nginx (ou Caddy) pour le reverse proxy HTTPS
- Nginx pour le reverse proxy HTTPS
- Nom de domaine pointant vers le VPS (`swor.fr`, `api.swor.fr`)

## 1. Préparer le serveur
Expand All @@ -29,41 +33,29 @@ Depuis votre machine locale :
./scripts/deploy.sh user@votre-vps /opt/swor
```

Ou manuellement :

```bash
rsync -avz --delete \
--exclude node_modules \
--exclude .next \
--exclude .git \
--exclude docker/supabase/volumes/db/data \
--exclude docker/supabase/volumes/storage \
./ user@votre-vps:/opt/swor/
```

## 3. Configurer l’environnement
## 3. Configurer l'environnement

Sur le VPS :

```bash
cd /opt/swor
cp .env.production.example .env.production
cp docker/supabase/env.example docker/supabase/.env
```

Éditez `.env.production` et `docker/supabase/.env` :
Éditez `.env.production` :

| Variable | Exemple | Rôle |
|----------|---------|------|
| `SITE_URL` | `https://swor.fr` | URL du front (auth Supabase) |
| `PUBLIC_SUPABASE_URL` | `https://api.swor.fr` | URL API exposée au navigateur |
| `JWT_SECRET` | 32+ caractères | Secret JWT Supabase |
| `ANON_KEY` / `SERVICE_ROLE_KEY` | JWT signés | Clés API (identiques dans les deux fichiers) |
| `SITE_URL` | `https://swor.fr` | URL publique du front |
| `API_URL` | `https://api.swor.fr` | URL publique de l'API (injectée au build du front) |
| `APP_KEY` | `base64:…` | Clé Laravel (`php artisan key:generate --show`) |
| `SANCTUM_STATEFUL_DOMAINS` | `swor.fr,www.swor.fr` | Domaines autorisés pour la session SPA |
| `SESSION_DOMAIN` | `.swor.fr` | Portée du cookie de session |
| `POSTGRES_PASSWORD` | mot de passe fort | Base de données |
| `SMTP_*` | — | Emails transactionnels |

Générez des clés JWT cohérentes avec votre `JWT_SECRET` (ou réutilisez celles du dev en changeant le secret).

> **Important :** `PUBLIC_SUPABASE_URL` est injectée au **build** du front. Après modification, reconstruisez : `docker compose -f docker-compose.prod.yml --env-file .env.production up -d --build`.
> **Important :** `API_URL` est injectée au **build** du front. Après
> modification, reconstruisez : `npm run docker:prod:up`.

## 4. Lancer en production

Expand All @@ -72,14 +64,13 @@ cd /opt/swor
npm run docker:prod:up
```

Services :
Les migrations Laravel s'exécutent automatiquement au démarrage du conteneur API.

| Service | Port interne | Accès recommandé |
|---------|--------------|------------------|
| Front Next.js | 3000 (localhost) | Via Nginx → `swor.fr` |
| Supabase API (Kong) | 54321 | Via Nginx → `api.swor.fr` |
| Supabase Studio | 54323 | Bloquer en prod ou VPN uniquement |
| PostgreSQL | 54322 | Localhost / jamais exposé |
| Front Next.js | 127.0.0.1:3000 | Via Nginx → `swor.fr` |
| API Laravel | 127.0.0.1:8080 | Via Nginx → `api.swor.fr` |
| PostgreSQL | interne Docker | Jamais exposé |

## 5. Nginx (HTTPS)

Expand Down Expand Up @@ -109,19 +100,17 @@ sudo ufw allow 443
sudo ufw enable
```

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

## Dépannage

```bash
# Logs
docker compose -f docker-compose.prod.yml --env-file .env.production logs -f front
docker compose -f docker-compose.prod.yml --env-file .env.production logs -f api

# Rebuild complet
docker compose -f docker-compose.prod.yml --env-file .env.production up -d --build --force-recreate

# Reset BDD (destructif)
docker compose -f docker-compose.prod.yml --env-file .env.production down
rm -rf docker/supabase/volumes/db/data
docker compose -f docker-compose.prod.yml --env-file .env.production up -d
# Console Laravel dans le conteneur
docker exec -it swor-api php artisan tinker
```
Loading
Loading