- Step-by-step guide: configure .env.production, run drizzle-kit migrate from host - docker compose up -d --build to build and start - curl /api/health verification step - Update workflow: git pull, optional migration, compose up --build
1.5 KiB
1.5 KiB
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:
cp .env.production.example .env.production
Edit .env.production and set all 11 variables:
DATABASE_URL— Neon PostgreSQL connection stringSIGNING_JWT_SECRET— secret for signing JWT tokensAUTH_SECRET— NextAuth secretAGENT_EMAIL— agent login emailAGENT_PASSWORD— agent login passwordCONTACT_EMAIL_USER— SMTP usernameCONTACT_EMAIL_PASS— SMTP passwordCONTACT_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 placementAPP_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):
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
docker compose up -d --build
Step 4: Verify
curl http://localhost:3000/api/health
Expected response: {"ok":true,"db":"connected"}
Updating
To deploy a new version:
git pull
# If schema changed, re-run migration first:
DATABASE_URL=<your-neon-url> npx drizzle-kit migrate
docker compose up -d --build