i don't trust the gatecounter-db to init itself cuz it hasn't been

This commit is contained in:
Brennen Raimer
2019-01-18 17:48:08 -05:00
parent deedc5d0f0
commit 9320a6eeff

View File

@@ -21,7 +21,7 @@ services:
labels: #can be used to communicate info about this service to other services
- traefik.enable=false #tells traefik reverse proxy to ignore this container, do not proxy requests to it
healthcheck: #this command is run periodically so docker can know whether or not this service is actually accessible. Completely optional.
test: ["CMD-SHELL", "mysqladmin -u ${MYSQL_USER:-gatecounter} -h 127.0.0.1 --password=${MYSQL_USER_PW:?a non-admin database password is requred. Please edit .env with this value} ping || exit 1"]
test: ["CMD-SHELL", "mysqladmin -h $$HOSTNAME -u ${MYSQL_USER:-gatecounter} -h 127.0.0.1 --password=${MYSQL_USER_PW:?a non-admin database password is requred. Please edit .env with this value} ping || exit 1"]
interval: 30s
timeout: 10s
retries: 5
@@ -30,6 +30,30 @@ services:
expose:
- "3306"
gatecounter-db-init: #how this service will be referenced in this file
image: yobasystems/alpine-mariadb:armhf
environment: #set environment variables for this service. These will initialize a database
#these environment variables will specify how the gate counter script will connect to the db to record data
MYSQL_DATABASE: ${MYSQL_DB_NAME:-gatecounter}
MYSQL_USER: ${MYSQL_USER:-gatecounter}
MYSQL_PASSWORD: ${MYSQL_USER_PW:?a non-admin database password is requred. Please edit .env with this value}
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PW:?an admin database password is requred. Please edit .env with this value}
TZ: ${TZ:-America/New_York}
volumes: #specify where data to be peristed will be stored on host and where it resides within the service
- gatecounter-db:/config #left of the : is the name of a docker volume to store data in, right of it is where it is located in the service
- ./sql:/docker-entrypoint-initdb.d
networks: #virtual network for services to connect to each other through. necessary to resolve their container_name to their virtual ip address
- gatecounter
labels: #can be used to communicate info about this service to other services
- traefik.enable=false #tells traefik reverse proxy to ignore this container, do not proxy requests to it
- com.docker.compose.oneoff=true
entrypoint:
- /bin/sh
- -c
- "\"mysql -h $$HOSTNAME -u root -D ${MYSQL_DB_NAME} -p${MYSQL_ROOT_PW} < /docker-entrypoint-initdb.d/db-init.sql\""
depends_on:
- gatecounter-db
grafana:
image: grafana/grafana-arm32v7-linux
@@ -50,7 +74,7 @@ services:
expose:
- "3000" #makes this port accessible to other containers on the same network, but not availble directly on the host system
depends_on: #specifies which containers must be up and running before this one can be started
#- reverse-proxy
- reverse-proxy
- gatecounter-db
environment:
GF_SERVER_ROOT_URL: https://${GRAFANA_DOMAIN_NAME}