Skip to content

Commit

Permalink
Replace mariadb with mysql8
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcPaquette committed Sep 1, 2022
1 parent adc49e0 commit 390d5d7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 49 deletions.
22 changes: 0 additions & 22 deletions scripts/ci/initialize_mysql.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,6 @@ function initialize_mysql {
cat << EOF > /etc/my.cnf
[mysqld]
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
EOF
datadir=/mysql-datadir
escaped_datadir=${datadir/\//\\\/}
mkdir $datadir
mount -t tmpfs -o size=2g tmpfs $datadir
rsync -av --progress /var/lib/mysql/ $datadir
sed -i "s/#datadir.*/datadir=${escaped_datadir}/g" /etc/mysql/mariadb.conf.d/50-server.cnf
service mariadb start
}

function initialize_mysql8 {
cat << EOF > /etc/my.cnf
[mysqld]
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
EOF
datadir=/mysql-datadir
escaped_datadir=${datadir/\//\\\/}
Expand All @@ -28,14 +14,6 @@ EOF
service mysql start
}

function cleanup_mysql {
service mariadb stop
}

function cleanup_mysql8 {
service mysql stop
}

function bootDB {
db=$1

Expand Down
1 change: 0 additions & 1 deletion scripts/ci/run_inigo
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
dir=$(dirname $0)

source $dir/setup_inigo
trap cleanup EXIT

nodes_flag=""
if [ "$GINKGO_PARALLEL" = "true" ]; then
Expand Down
33 changes: 7 additions & 26 deletions scripts/ci/setup_inigo
Original file line number Diff line number Diff line change
Expand Up @@ -169,32 +169,21 @@ setup_database() {
chmod 0600 "$cert_file"
chmod 0600 "$key_file"

if [ "${SQL_FLAVOR}" = "mysql" ] || [ "${SQL_FLAVOR}" = "mysql8" ]; then
if [ "${SQL_FLAVOR}" = "mysql" ]; then
source ${GOPATH_ROOT}/scripts/ci/initialize_mysql.sh

chown mysql:mysql "$ca_file"
chown mysql:mysql "$cert_file"
chown mysql:mysql "$key_file"

if [ "${SQL_FLAVOR}" = "mysql8" ]; then
server_cnf_path="/etc/mysql/mysql.conf.d/mysqld.cnf"

sed -i 's/# max_connections.*= 151/max_connections = 2000/g' "${server_cnf_path}"
echo "ssl-cert = $cert_file" >> "${server_cnf_path}"
echo "ssl-key = $key_file" >> "${server_cnf_path}"
echo "ssl-ca = $ca_file" >> "${server_cnf_path}"
server_cnf_path="/etc/mysql/mysql.conf.d/mysqld.cnf"

initialize_mysql8
else
server_cnf_path="/etc/mysql/mariadb.conf.d/50-server.cnf"
sed -i 's/# max_connections.*= 151/max_connections = 2000/g' "${server_cnf_path}"
echo "ssl-cert = $cert_file" >> "${server_cnf_path}"
echo "ssl-key = $key_file" >> "${server_cnf_path}"
echo "ssl-ca = $ca_file" >> "${server_cnf_path}"

sed -i 's/#max_connections.*= 100/max_connections = 2000/g' "${server_cnf_path}"
sed -i "s%#ssl-cert = /etc/mysql/server-cert.pem%ssl-cert = $cert_file%g" "${server_cnf_path}"
sed -i "s%#ssl-key = /etc/mysql/server-key.pem%ssl-key = $key_file%g" "${server_cnf_path}"
sed -i "s%#ssl-ca = /etc/mysql/cacert.pem%ssl-ca = $ca_file%g" "${server_cnf_path}"

initialize_mysql
fi
initialize_mysql
else
sed -i 's/max_connections = 100/max_connections = 2000/g' /etc/postgresql/9.4/main/postgresql.conf

Expand All @@ -211,14 +200,6 @@ setup_database() {
fi
}

cleanup() {
if [ "${SQL_FLAVOR}" = "mysql" ]; then
cleanup_mysql
elif [ "${SQL_FLAVOR}" = "mysql8" ]; then
cleanup_mysql8
fi
}

rm -rf $PWD/diego-release/src/code.cloudfoundry.org/guardian/vendor/github.com/onsi/{ginkgo,gomega}

setup_dnsmasq
Expand Down

0 comments on commit 390d5d7

Please sign in to comment.