# DEVELOPMENT ONLY - do not deploy this Compose file to production.
# INFORMATION
# We are not exposing the default ports for the services in this file.
# This is to avoid conflicts with existing services on your machine.
# In case you don't have any services running on the default ports, you can expose them by changing the
# ports section in the services block. Please don't forget to update the ports in the .env file as well.

# The explicit project name keeps this project's containers and volumes distinct from
# those of other projects, even when this file lives in an identically-named directory
# (e.g. apps/server in a monorepo). Quoted so that numeric-looking names (e.g. "123")
# stay YAML strings — Compose rejects a non-string name.
name: 'scuto-store-api'

services:
    postgres_db:
        image: postgres:16-alpine
        volumes:
            - postgres_db_data:/var/lib/postgresql/data
        ports:
            - "127.0.0.1:6543:5432"
        environment:
            POSTGRES_DB: vendure
            POSTGRES_USER: root
            POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD}
        labels:
            - "io.vendure.create.name=scuto-store-api"

    mysql_db:
        image: mysql:8
        volumes:
            - mysql_db_data:/var/lib/mysql
        environment:
            MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:?Set MYSQL_ROOT_PASSWORD}
            MYSQL_DATABASE: vendure
            MYSQL_USER: root
            MYSQL_PASSWORD: ${MYSQL_PASSWORD:?Set MYSQL_PASSWORD}
        ports:
            - "127.0.0.1:4306:3306"
        labels:
            - "io.vendure.create.name=scuto-store-api"

    mariadb_db:
        image: mariadb:10
        volumes:
            - mariadb_db_data:/var/lib/mysql
        environment:
            MARIADB_ROOT_PASSWORD: ${MARIADB_ROOT_PASSWORD:?Set MARIADB_ROOT_PASSWORD}
            MARIADB_DATABASE: vendure
            MARIADB_USER: root
            MARIADB_PASSWORD: ${MARIADB_PASSWORD:?Set MARIADB_PASSWORD}
        ports:
            - "127.0.0.1:3306:3306"
        labels:
            - "io.vendure.create.name=scuto-store-api"

    # RECOMMENDED (especially for production)
    # Want to use our BullMQ with Redis instead of our default database job queue?
    # Checkout our BullMQ plugin: https://docs.vendure.io/reference/core-plugins/job-queue-plugin/bull-mqjob-queue-plugin/
    redis:
        image: redis:7-alpine
        ports:
            - "127.0.0.1:6479:6379"
        volumes:
            - redis_data:/data
        labels:
            - "io.vendure.create.name=scuto-store-api"

    # RECOMMENDED
    # Want to use Typesense instead of our default search engine?
    # Checkout our advanced search plugin: https://vendure.io/hub/vendure-plus-advanced-search-plugin
    # To run the typesense container run "docker compose up -d typesense"
    typesense:
        image: typesense/typesense:27.0
        command: [ '--data-dir', '/data', '--api-key', '${TYPESENSE_API_KEY:?Set TYPESENSE_API_KEY}' ]
        ports:
            - "127.0.0.1:8208:8108"
        volumes:
            - typesense_data:/data
        labels:
            - "io.vendure.create.name=scuto-store-api"

    # Want to use Elasticsearch instead of our default database engine?
    # Checkout the community Elasticsearch plugin: https://github.com/vendurehq/vendure-community-plugins
    # To run the elasticsearch container run "docker compose up -d elasticsearch"
    elasticsearch:
        image: docker.elastic.co/elasticsearch/elasticsearch:9.1.0
        container_name: elasticsearch
        environment:
            - node.name=es
            - cluster.name=es-docker-cluster
            - xpack.security.enabled=false
            - xpack.security.http.ssl.enabled=false
            - xpack.security.transport.ssl.enabled=false
            - xpack.license.self_generated.type=basic
            - discovery.type=single-node
            - bootstrap.memory_lock=true
            - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
        mem_limit: 536870912
        ulimits:
            memlock:
                soft: -1
                hard: -1
        volumes:
            - elasticsearch_data:/usr/share/elasticsearch/data
        ports:
            - "127.0.0.1:9200:9200"
        labels:
            - "io.vendure.create.name=scuto-store-api"

volumes:
    postgres_db_data:
        driver: local
        labels:
            - "io.vendure.create.name=scuto-store-api"
    mysql_db_data:
        driver: local
        labels:
            - "io.vendure.create.name=scuto-store-api"
    mariadb_db_data:
        driver: local
        labels:
            - "io.vendure.create.name=scuto-store-api"
    typesense_data:
        driver: local
        labels:
            - "io.vendure.create.name=scuto-store-api"
    elasticsearch_data:
        driver: local
        labels:
            - "io.vendure.create.name=scuto-store-api"
    redis_data:
        driver: local
        labels:
            - "io.vendure.create.name=scuto-store-api"
