version: '3.1'
services:

    nginx:
        image: nginx:latest
        container_name: nginx
        volumes:
            - "./etc/nginx/default.conf:/etc/nginx/conf.d/default.conf"
            #- "./Website:/var/www/html/public"
            - "./etc/nginx/default.template.conf:/etc/nginx/conf.d/default.template"
            - "./etc/logs/nginx:/var/log/nginx"
            - "./etc/logs/letsencrypt:/var/log/letsencrypt"
            - "./etc/letsencrypt/certs:/etc/letsencrypt"
            - "./etc/letsencrypt/data:/data/letsencrypt"
        ports:
            - "80:80"
            - "443:443"
        environment:
            - NGINX_HOST=localhost
        command: /bin/sh -c "envsubst '$$NGINX_HOST' < /etc/nginx/conf.d/default.template > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'"
        restart: always
        depends_on:
            - mysqldb
            - tomcat
#        logging:
#            driver: splunk
#            options:
#                splunk-token: "e1c56fa1-9f7c-4d2c-ba8f-989b15d85008"
#                splunk-url: "https://127.0.0.1:8088"
#                splunk-insecureskipverify: "true"
#                tag: "{{.ImageName}}/{{.Name}}/{{.ID}}"
#                labels: "Nginx"

    myadmin:
        image: phpmyadmin/phpmyadmin
        container_name: phpmyadmin
        ports:
            - "9000:80"
        environment:
            - PMA_ARBITRARY=1
            - PMA_HOST=mysql
        restart: always
        depends_on:
            - mysqldb
#        logging:
#            driver: splunk
#            options:
#                splunk-token: "e1c56fa1-9f7c-4d2c-ba8f-989b15d85008"
#                splunk-url: "https://127.0.0.1:8088"
#                splunk-insecureskipverify: "true"
#                tag: "{{.ImageName}}/{{.Name}}/{{.ID}}"
#                labels: "PHPMyAdmin"

    mysqldb:
        image: mariadb:10.3.8
        container_name: mysql
        restart: always
        environment:
            - MYSQL_DATABASE=test
            - MYSQL_ROOT_PASSWORD=root
            - MYSQL_USER=dev
            - MYSQL_PASSWORD=dev
        ports:
            - "127.0.0.1:3306:3306"
        volumes:
            - "./data/db/mysql:/var/lib/mysql"
            - "./etc/mariadb/innodb-fix.cnf:/etc/mysql/conf.d/innodb-fix.cnf"
#        logging:
#            driver: splunk
#            options:
#                splunk-token: "e1c56fa1-9f7c-4d2c-ba8f-989b15d85008"
#                splunk-url: "https://127.0.0.1:8088"
#                splunk-insecureskipverify: "true"
#                tag: "{{.ImageName}}/{{.Name}}/{{.ID}}"
#                labels: "MySQL"

    tomcat:
        image: tomcat:latest
        container_name: tomcat
        ports:
            - "8080:8080"
        restart: always
        volumes:
            - "./Website:/usr/local/tomcat/webapps/ROOT"
            - "./etc/tomcat:/usr/local/tomcat/conf"
#        logging:
#            driver: splunk
#            options:
#                splunk-token: "e1c56fa1-9f7c-4d2c-ba8f-989b15d85008"
#                splunk-url: "https://127.0.0.1:8088"
#                splunk-insecureskipverify: "true"
#                tag: "{{.ImageName}}/{{.Name}}/{{.ID}}"
#                labels: "Tomcat"

    ghost:
        image: ghost:latest
        container_name: ghost
        ports:
            - "127.0.0.1:2368:2368"
        restart: always
        volumes:
            - "./etc/ghost:/var/lib/ghost/content"
        depends_on:
            - nginx
        environment:
          NODE_ENV: production
          privacy__useUpdateCheck: 0
          url: 'http://localhost' #change this!
          #mail__from: OpenRSC Emailer <openrsc.emailer@gmail.com>
          #mail__transport: SMTP
          #mail__transport__options__host: smtp.gmail.com
          #mail__transport__options__secureConnection: 1
          #mail__transport__options__port: 465
          #mail__transport__options__auth_user: openrsc.emailer@gmail.com
          #mail__transport__options__auth_pass: OFF
#        logging:
#            driver: splunk
#            options:
#                splunk-token: "e1c56fa1-9f7c-4d2c-ba8f-989b15d85008"
#                splunk-url: "https://127.0.0.1:8088"
#                splunk-insecureskipverify: "true"
#                tag: "{{.ImageName}}/{{.Name}}/{{.ID}}"
#                labels: "Ghost"
