|
|
@@ -280,8 +280,7 @@ cd vidreview
|
|
|
|
|
|
# 2. Configure environment
|
|
|
cp .env.example .env
|
|
|
-# Edit .env — at minimum set a strong JWT_SECRET:
|
|
|
-# JWT_SECRET=$(openssl rand -hex 32)
|
|
|
+# Edit .env with your production values (see Environment Variables below)
|
|
|
|
|
|
# 3. Start all services
|
|
|
sudo docker compose up -d
|
|
|
@@ -289,33 +288,33 @@ sudo docker compose up -d
|
|
|
# 4. Verify health
|
|
|
sudo docker compose ps
|
|
|
# All containers should show "healthy" or "Up"
|
|
|
-
|
|
|
-# 5. First-time DB schema push
|
|
|
-sudo docker exec vidreview-api npx prisma db push
|
|
|
```
|
|
|
|
|
|
-**Default credentials** (dev/demo):
|
|
|
-```
|
|
|
-Email: admin@vidreview.local
|
|
|
-Password: admin123
|
|
|
+On a **fresh deploy**, the `init` container runs automatically and creates an admin account.
|
|
|
+Credentials are saved to `/seed-output/admin-credentials.txt` inside the `seed_output` Docker volume.
|
|
|
+Read them with:
|
|
|
+```bash
|
|
|
+sudo docker compose run --rm --entrypoint "cat /seed-output/admin-credentials.txt" init
|
|
|
```
|
|
|
|
|
|
+On an **update deploy**, the init container skips admin creation silently.
|
|
|
+
|
|
|
### Production Deployment Checklist
|
|
|
|
|
|
-- [ ] Generate a strong `JWT_SECRET` (minimum 32 random bytes)
|
|
|
-- [ ] Set `NODE_ENV=production` on all services
|
|
|
-- [ ] Set `ALLOWED_ORIGINS` to your domain (e.g., `https://vidreview.example.com`)
|
|
|
-- [ ] Configure TLS/SSL (reverse proxy in front of `:3000`)
|
|
|
-- [ ] Increase `POLL_INTERVAL_MS` if worker CPU is high (default: 2000ms)
|
|
|
-- [ ] Set `MAX_FILE_SIZE_MB` based on storage capacity
|
|
|
-- [ ] Mount a persistent volume for `/app/uploads` (video files can be large)
|
|
|
+- [ ] Generate a strong `JWT_SECRET` (`openssl rand -hex 64`)
|
|
|
+- [ ] Set `ALLOWED_ORIGINS` to your domain
|
|
|
+- [ ] Set `FRONTEND_URL` to your public URL
|
|
|
+- [ ] Set a strong `POSTGRES_PASSWORD`
|
|
|
+- [ ] Optionally set `RESEND_API_KEY` to enable invite emails
|
|
|
+- [ ] Mount a persistent named volume for `uploads:/app/uploads`
|
|
|
- [ ] Set up automated backups for the PostgreSQL volume
|
|
|
- [ ] Prune old completed assets to free disk space
|
|
|
|
|
|
### Updating
|
|
|
|
|
|
```bash
|
|
|
-# Rebuild and restart
|
|
|
+# Pull latest code and rebuild
|
|
|
+git pull
|
|
|
sudo docker compose build
|
|
|
sudo docker compose up -d
|
|
|
```
|
|
|
@@ -325,6 +324,7 @@ sudo docker compose up -d
|
|
|
```bash
|
|
|
# All services
|
|
|
sudo docker compose logs -f
|
|
|
+sudo docker compose logs -f
|
|
|
|
|
|
# API only
|
|
|
sudo docker logs vidreview-api -f
|
|
|
@@ -415,15 +415,25 @@ npm run dev:frontend
|
|
|
|
|
|
## Environment Variables
|
|
|
|
|
|
-| Variable | Default | Description |
|
|
|
+> All secrets are read from `.env` — **never hardcoded in `docker-compose.yml`**.
|
|
|
+> Copy `.env.example` → `.env` and fill in your values before deploying.
|
|
|
+
|
|
|
+| Variable | Required | Description |
|
|
|
|---|---|---|
|
|
|
-| `DATABASE_URL` | `postgresql://vidreview:vidreview123@localhost:5432/vidreview` | PostgreSQL connection string |
|
|
|
-| `JWT_SECRET` | `change-me` | JWT signing secret (**change in production**) |
|
|
|
-| `JWT_EXPIRES_IN` | `7d` | JWT token expiry |
|
|
|
-| `API_PORT` | `3001` | API server port |
|
|
|
-| `NODE_ENV` | `development` | `development` or `production` |
|
|
|
-| `UPLOAD_DIR` | `./uploads` | Local upload directory (API container) |
|
|
|
-| `MAX_FILE_SIZE_MB` | `500` | Max upload file size in MB |
|
|
|
-| `ALLOWED_ORIGINS` | `*` | CORS allowed origins (comma-separated) |
|
|
|
-| `NEXT_PUBLIC_API_URL` | `http://localhost:3001` | API base URL for frontend |
|
|
|
-| `POLL_INTERVAL_MS` | `2000` | Worker poll interval in milliseconds |
|
|
|
+| `POSTGRES_USER` | Yes | PostgreSQL username |
|
|
|
+| `POSTGRES_PASSWORD` | Yes | PostgreSQL password |
|
|
|
+| `POSTGRES_DB` | Yes | PostgreSQL database name |
|
|
|
+| `DATABASE_URL` | Yes | Full PostgreSQL connection string |
|
|
|
+| `JWT_SECRET` | Yes | JWT signing secret — **generate with `openssl rand -hex 64`** |
|
|
|
+| `JWT_EXPIRES_IN` | No | JWT expiry (default: `7d`) |
|
|
|
+| `API_PORT` | No | API server port (default: `3001`) |
|
|
|
+| `NODE_ENV` | No | `production` or `development` (default: `production`) |
|
|
|
+| `UPLOAD_DIR` | No | Upload directory in API container (default: `/app/uploads`) |
|
|
|
+| `MAX_FILE_SIZE_MB` | No | Max upload file size in MB (default: `500`) |
|
|
|
+| `ALLOWED_ORIGINS` | No | Comma-separated CORS origins (default: empty = block all) |
|
|
|
+| `FRONTEND_URL` | No | Public URL of the frontend |
|
|
|
+| `NEXT_PUBLIC_API_URL` | No | API base URL for frontend (default: `https://vid.k9tech.space/api`) |
|
|
|
+| `RESEND_API_KEY` | No | Resend API key for invite emails (optional, leave blank to disable) |
|
|
|
+| `ADMIN_EMAIL` | No | Admin account email on fresh deploy (default: `admin@vidreview.local`) |
|
|
|
+| `ADMIN_NAME` | No | Admin account display name (default: `Admin`) |
|
|
|
+| `POLL_INTERVAL_MS` | No | Worker poll interval in ms (default: `2000`) |
|