From dda9b515e13e389a895cea6d84ceff4fa180a4f8 Mon Sep 17 00:00:00 2001 From: Alex Polo Date: Wed, 29 Oct 2025 10:31:25 +0100 Subject: [PATCH] docs: add deployment, migration and image generation instructions to README; ignore dist/generated images --- README.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/README.md b/README.md index d86b122..a4259bc 100644 --- a/README.md +++ b/README.md @@ -45,3 +45,38 @@ En moderne hjemmeside for catering og private dining services. Bygget med Next.j - `/src/config/*` - Konfiguration og sample data - `/src/lib/*` - Utility functions - `/src/types/*` - TypeScript type definitioner + +## Deployment & database + +Environment variables are required and must be set in a local `.env` file (do NOT commit it). + +Required env vars (see `.env.example`): + +- `OPENAI_KEY` - OpenAI API key used by image generation (optional) +- `DB_HOST`, `DB_USER`, `DB_PASSWORD`, `DB_NAME` - MariaDB connection +- `ADMIN_USER`, `ADMIN_PASSWORD` - basic-auth for admin area + +Run database migrations (builds helper scripts then runs migration): + +```bash +npm run migrate +``` + +Build and start the production server: + +```bash +npm run build +node server.mjs +``` + +Generate images (script will skip images that already exist and uses `scripts/image-cache.json`): + +```bash +node scripts/generate-images.mjs +``` + +Notes: +- The repo ignores `.env*` files. Keep secrets in `.env` or your deployment environment. +- Generated images can be large; a small number of generated images were removed from git and the project ignores `public/img/generated/`. If you want generated images checked into the repo, move them into `public/img/` and commit explicitly. +- For production process management the project includes PM2 scripts in `package.json` (see `pm2:*` scripts). +