61 lines
1.9 KiB
Markdown
61 lines
1.9 KiB
Markdown
# Compagnie AspiRêves
|
|
|
|
Site web de la Compagnie AspiRêves, compagnie de spectacle vivant basée dans le Tarn.
|
|
|
|
Construit avec [Astro](https://astro.build/) et [StoryBlok](https://www.storyblok.com/) comme CMS headless.
|
|
|
|
## Prérequis
|
|
|
|
- Node.js >= 20
|
|
- Un fichier `.env` (voir `.env.example`)
|
|
|
|
## Développement
|
|
|
|
```bash
|
|
npm install
|
|
npm run dev
|
|
```
|
|
|
|
Le serveur démarre sur `http://localhost:3030`.
|
|
|
|
## Builds
|
|
|
|
Le projet supporte deux modes de build via la variable `PUBLIC_STORYBLOK_IS_PREVIEW` :
|
|
|
|
### Production (SSG)
|
|
|
|
Site statique, performant, sans serveur Node.js. Utilise le **Public Access Token** StoryBlok et ne récupère que le contenu **publié**.
|
|
|
|
```bash
|
|
npm run build
|
|
```
|
|
|
|
Génère des fichiers HTML statiques dans `dist/`. Le rebuild doit être déclenché par un **webhook StoryBlok** (Settings > Webhooks) à chaque publication de contenu.
|
|
|
|
### Preview (SSR)
|
|
|
|
Serveur Node.js avec le **visual editor StoryBlok** (bridge + live preview). Utilise le **Preview Access Token** et récupère le contenu en **draft**.
|
|
|
|
```bash
|
|
PUBLIC_STORYBLOK_IS_PREVIEW=true npm run build
|
|
HOST=0.0.0.0 node dist/server/entry.mjs
|
|
```
|
|
|
|
Le serveur démarre sur le port `8080` par défaut (configurable via `PORT`).
|
|
|
|
### Variables d'environnement
|
|
|
|
| Variable | Production | Preview |
|
|
|---|---|---|
|
|
| `PUBLIC_STORYBLOK_TOKEN` | Public Access Token | Preview Access Token |
|
|
| `PUBLIC_STORYBLOK_IS_PREVIEW` | *(non défini)* | `true` |
|
|
| `STORYBLOK_WEBHOOK_SECRET` | - | Secret du webhook StoryBlok |
|
|
| `CLEVER_TOKEN` | - | Token OAuth Clever Cloud |
|
|
| `CLEVER_APP_ID_PRODUCTION` | - | ID de l'app production (app_xxx) |
|
|
| `CC_POST_BUILD_HOOK` | `npm run build` | `npm run build` |
|
|
| `HOST` | - | `0.0.0.0` |
|
|
|
|
### Configuration StoryBlok
|
|
|
|
- **Settings > Visual Editor** : mettre l'URL de l'instance preview comme environnement par défaut
|
|
- **Settings > Webhooks** : configurer un webhook `POST` vers `https://<preview-instance>/api/rebuild` pour déclencher le rebuild production à chaque publication
|