version: '3'

services:
  memcache:
    image: memcached:1.5.4-alpine
    restart: unless-stopped
    command: memcached -m 512

  web:
    image: registry.elbert.us/parsley:production
    command: web
    restart: unless-stopped
    networks:
      - default
      - traefik
    labels:
      traefik.enable: "true"
      traefik.http.routers.parsley.rule: "Host(`parsley.elbert.us`)"
      traefik.http.routers.parsley.entrypoints: websecure
      traefik.http.routers.parsley.tls: "true"
      traefik.http.routers.parsley.tls.certResolver: cert-resolver

  app:
    image: registry.elbert.us/parsley:production
    command: app
    restart: unless-stopped
    environment:
      - PORT=80
      - RAILS_USE_MEMCACHE=true
      - RAILS_LOG_TO_STDOUT=true
      - RAILS_ENV=production
      - SECRET_KEY_BASE=${SECRET_KEY_BASE}
      - PARSLEY_DB_HOST=${PARSLEY_DB_HOST}
      - PARSLEY_DB_USER=${PARSLEY_DB_USER}
      - PARSLEY_DB_PASSWORD=${PARSLEY_DB_PASSWORD}
      - PARSLEY_DB_NAME=${PARSLEY_DB_NAME}
      - PARSLEY_PG_PASSWORD=${PARSLEY_PG_PASSWORD}
    networks:
      - default
      - db

networks:
  traefik:
    external: true
  db:
    external: true
