# This docker-compose file is just here for testing
version: "3.4"

services:

  ########################################################
  # WEBAPP ###############################################
  ########################################################
  webapp:
    # name the image to match our image to be tested from our DockerHub repository so that it can be pulled from there, otherwise it will be created locally from the 'dockerfile'
    image: ocelotsocialnetwork/webapp-branded:latest
    ports:
      - 3000:3000
    networks:
      - test-network
    depends_on:
      - backend
    environment:
      - HOST=0.0.0.0
      - GRAPHQL_URI=http://backend:4000
      - MAPBOX_TOKEN="pk.eyJ1IjoiYnVzZmFrdG9yIiwiYSI6ImNraDNiM3JxcDBhaWQydG1uczhpZWtpOW4ifQ.7TNRTO-o9aK1Y6MyW_Nd4g"
      # - WEBSOCKETS_URI=ws://backend:4000/graphql # is not working and not given in Docker YAML in main repo
      - PUBLIC_REGISTRATION=true
      - INVITE_REGISTRATION=true
      - CATEGORIES_ACTIVE=true

  ########################################################
  # BACKEND ##############################################
  ########################################################
  backend:
    # name the image to match our image to be tested from our DockerHub repository so that it can be pulled from there, otherwise it will be created locally from the 'dockerfile'
    image: ocelotsocialnetwork/backend-branded:latest
    networks:
      - test-network
    depends_on:
      - neo4j
    ports:
      - 4000:4000
    volumes:
      - backend_uploads:/app/public/uploads
    environment:
      - NEO4J_URI=bolt://neo4j:7687
      - GRAPHQL_URI=http://backend:4000
      - CLIENT_URI=http://localhost:3000
      - JWT_SECRET=b/&&7b78BF&fv/Vd
      - MAPBOX_TOKEN=pk.eyJ1IjoiYnVzZmFrdG9yIiwiYSI6ImNraDNiM3JxcDBhaWQydG1uczhpZWtpOW4ifQ.7TNRTO-o9aK1Y6MyW_Nd4g
      - PRIVATE_KEY_PASSPHRASE=a7dsf78sadg87ad87sfagsadg78
      - EMAIL_SUPPORT=support@wir.social
      - EMAIL_DEFAULT_SENDER=info@wir.social
      # - PRODUCTION_DB_CLEAN_ALLOW=false # only true for production environments on staging servers
      - PUBLIC_REGISTRATION=true
      - INVITE_REGISTRATION=true
      - CATEGORIES_ACTIVE=true
      - SMTP_USERNAME=${SMTP_USERNAME}
      - SMTP_PASSWORD=${SMTP_PASSWORD}
      - SMTP_HOST=mailserver
      - SMTP_PORT=25
      - SMTP_IGNORE_TLS=true

  ########################################################
  # MAINTENANCE ##########################################
  ########################################################
  maintenance:
    # name the image to match our image to be tested from our DockerHub repository so that it can be pulled from there, otherwise it will be created locally from the 'dockerfile'
    image: ocelotsocialnetwork/maintenance-branded:latest
    networks:
      - test-network
    ports:
      - 3001:80

  ########################################################
  # NEO4J ################################################
  ########################################################
  neo4j:
    # name the image to match our image to be tested from our DockerHub repository so that it can be pulled from there, otherwise it will be created locally from the 'dockerfile'
    image: ocelotsocialnetwork/neo4j-community-branded:latest
    networks:
      - test-network
    environment:
      - NEO4J_AUTH=none
      - NEO4J_dbms_security_procedures_unrestricted=algo.*,apoc.*
      - NEO4J_ACCEPT_LICENSE_AGREEMENT=yes
    ports:
      - 7687:7687
    volumes:
      - neo4j_data:/data

  ########################################################
  # MAILSERVER TO FAKE SMTP ##############################
  ########################################################
  mailserver:
    image: djfarrelly/maildev
    ports:
      - 1080:80
    networks:
      - test-network

networks:
  test-network:

volumes:
  backend_uploads:
  neo4j_data:
