version: '3.1'

services:

  guacd:
    image:  guacamole/guacd:1.2.0
    container_name: ${CONTAINER_PREFIX}_cd
    restart: "no"
    ports:
      - 4822:4822


  db:
    image: mysql:latest
    container_name: ${CONTAINER_PREFIX}_db
    restart: "no"
    environment:
      - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD} 
      - MYSQL_USER=${MYSQL_USER}
      - MYSQL_PASSWORD=${MYSQL_PASSWORD}
      - MYSQL_DATABASE=${MYSQL_DATABASE}
    volumes:
      - ${GUACA_ROOT}/backups:/var/backups
      - ${GUACA_ROOT}/data_dir/$MYSQL_DATABASE:/var/lib/mysql/$MYSQL_DATABASE

  guaca:
    image: guacamole/guacamole:1.2.0
    container_name: ${CONTAINER_PREFIX}
    restart: "no"
    links: 
      - db
      - guacd
    ports:
      - 8111:8080
    environment:
      - MYSQL_HOSTNAME=${MYSQL_HOSTNAME}
      - GUACD_HOSTNAME=${GUACD_HOSTNAME}      
      - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD} 
      - MYSQL_USER=${MYSQL_USER}
      - MYSQL_PASSWORD=${MYSQL_PASSWORD}
      - MYSQL_DATABASE=${MYSQL_DATABASE}      

