Change readiness to use real mysql connection
Change-Id: I5add651e9bfcd36114c428ddc6d8da5a90706334
This commit is contained in:
parent
40b2323bbb
commit
35a19a48cd
|
@ -4,6 +4,7 @@ configs:
|
|||
db:
|
||||
max_timeout: 60
|
||||
root_password: password
|
||||
readiness_password: password
|
||||
mariadb:
|
||||
port:
|
||||
cont: 3306
|
||||
|
|
|
@ -18,12 +18,15 @@ function bootstrap_db {
|
|||
echo "Running mysql grant privileges commands"
|
||||
mysql -u root --password="${DB_ROOT_PASSWORD}" -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY '${DB_ROOT_PASSWORD}' WITH GRANT OPTION;"
|
||||
mysql -u root --password="${DB_ROOT_PASSWORD}" -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '${DB_ROOT_PASSWORD}' WITH GRANT OPTION;"
|
||||
echo "Add readiness user"
|
||||
mysql -u root --password="${DB_ROOT_PASSWORD}" -e "CREATE USER 'readiness'@'%' IDENTIFIED BY '${DB_READINESS_PASSWORD}';"
|
||||
echo "Shuting down mariadb"
|
||||
mysqladmin -uroot -p"${DB_ROOT_PASSWORD}" shutdown
|
||||
wait $(jobs -p)
|
||||
}
|
||||
|
||||
DB_ROOT_PASSWORD="{{ db.root_password }}"
|
||||
DB_READINESS_PASSWORD="{{ db.readiness_password }}"
|
||||
DB_MAX_TIMEOUT="{{ db.max_timeout }}"
|
||||
|
||||
# Only update permissions if permissions need to be updated
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
test -f /tmp/mariadb_ok && nc -z {{ network_topology["private"]["address"] }} {{ mariadb.port.cont }}
|
||||
test -f /tmp/mariadb_ok && echo "status" | mysql --connect-timeout=4 \
|
||||
-h {{ network_topology["private"]["address"] }} \
|
||||
-P {{ mariadb.port.cont }} \
|
||||
-u readiness \
|
||||
-p{{ db.readiness_password }}
|
||||
|
|
Loading…
Reference in New Issue