diff --git a/server/.start-db/init-db.sh b/server/.start-db/init-db.sh new file mode 100644 index 00000000..7c2b510c --- /dev/null +++ b/server/.start-db/init-db.sh @@ -0,0 +1 @@ +mysql -u root -e "CREATE DATABASE IF NOT EXISTS development;" diff --git a/server/Makefile b/server/Makefile index bd19bc70..7a9ed84c 100644 --- a/server/Makefile +++ b/server/Makefile @@ -11,18 +11,17 @@ build: install: @docker exec -it opensupports-srv bash -c "cd /var/www/html && composer install" || echo "${red}Please execute 'make run' first${reset}" - @docker exec -u root -it opensupports-db bash -c "service mysql start; mysql -u root -e \"CREATE DATABASE IF NOT EXISTS development;\" " || echo "${red}Please execute 'make run' first${reset}" + @docker exec -u root -it opensupports-db bash -c "mysql -u root -e \"CREATE DATABASE IF NOT EXISTS development;\" " || echo "${red}Please execute 'make run' first${reset}" install-not-interactive: - @docker exec opensupports-srv bash -c "cd /var/www/html && composer install" || echo "${red}Please execute 'make run' first${reset}" - @docker exec -u root opensupports-db bash -c "service mysql start; mysql -u root -e \"CREATE DATABASE IF NOT EXISTS development;\" " || echo "${red}Please execute 'make run' first${reset}" + docker exec opensupports-srv bash -c "cd /var/www/html && composer install" || echo "${red}Please execute 'make run' first${reset}" setup-vendor-permissions: @docker exec opensupports-srv bash -c "cd /var/www/html && chmod 777 -R vendor/ezyang" || echo "${red}Please execute 'make run' first${reset}" @docker exec opensupports-srv bash -c "cd /var/www/html && chmod 777 -R files" || echo "${red}Please execute 'make run' first${reset}" run: stop - @docker run --platform=linux/amd64 -d --network os-net --name opensupports-db -p 4040:3306 -e MYSQL_ALLOW_EMPTY_PASSWORD=yes -v $(PWD)/.dbdata/:/var/lib/mysql mysql:5.6 + @docker run --platform=linux/amd64 -d --network os-net --name opensupports-db -p 4040:3306 -e MYSQL_ALLOW_EMPTY_PASSWORD=yes -v $(PWD)/.dbdata/:/var/lib/mysql -v $(PWD)/.start-db:/docker-entrypoint-initdb.d mysql:5.6 @docker run --platform=linux/amd64 -d --network os-net --name opensupports-myadmin --link opensupports-db:db -p 6060:80 phpmyadmin/phpmyadmin @docker run --platform=linux/amd64 -d --network os-net --name opensupports-fakesmtp -p 7070:25 -v ${PWD}/.fakemail/:/var/mail munkyboy/fakesmtp @docker run --platform=linux/amd64 -d --network os-net --name opensupports-srv -p 8080:80 --link opensupports-db:mysql --rm -e LOG_STDOUT=true -e LOG_STDERR=true -e LOG_LEVEL=debug -v ${PWD}:/var/www/html opensupports-srv diff --git a/tests/truncate_db.sh b/tests/truncate_db.sh index aad5d05d..33053f01 100755 --- a/tests/truncate_db.sh +++ b/tests/truncate_db.sh @@ -1,6 +1,5 @@ #!/bin/bash # DELETE ALL TABLES -service mysql start; TABLES=$(mysql --host ${MYSQL_HOST} --port ${MYSQL_PORT} -u root development -e "SHOW TABLES IN development;" | awk '{ print $1}' | grep -v '^Tables') for t in $TABLES