# First, build image: sh devops/docker-image/build_image.sh .

# ALERT - this is a pre-configured for the mysql classicmodels sample database
# see https://apilogicserver.github.io/Docs/Database-Docker/#classicmodels-mysql-docker
# you will need to alter APILOGICPROJECT_SQLALCHEMY_DATABASE_URI (2 lines) for your database & auth
# and, in the case of demo (sqlite), comment them out

# cd <project>  
# sh ./devops/docker-compose-dev-local/docker-compose.sh
# --> builds, runs at localhost:5656

version: "3.5"

services:

    mysql-service:
        image: apilogicserver/mysql8.0:latest
        restart: always
        environment:
            - MYSQL_USER=root
            - MYSQL_PASSWORD=p
            - MYSQL_ROOT_PASSWORD=p
        ports:
            # <Port exposed> : <MySQL Port running inside container>
            - '3306:3306'
        expose:
            # Opens port 3306 on the container
            - '3306'

    api-logic-server:
        image: apilogicserver/apilogicserver_project_name_lower
        environment:
          - APILOGICPROJECT_VERBOSE=true
          - SECURITY_ENABLED=true
          ## todid - database uri's:
          - APILOGICPROJECT_SQLALCHEMY_DATABASE_URI=mysql+pymysql://root:p@mysql-service:3306/classicmodels
          - APILOGICPROJECT_SQLALCHEMY_DATABASE_URI_AUTHENTICATION=mysql+pymysql://root:p@mysql-service:3306/authdb
        expose:
          - 5656
        ports:
          - 5656:5656
