mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-11-08 04:11:59 +01:00
Fixed docker start.sh
Signed-off-by: Janos SUTO <sj@acts.hu>
This commit is contained in:
parent
ce811951e5
commit
657ceaf11f
@ -88,8 +88,8 @@ fix_configs() {
|
|||||||
log "Writing ${PILER_CONF}"
|
log "Writing ${PILER_CONF}"
|
||||||
|
|
||||||
sed \
|
sed \
|
||||||
-e "s/mysqluser=.*/${MYSQL_USER}/g" \
|
-e "s/mysqluser=.*/mysqluser=${MYSQL_USER}/g" \
|
||||||
-e "s/mysqldb=.*/${MYSQL_DATABASE}/g" \
|
-e "s/mysqldb=.*/mysqldb=${MYSQL_DATABASE}/g" \
|
||||||
-e "s/verystrongpassword/${MYSQL_PASSWORD}/g" \
|
-e "s/verystrongpassword/${MYSQL_PASSWORD}/g" \
|
||||||
-e "s/hostid=.*/hostid=${PILER_HOSTNAME}/g" \
|
-e "s/hostid=.*/hostid=${PILER_HOSTNAME}/g" \
|
||||||
-e "s/tls_enable=.*/tls_enable=1/g" \
|
-e "s/tls_enable=.*/tls_enable=1/g" \
|
||||||
@ -138,19 +138,21 @@ wait_until_mysql_server_is_ready() {
|
|||||||
|
|
||||||
|
|
||||||
init_database() {
|
init_database() {
|
||||||
local db
|
local table
|
||||||
local has_piler_db=0
|
local has_metadata_table=0
|
||||||
|
|
||||||
wait_until_mysql_server_is_ready
|
wait_until_mysql_server_is_ready
|
||||||
|
|
||||||
while read -r db; do
|
while read -r table; do
|
||||||
if [[ "$db" == "$MYSQL_DATABASE" ]]; then has_piler_db=1; fi
|
if [[ "$table" == metadata ]]; then has_metadata_table=1; fi
|
||||||
done < <(mysql "--defaults-file=${PILER_MY_CNF}" <<< 'show databases')
|
done < <(mysql "--defaults-file=${PILER_MY_CNF}" "$MYSQL_DATABASE" <<< 'show tables')
|
||||||
|
|
||||||
|
if [[ $has_metadata_table -eq 0 ]]; then
|
||||||
|
log "no metadata table, creating tables"
|
||||||
|
|
||||||
if [[ $has_piler_db -eq 0 ]]; then
|
|
||||||
mysql "--defaults-file=${PILER_MY_CNF}" "$MYSQL_DATABASE" < /usr/share/piler/db-mysql.sql
|
mysql "--defaults-file=${PILER_MY_CNF}" "$MYSQL_DATABASE" < /usr/share/piler/db-mysql.sql
|
||||||
else
|
else
|
||||||
log "${MYSQL_DATABASE} db exists"
|
log "metadata table exists"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -v ADMIN_USER_PASSWORD_HASH ]]; then
|
if [[ -v ADMIN_USER_PASSWORD_HASH ]]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user