Created
August 20, 2019 19:46
-
-
Save dhsrocha/a00e2da6098c06c9b1ffa6858a6df66d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
set -e; set -f | |
# http://www.bashoneliners.com/oneliners/243/ | |
CWD=$(cd "$(dirname "$0")" && pwd) | |
# Run database's docker stack | |
run_db() { ( | |
sudo docker-compose \ | |
-f "$CWD/db+client.yml" \ | |
-p mysql \ | |
up \ | |
-d --force-recreate --remove-orphans | |
)}; run_db | |
# Utility for inspecting database's container | |
log_db() { ( sudo docker exec -it mysql_dbms_1 bash ; )} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.7' | |
services: | |
dbms: | |
tty: true | |
image: mysql/mysql-server | |
# Adminer doesn't accept the current authentication system for version 8 | |
# https://mysqlserverteam.com/mysql-8-0-4-new-default-authentication-plugin-caching_sha2_password/ | |
command: --default-authentication-plugin=mysql_native_password | |
restart: always | |
ports: | |
- 3306:3306 | |
networks: | |
db_network: | |
# Volumes cannot be set. Otherwise, custom users and tables won't be created | |
environment: | |
MYSQL_ROOT_PASSWORD: pwd | |
# MYSQL_DATABASE: default_db | |
# MYSQL_USER: admin # Non-root | |
# MYSQL_PASSWORD: pwd # Non-root | |
# Allows requests from another domains (hosts/ip) | |
MYSQL_ROOT_HOST: '%' | |
client: | |
# stdin_open: true | |
# tty: true | |
image: adminer | |
restart: always | |
ports: | |
- 8000:8080 | |
depends_on: | |
- dbms | |
networks: | |
db_network: | |
# 'Volumes' is not necessary | |
environment: | |
ADMINER_DESIGN: brade | |
# ADMINER_DEFAULT_SERVER: db # any value is acceptable | |
ADMINER_DEFAULT_DB_HOST: root | |
ADMINER_DEFAULT_DB_NAME: pwd | |
networks: | |
db_network: | |
driver: bridge |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment