version: '3.7'

services:
  socioboard:
    image: sintelli/socioboard:latest
    container_name: socioboard
    depends_on:
      - socioboard-mysql
      - socioboard-mongo
    environment:
      BASE_DOMAIN: ${BASE_DOMAIN}
      HTTP_PORT: ${HTTP_PORT}
      HTTPS_PORT: ${HTTPS_PORT}
      AUTH_SECRET: ${AUTH_SECRET}
      AUTH_TOKEN_SECRET: ${AUTH_TOKEN_SECRET}
      SQL_DB_NAME: ${SQL_DB_NAME}
      SQL_DB_USER: ${SQL_DB_USER}
      SQL_DB_PASS: ${SQL_DB_PASS}
      SQL_DB_ROOT_PASS: ${SQL_DB_ROOT_PASS}
      MONGO_DB_NAME: ${MONGO_DB_NAME}
      MONGO_USER: ${MONGO_USER}
      MONGO_PASS: ${MONGO_PASS}
      LARAVEL_KEY: ${LARAVEL_KEY}
      FACEBOOK_API_APP_ID: ${FACEBOOK_API_APP_ID}
      FACEBOOK_API_APP_SECRET: ${FACEBOOK_API_APP_SECRET}
      GOOGLE_API_ID: ${GOOGLE_API_ID}
      GOOGLE_API_SECRET: ${GOOGLE_API_SECRET}
      GOOGLE_API_KEY: ${GOOGLE_API_KEY}
      GITHUB_API_ID: ${GITHUB_API_ID}
      GITHUB_API_SECRET: ${GITHUB_API_SECRET}
      TWITTER_API_KEY: ${TWITTER_API_KEY}
      TWITTER_API_SECRET: ${TWITTER_API_SECRET}
      TWITTER_API_APP_NAME: ${TWITTER_API_APP_NAME}
      LINKEDIN_API_ID: ${LINKEDIN_API_ID}
      LINKEDIN_API_SECRET: ${LINKEDIN_API_SECRET}
      IG_API_ID: ${IG_API_ID}
      IG_API_SECRET: ${IG_API_SECRET}
      IG_BUSINESS_API_ID: ${IG_BUSINESS_API_ID}
      IG_BUSINESS_API_SECRET: ${IG_BUSINESS_API_SECRET}
      PINTEREST_API_ID: ${PINTEREST_API_ID}
      PINTEREST_API_SECRET: ${PINTEREST_API_SECRET}
      BITLY_API_ID: ${BITLY_API_ID}
      BITLY_API_SECRET: ${BITLY_API_SECRET}
      BITLY_REDIRECT_URI: ${BITLY_REDIRECT_URI}
      BITLY_ACCESS_TOKEN: ${BITLY_ACCESS_TOKEN}
      TINY_LINK_API_KEY: ${TINY_LINK_API_KEY}
      TUMBLR_API_KEY: ${TUMBLR_API_KEY}
      TUMBLR_API_SECRET: ${TUMBLR_API_SECRET}
      JEST_ACCESS_TOKEN: ${JEST_ACCESS_TOKEN}
      MAIL_HANDLER: ${MAIL_HANDLER}
      SENDGRID_USERNAME: ${SENDGRID_USERNAME}
      SENDGRID_PASSWORD: ${SENDGRID_PASSWORD}
      SENDGRID_FROM_MAIL: ${SENDGRID_FROM_MAIL}
      SENDGRID_CC_ADDR: ${SENDGRID_CC_ADDR}
      SENDGRID_API_KEY: ${SENDGRID_API_KEY}
      GOOGLE_EMAIL: ${GOOGLE_EMAIL}
      GOOGLE_EMAIL_PASSWORD: ${GOOGLE_EMAIL_PASSWORD}
      SOCIOBOARD_TWITTER_HANDLER: ${SOCIOBOARD_TWITTER_HANDLER}
      AMEMBER_ENABLED: ${AMEMBER_ENABLED}
      AMEMBER_KEY: ${AMEMBER_KEY}
      AMEMBER_DOMAIN: ${AMEMBER_DOMAIN}
      TWILIO_ACC_SID: ${TWILIO_ACC_SID}
      TWILIO_AUTH_KEY: ${TWILIO_AUTH_KEY}
      TWILIO_SERVICE_ID: ${TWILIO_SERVICE_ID}
      ADMIN_PANEL_ENABLED: ${ADMIN_PANEL_ENABLED}
      ADMIN_EMAIL: ${ADMIN_EMAIL}
      ADMIN_PASSWORD: ${ADMIN_PASSWORD}
      ADMIN_SESSION_NAME: ${ADMIN_SESSION_NAME}
      ADMIN_SESSION_KEY: ${ADMIN_SESSION_KEY}
      SESSION_NAME: ${API_SESSION_NAME}
      SESSION_KEY_1: ${API_SESSION_KEY_1}
      SESSION_KEY_2: ${API_SESSION_KEY_2}
      NODE_ENV: "production"
    volumes:
      - ./data/api:/data
      - ./nginx/ssl:/ssl
    security_opt:
      - no-new-privileges:true
    restart: always
    networks:
      - scb-net
  socioboard-web:
    image: sintelli/socioboard-web:latest
    container_name: socioboard-web
    depends_on:
      - socioboard
    environment:
      BASE_DOMAIN: ${BASE_DOMAIN}
      HTTPS_PORT: ${HTTPS_PORT}
      LARAVEL_KEY: ${LARAVEL_KEY}
    restart: always
    networks:
      - scb-net
  socioboard-mysql:
    image: library/mysql:latest
    container_name: socioboard-mysql
    environment:
      MYSQL_DATABASE: ${SQL_DB_NAME}
      MYSQL_USER: ${SQL_DB_USER}
      MYSQL_PASSWORD: ${SQL_DB_PASS}
      MYSQL_ROOT_PASSWORD: ${SQL_DB_ROOT_PASS}
    restart: always
    volumes:
      - scb-mysql:/var/lib/mysql
      - ./perma-act-users.sql:/perma-act-users.sql
    networks:
      - scb-net
  socioboard-mongo:
    image: mongo:latest
    container_name: socioboard-mongo
    environment:
      MONGO_INITDB_DATABASE: ${MONGO_DB_NAME}
      MONGO_INITDB_ROOT_USERNAME: ${MONGO_USER}
      MONGO_INITDB_ROOT_PASSWORD: ${MONGO_PASS}
    volumes:
      - ./init-mongo.js:/docker-entrypoint-initdb.d/init-mongo.js:ro
      - scb-mongo:/data/db
    restart: always
    networks:
      - scb-net
  socioboard-nginx:
    image: nginx:latest
    container_name: socioboard-nginx
    depends_on:
      - socioboard
      - socioboard-mysql
      - socioboard-mongo
    ports:
      - "${HTTP_PORT}:${HTTP_PORT}"
      - "${HTTPS_PORT}:${HTTPS_PORT}"
    environment:
      BASE_DOMAIN: ${BASE_DOMAIN}
      HTTP_PORT: ${HTTP_PORT}
      HTTPS_PORT: ${HTTPS_PORT}
    volumes:
      - ./nginx/nginx.conf:/etc/nginx/nginx.conf
      - ./nginx/nginx-socioboard.conf:/etc/nginx/templates/socioboard.conf.template
      - ./nginx/ssl:/ssl
    restart: always
    networks:
      - scb-net
volumes:
  scb-mongo: {}
  scb-mysql: {}
networks:
  scb-net:
    driver: bridge
