# This specifies the version of Docker Compose to use.
version: "3"

# This defines all of the services that will be run in this Docker Compose setup.
services:

  # This defines a service named "server".
  server:
    # This specifies the Docker image to use for this service.
    image: yooooomi/your_spotify_server

    # This sets the restart policy for this service. In this case, it will always restart if it stops.
    restart: unless-stopped

    # This maps port 15000 on the host machine to port 8080 on the container.
    ports:
      - "15000:8080"

    # This links the "mongo" service to this one. This allows them to communicate with each other.
    links:
      - mongo

    # This specifies that the "mongo" service must be started before this one.
    depends_on:
      - mongo

    # This sets environment variables for the container.
    environment:
      - API_ENDPOINT=http://vish.gg:15000 # This MUST be included as a valid URL in the spotify dashboard
      - CLIENT_ENDPOINT=http://vish.gg:4000
      - SPOTIFY_PUBLIC=d6b3bda999f042099ce79a8b6e9f9e68
      - SPOTIFY_SECRET=72c650e7a25f441baa245b963003a672
      - CORS=http://vish.gg:4000,http://vish.gg:4001 # all if you want to allow every origin

  # This defines a service named "mongo".
  mongo:
    # This sets the container name for this service.
    container_name: mongo

    # This specifies the Docker image to use for this service.
    image: mongo:4.4.8

    # This mounts a volume from the host machine into the container. In this case, it mounts "./your_spotify_db" on the host machine to "/data/db" in the container.
    volumes:
      - ./your_spotify_db:/data/db

  # This defines a service named "web".
  web:
    # This specifies the Docker image to use for this service.
    image: yooooomi/your_spotify_client

    # This sets the restart policy for this service. In this case, it will always restart if it stops.
    restart: unless-stopped

    # This maps port 4000 on the host machine to port 3000 on the container.
    ports:
      - "4000:3000"

    # This sets environment variables for the container.
    environment:
      - API_ENDPOINT=http://vish.gg:15000
