Skip to content

🐞 - Startup freezes #231

@selfagency

Description

@selfagency

What happened?

Hi, I got everything working right last night but today, after configuring the STMP service, the app won't load.

It freezes at "Creating marketing queue for region" and never becomes healthy. When I SSH into the Docker container localhost:3000 is not reachable although Next.js is running.

2025-09-15T20:15:36.364411532Z + echo 'Deploying prisma migrations'
2025-09-15T20:15:36.364434675Z Deploying prisma migrations
2025-09-15T20:15:36.364527837Z + pnpx prisma migrate deploy --schema ./apps/web/prisma/schema.prisma
2025-09-15T20:15:38.762400511Z Progress: resolved 1, reused 0, downloaded 0, added 0
2025-09-15T20:15:39.764658284Z Progress: resolved 13, reused 0, downloaded 5, added 0
2025-09-15T20:15:40.817223589Z Progress: resolved 32, reused 0, downloaded 30, added 0
2025-09-15T20:15:41.134325966Z Packages: +33
2025-09-15T20:15:41.134354741Z +++++++++++++++++++++++++++++++++
2025-09-15T20:15:41.423120340Z Progress: resolved 33, reused 0, downloaded 33, added 33, done
2025-09-15T20:15:41.496511046Z .../node_modules/@prisma/engines postinstall$ node scripts/postinstall.js
2025-09-15T20:15:42.487066529Z .../node_modules/@prisma/engines postinstall: Done
2025-09-15T20:15:42.627217101Z .../[email protected]/node_modules/prisma preinstall$ node scripts/preinstall-entry.js
2025-09-15T20:15:42.693312736Z .../[email protected]/node_modules/prisma preinstall: Done
2025-09-15T20:15:44.736562101Z Prisma schema loaded from apps/web/prisma/schema.prisma
2025-09-15T20:15:44.742741135Z Datasource "db": PostgreSQL database "usesend", schema "public" at "postgres:5432"
2025-09-15T20:15:44.879665511Z 
2025-09-15T20:15:44.879692488Z 32 migrations found in prisma/migrations
2025-09-15T20:15:44.879694563Z 
2025-09-15T20:15:44.970432618Z 
2025-09-15T20:15:44.970461029Z No pending migrations to apply.
2025-09-15T20:15:45.191326116Z Starting web server
2025-09-15T20:15:45.191354058Z + echo 'Starting web server'
2025-09-15T20:15:45.191376995Z + node apps/web/server.js
2025-09-15T20:15:45.590600991Z    ▲ Next.js 15.3.1
2025-09-15T20:15:45.590891001Z    - Local:        http://localhost:3000
2025-09-15T20:15:45.590905338Z    - Network:      http://0.0.0.0:3000
2025-09-15T20:15:45.591001897Z 
2025-09-15T20:15:45.591041293Z  ✓ Starting...
2025-09-15T20:15:45.703552112Z Registering instrumentation
2025-09-15T20:15:45.915911331Z {"level":30,"time":1757967345915,"service":"next-app","msg":"Creating Prisma client"}
2025-09-15T20:15:46.041944366Z  ✓ Ready in 815ms
2025-09-15T20:15:47.263869414Z {"level":30,"time":1757967347263,"service":"next-app","region":"us-east-1","msg":"[EmailQueueService]: Initializing queue for region"}
2025-09-15T20:15:47.270554429Z {"level":30,"time":1757967347263,"service":"next-app","region":"us-east-1","transactionalQuota":1,"msg":"[EmailQueueService]: Creating transactional queue for region"}
2025-09-15T20:15:47.270573914Z {"level":30,"time":1757967347266,"service":"next-app","region":"us-east-1","marketingQuota":13,"msg":"[EmailQueueService]: Creating marketing queue for region"}

Replication Steps

services:
  postgres:
    image: 'postgres:16'
    environment:
      - 'POSTGRES_USER=${SERVICE_USER_POSTGRES}'
      - 'POSTGRES_PASSWORD=${SERVICE_PASSWORD_POSTGRES}'
      - 'POSTGRES_DB=${SERVICE_DB_POSTGRES:-usesend}'
    healthcheck:
      test:
        - CMD-SHELL
        - 'pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}'
      interval: 5s
      timeout: 20s
      retries: 10
    volumes:
      - 'usesend-postgres-data:/var/lib/postgresql/data'
  redis:
    image: 'docker.dragonflydb.io/dragonflydb/dragonfly:latest'
    volumes:
      - 'usesend-redis-data:/data'
    command:
      - redis-server
      - '--maxmemory-policy'
      - noeviction
    healthcheck:
      test:
        - CMD
        - redis-cli
        - PING
      interval: 5s
      timeout: 10s
      retries: 20
  certbot:
    image: serversideup/certbot-dns-cloudflare
    environment:
      CLOUDFLARE_API_TOKEN: "${CLOUDFLARE_API_TOKEN}"
      CERTBOT_EMAIL: "${CERTBOT_EMAIL}"
      CERTBOT_DOMAINS: "${CERTBOT_DOMAINS}"
    volumes:
      - /data/coolify/ssl:/etc/letsencrypt
    restart: unless-stopped
  usesend:
    image: 'usesend/usesend:latest'
    expose:
      - 3000
    environment:
      - SERVICE_URL_USESEND_3000
      - 'DATABASE_URL=postgresql://${SERVICE_USER_POSTGRES}:${SERVICE_PASSWORD_POSTGRES}@postgres:5432/${SERVICE_DB_POSTGRES:-USESEND}'
      - 'NEXTAUTH_URL=${SERVICE_URL_USESEND}'
      - 'NEXTAUTH_SECRET=${SERVICE_BASE64_64_NEXTAUTHSECRET}'
      - 'AWS_ACCESS_KEY=${AWS_ACCESS_KEY:?}'
      - 'AWS_SECRET_KEY=${AWS_SECRET_KEY:?}'
      - 'AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION:?}'
      - 'GITHUB_ID=${GITHUB_ID}'
      - 'GITHUB_SECRET=${GITHUB_SECRET}'
      - 'REDIS_URL=redis://redis:6379'
      - 'NEXT_PUBLIC_IS_CLOUD=${NEXT_PUBLIC_IS_CLOUD:-false}'
      - 'API_RATE_LIMIT=${API_RATE_LIMIT:-1}'
      - 'HOSTNAME=0.0.0.0'
      - 'SMTP_AUTH_USERNAME=${SMTP_AUTH_USERNAME}''
    depends_on:
      postgres:
        condition: service_healthy
      redis:
        condition: service_healthy
      smtp:
        condition: service_health
    healthcheck:
      test:
        - CMD-SHELL
        - 'wget -qO- http://localhost:3000 || exit 1'
      interval: 5s
      retries: 10
      timeout: 2s
  smtp:
    container_name: usesend-smtp-server
    image: usesend/smtp-proxy:latest
    depends_on:
      certbot:
        condition: service_healthy
    environment:
      SMTP_AUTH_USERNAME: "${SMTP_AUTH_USERNAME}" 
      USESEND_BASE_URL: "https://send.freedom.engineering" 
      USESEND_API_KEY_PATH: "/certs/server.key"
      USESEND_API_CERT_PATH: "/certs/server.crt"
    volumes:
      - /data/coolify/ssl/live/freedom.engineering/privkey.pem:/certs/server.key:ro
      - /data/coolify/ssl/live/freedom.engineering/cert.pem:/certs/server.crt:ro
    ports:
      - "25:25" # Standard SMTP
      - "587:587" # SMTP with STARTTLS
      - "2587:2587" # Alternative SMTP port
      - "465:465" # SMTP over SSL/TLS
      - "2465:2465" # Alternative SMTPS port
    restart: unless-stopped
    labels:
      - traefik.enable=true
      - traefik.tcp.routers.smtps.rule=HostSNI(`send.freedom.engineering`)
      - traefik.tcp.routers.smtps.entrypoints=smtps
      - traefik.tcp.routers.smtps.service=smtps
      - traefik.tcp.services.smtps.loadbalancer.server.port=465
      - traefik.tcp.routers.submission.rule=HostSNI(`send.freedom.engineering`)
      - traefik.tcp.routers.submission.entrypoints=submission
      - traefik.tcp.routers.submission.service=submission
      - traefik.tcp.services.submission.loadbalancer.server.port=587

Self hosted or Cloud?

Self hosted

What browsers are you seeing the problem on?

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions