diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 00000000..d83b64c8 --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,15 @@ +version: '3.1' + +services: + + db: + image: mysql:5.7 + restart: always + environment: + - MYSQL_DATABASE=stregsystem + - MYSQL_ROOT_PASSWORD=juststars + - MYSQL_USER=stregsystem + - MYSQL_PASSWORD=hunter2 + - MYSQL_ROOT_HOST=172.17.0.1 + ports: + - 3306:3306 diff --git a/docker/restore-database-testenv.sh b/docker/restore-database-testenv.sh new file mode 100755 index 00000000..c888c347 --- /dev/null +++ b/docker/restore-database-testenv.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# +# Script for setting up docker-stregsystem and reloading prod-database dump + +# be verbose +set -x + +# path to mysql dump file after extraction from backup +database_dump_path=stregsystem-db-2021-09-24.txt + +# password to use to restore backup +mysql_root_password=juststars + +# set to empty (sudo='') if sudo is not required for your docker installation +sudo='sudo ' + +# flush and setup environment +$sudo docker-compose down && sudo docker-compose up -d + +printf "Wait for MySQL to start up in database [assuming 20s]\n" +sleep 20 + +# remember to put "use stregsystem;" in backup before running +printf -- "--\n-- Restore hotfix, must use stregsystem\n--\n\nuse stregsystem;\n" | cat - $database_dump_path | $sudo docker exec -i docker_db_1 sh -c "exec mysql -uroot -p$mysql_root_password"