From 72c23f8bba0645ff85a8df5de8cc81c2acdded57 Mon Sep 17 00:00:00 2001 From: Chandler Copeland Date: Fri, 3 Apr 2026 16:56:43 -0600 Subject: [PATCH] feat(17-02): DEPLOYMENT.md with env setup, migration from host, docker compose up, health check - 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 --- teressa-copeland-homes/DEPLOYMENT.md | 63 ++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 teressa-copeland-homes/DEPLOYMENT.md diff --git a/teressa-copeland-homes/DEPLOYMENT.md b/teressa-copeland-homes/DEPLOYMENT.md new file mode 100644 index 0000000..4510da3 --- /dev/null +++ b/teressa-copeland-homes/DEPLOYMENT.md @@ -0,0 +1,63 @@ +# 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= 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= npx drizzle-kit migrate +docker compose up -d --build +```