Files
monica_site/docker-compose.yml
T
westfarn e8611ef926
Deploy Beta / unit-tests (push) Successful in 16s
Deploy Beta / docker (push) Successful in 20s
Deploy Beta / deploy-beta (push) Successful in 3m11s
Social composer: send now and rename messy account names (#6)
## Summary
Closes #5.
- Composer can **Send now** without a schedule time (Schedule and Save draft still available)
- Account names wrap and show the platform id so a bad OAuth label is still readable
- Social accounts page can rename the display name; re-auth keeps a custom name instead of overwriting it with a placeholder
- Worker polls `dispatch_due` every 15s so scheduled campaigns and social posts fire without a manual command; local `docker compose up` now starts the worker

## Test plan
- [ ] Open Social → Compose: confirm **Send now**, **Schedule**, and **Save draft** buttons (no combined Save / publish)
- [ ] Send now with a connected account and caption → post queues immediately, no datetime required
- [ ] Schedule with a datetime → post is scheduled; Schedule with a blank time → validation error
- [ ] Composer account list shows full name plus external id, wrapping if the name is long
- [ ] Social accounts → rename a messy label → new name shows in composer without reconnecting
- [ ] Re-authorize an account that was renamed → custom name is kept
- [ ] Rebuild and start compose (`docker compose up --build`) so the **worker** service is running
- [ ] Schedule a social post ~2 minutes ahead → after due time, worker logs `Enqueued N due item(s).` and the post leaves Scheduled (published or failed)
- [ ] `docker compose logs -f worker` shows `Polling due scheduled work every 15s.`

Reviewed-on: #6
2026-08-24 09:47:58 -07:00

111 lines
4.6 KiB
YAML

services:
db:
image: postgres:16-alpine
environment:
POSTGRES_DB: monica_site
POSTGRES_USER: monica_site
POSTGRES_PASSWORD: monica_site
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U monica_site -d monica_site"]
interval: 5s
timeout: 5s
retries: 10
start_period: 10s
web:
build: .
ports:
- "8000:8000"
# Bind-mount source so edit → runserver auto-reload (no rebuild).
volumes:
- ./site:/app/site
# No required env_file — CI has no .env. Defaults below; for local secrets:
# docker compose --env-file .env up
#
# Do NOT interpolate ${DATABASE_URL} here. On the Act runner / control node that
# var often points at shared prod/beta Postgres; compose would bake it into
# containerized tests. Use COMPOSE_DATABASE_URL only if you need to override.
environment:
DJANGO_ENV: ${DJANGO_ENV:-dev}
DJANGO_SECRET_KEY: ${DJANGO_SECRET_KEY:-dev-only-change-me}
DJANGO_DEBUG: ${DJANGO_DEBUG:-true}
DJANGO_ALLOWED_HOSTS: ${DJANGO_ALLOWED_HOSTS:-localhost,127.0.0.1,0.0.0.0}
DATABASE_URL: ${COMPOSE_DATABASE_URL:-postgres://monica_site:monica_site@db:5432/monica_site}
SITE_UNDER_CONSTRUCTION: ${SITE_UNDER_CONSTRUCTION:-false}
PUBLIC_SITE_URL: ${PUBLIC_SITE_URL:-http://127.0.0.1:8000}
EMAIL_HOST: ${EMAIL_HOST:-mail.smtp2go.com}
EMAIL_HOST_USER: ${EMAIL_HOST_USER:-}
EMAIL_HOST_PASSWORD: ${EMAIL_HOST_PASSWORD:-}
EMAIL_PORT: ${EMAIL_PORT:-2525}
EMAIL_USE_TLS: ${EMAIL_USE_TLS:-true}
DEFAULT_FROM_EMAIL: ${DEFAULT_FROM_EMAIL:-noreply@mkdrealtor.com}
# Dev default = console. Set smtp backend in `.env` for real SMTP2GO sends.
EMAIL_BACKEND: ${EMAIL_BACKEND:-django.core.mail.backends.console.EmailBackend}
SMTP2GO_SMS_API_KEY: ${SMTP2GO_SMS_API_KEY:-}
SMTP2GO_WEBHOOK_SECRET: ${SMTP2GO_WEBHOOK_SECRET:-}
POSTCARD_PROVIDER: ${POSTCARD_PROVIDER:-pcm}
PCM_API_KEY: ${PCM_API_KEY:-}
PCM_API_SECRET: ${PCM_API_SECRET:-}
PCM_CHILD_REF_NBR: ${PCM_CHILD_REF_NBR:-}
PCM_WEBHOOK_SECRETS: ${PCM_WEBHOOK_SECRETS:-}
PCM_WEBHOOK_SECRET: ${PCM_WEBHOOK_SECRET:-}
# Quote JSON in `.env`: PCM_RETURN_ADDRESS='{"firstName":"…",...}'
PCM_RETURN_ADDRESS: ${PCM_RETURN_ADDRESS:-}
PCM_RETURN_LINE1: ${PCM_RETURN_LINE1:-}
PCM_RETURN_LINE2: ${PCM_RETURN_LINE2:-}
PCM_RETURN_CITY: ${PCM_RETURN_CITY:-}
PCM_RETURN_STATE: ${PCM_RETURN_STATE:-}
PCM_RETURN_ZIP: ${PCM_RETURN_ZIP:-}
META_APP_ID: ${META_APP_ID:-}
META_APP_SECRET: ${META_APP_SECRET:-}
SOCIAL_TOKEN_ENCRYPTION_KEY: ${SOCIAL_TOKEN_ENCRYPTION_KEY:-}
depends_on:
db:
condition: service_healthy
worker:
build: .
entrypoint: ["/worker-entrypoint.sh"]
volumes:
- ./site:/app/site
environment:
DJANGO_ENV: ${DJANGO_ENV:-dev}
DJANGO_SECRET_KEY: ${DJANGO_SECRET_KEY:-dev-only-change-me}
DJANGO_DEBUG: ${DJANGO_DEBUG:-true}
DJANGO_ALLOWED_HOSTS: ${DJANGO_ALLOWED_HOSTS:-localhost,127.0.0.1,0.0.0.0}
DATABASE_URL: ${COMPOSE_DATABASE_URL:-postgres://monica_site:monica_site@db:5432/monica_site}
PUBLIC_SITE_URL: ${PUBLIC_SITE_URL:-http://127.0.0.1:8000}
DISPATCH_DUE_INTERVAL_SECONDS: ${DISPATCH_DUE_INTERVAL_SECONDS:-15}
EMAIL_HOST: ${EMAIL_HOST:-mail.smtp2go.com}
EMAIL_HOST_USER: ${EMAIL_HOST_USER:-}
EMAIL_HOST_PASSWORD: ${EMAIL_HOST_PASSWORD:-}
EMAIL_PORT: ${EMAIL_PORT:-2525}
EMAIL_USE_TLS: ${EMAIL_USE_TLS:-true}
DEFAULT_FROM_EMAIL: ${DEFAULT_FROM_EMAIL:-noreply@mkdrealtor.com}
EMAIL_BACKEND: ${EMAIL_BACKEND:-django.core.mail.backends.console.EmailBackend}
SMTP2GO_SMS_API_KEY: ${SMTP2GO_SMS_API_KEY:-}
SMTP2GO_WEBHOOK_SECRET: ${SMTP2GO_WEBHOOK_SECRET:-}
POSTCARD_PROVIDER: ${POSTCARD_PROVIDER:-pcm}
PCM_API_KEY: ${PCM_API_KEY:-}
PCM_API_SECRET: ${PCM_API_SECRET:-}
PCM_CHILD_REF_NBR: ${PCM_CHILD_REF_NBR:-}
PCM_WEBHOOK_SECRETS: ${PCM_WEBHOOK_SECRETS:-}
PCM_WEBHOOK_SECRET: ${PCM_WEBHOOK_SECRET:-}
PCM_RETURN_ADDRESS: ${PCM_RETURN_ADDRESS:-}
PCM_RETURN_LINE1: ${PCM_RETURN_LINE1:-}
PCM_RETURN_LINE2: ${PCM_RETURN_LINE2:-}
PCM_RETURN_CITY: ${PCM_RETURN_CITY:-}
PCM_RETURN_STATE: ${PCM_RETURN_STATE:-}
PCM_RETURN_ZIP: ${PCM_RETURN_ZIP:-}
META_APP_ID: ${META_APP_ID:-}
META_APP_SECRET: ${META_APP_SECRET:-}
SOCIAL_TOKEN_ENCRYPTION_KEY: ${SOCIAL_TOKEN_ENCRYPTION_KEY:-}
depends_on:
db:
condition: service_healthy
volumes:
postgres_data: