ci-setup.sh 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. case $MATRIXENV in
  2. postgres)
  3. echo "Using PostgreSQL..."
  4. docker run -d -p 5432:5432 --name db --network="host" -e "POSTGRES_PASSWORD=Password123!" -e "POSTGRES_USER=wiki" -e "POSTGRES_DB=wiki" postgres:11
  5. while ! docker exec db psql -U wiki -d wiki -c "SELECT 1" &> /dev/null ; do
  6. echo "Waiting for database connection..."
  7. sleep 2
  8. done
  9. docker run -d -p 3000:3000 --name wiki --network="host" -e "DB_TYPE=postgres" -e "DB_HOST=localhost" -e "DB_PORT=5432" -e "DB_NAME=wiki" -e "DB_USER=wiki" -e "DB_PASS=Password123!" requarks/wiki:canary-$REL_VERSION_STRICT
  10. ;;
  11. mysql)
  12. echo "Using MySQL..."
  13. docker run -d -p 3306:3306 --name db --network="host" -e "MYSQL_ROOT_PASSWORD=Password123!" -e "MYSQL_USER=wiki" -e "MYSQL_PASSWORD=Password123!" -e "MYSQL_DATABASE=wiki" mysql:8
  14. while ! docker exec db mysql --user=root --password=Password123! -e "SELECT 1" &> /dev/null ; do
  15. echo "Waiting for database connection..."
  16. sleep 2
  17. done
  18. docker run -d -p 3000:3000 --name wiki --network="host" -e "DB_TYPE=mysql" -e "DB_HOST=localhost" -e "DB_PORT=3306" -e "DB_NAME=wiki" -e "DB_USER=wiki" -e "DB_PASS=Password123!" requarks/wiki:canary-$REL_VERSION_STRICT
  19. ;;
  20. mariadb)
  21. echo "Using MariaDB..."
  22. docker run -d -p 3306:3306 --name db --network="host" -e "MYSQL_ROOT_PASSWORD=Password123!" -e "MYSQL_USER=wiki" -e "MYSQL_PASSWORD=Password123!" -e "MYSQL_DATABASE=wiki" mariadb:10
  23. while ! docker exec db mysql --user=root --password=Password123! -e "SELECT 1" &> /dev/null ; do
  24. echo "Waiting for database connection..."
  25. sleep 2
  26. done
  27. docker run -d -p 3000:3000 --name wiki --network="host" -e "DB_TYPE=mariadb" -e "DB_HOST=localhost" -e "DB_PORT=3306" -e "DB_NAME=wiki" -e "DB_USER=wiki" -e "DB_PASS=Password123!" requarks/wiki:canary-$REL_VERSION_STRICT
  28. ;;
  29. mssql)
  30. echo "Using MS SQL Server..."
  31. docker run -d -p 1433:1433 --name db --network="host" -e "SA_PASSWORD=Password123!" -e "ACCEPT_EULA=Y" mcr.microsoft.com/mssql/server:2019-latest
  32. while ! docker exec db /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P "Password123!" -Q 'CREATE DATABASE wiki' &> /dev/null ; do
  33. echo "Waiting for database connection..."
  34. sleep 2
  35. done
  36. docker run -d -p 3000:3000 --name wiki --network="host" -e "DB_TYPE=mssql" -e "DB_HOST=localhost" -e "DB_PORT=1433" -e "DB_NAME=wiki" -e "DB_USER=SA" -e "DB_PASS=Password123!" requarks/wiki:canary-$REL_VERSION_STRICT
  37. ;;
  38. sqlite)
  39. echo "Using SQLite..."
  40. docker run -d -p 3000:3000 --name wiki --network="host" -e "DB_TYPE=sqlite" -e "DB_FILEPATH=db.sqlite" requarks/wiki:canary-$REL_VERSION_STRICT
  41. ;;
  42. *)
  43. echo "Invalid DB Type!"
  44. ;;
  45. esac