64 lines
1.5 KiB
Markdown
64 lines
1.5 KiB
Markdown
|
|
# Deployment Guide
|
||
|
|
|
||
|
|
## Prerequisites
|
||
|
|
|
||
|
|
- Git installed on the server
|
||
|
|
- Docker and Docker Compose installed on the server
|
||
|
|
|
||
|
|
## Step 1: Configure environment
|
||
|
|
|
||
|
|
Copy the example env file and fill in real values:
|
||
|
|
|
||
|
|
```bash
|
||
|
|
cp .env.production.example .env.production
|
||
|
|
```
|
||
|
|
|
||
|
|
Edit `.env.production` and set all 11 variables:
|
||
|
|
|
||
|
|
- `DATABASE_URL` — Neon PostgreSQL connection string
|
||
|
|
- `SIGNING_JWT_SECRET` — secret for signing JWT tokens
|
||
|
|
- `AUTH_SECRET` — NextAuth secret
|
||
|
|
- `AGENT_EMAIL` — agent login email
|
||
|
|
- `AGENT_PASSWORD` — agent login password
|
||
|
|
- `CONTACT_EMAIL_USER` — SMTP username
|
||
|
|
- `CONTACT_EMAIL_PASS` — SMTP password
|
||
|
|
- `CONTACT_SMTP_HOST` — SMTP host (e.g. `smtp.gmail.com`)
|
||
|
|
- `CONTACT_SMTP_PORT` — SMTP port (e.g. `465`)
|
||
|
|
- `OPENAI_API_KEY` — OpenAI API key for AI field placement
|
||
|
|
- `APP_BASE_URL` — public URL of the app (e.g. `https://teressacopelandhomes.com`)
|
||
|
|
|
||
|
|
## Step 2: Run database migration
|
||
|
|
|
||
|
|
Run migrations from the project directory on the host (not inside Docker):
|
||
|
|
|
||
|
|
```bash
|
||
|
|
DATABASE_URL=<your-neon-url> npx drizzle-kit migrate
|
||
|
|
```
|
||
|
|
|
||
|
|
This must complete successfully before starting the container. Migrations are never run inside the Docker image.
|
||
|
|
|
||
|
|
## Step 3: Build and start
|
||
|
|
|
||
|
|
```bash
|
||
|
|
docker compose up -d --build
|
||
|
|
```
|
||
|
|
|
||
|
|
## Step 4: Verify
|
||
|
|
|
||
|
|
```bash
|
||
|
|
curl http://localhost:3000/api/health
|
||
|
|
```
|
||
|
|
|
||
|
|
Expected response: `{"ok":true,"db":"connected"}`
|
||
|
|
|
||
|
|
## Updating
|
||
|
|
|
||
|
|
To deploy a new version:
|
||
|
|
|
||
|
|
```bash
|
||
|
|
git pull
|
||
|
|
# If schema changed, re-run migration first:
|
||
|
|
DATABASE_URL=<your-neon-url> npx drizzle-kit migrate
|
||
|
|
docker compose up -d --build
|
||
|
|
```
|