aboutsummaryrefslogtreecommitdiff
path: root/docker/mariadb/start.sh
blob: 69f40818c8c86123a889250af6e7694a631ad699 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash

set -o errexit

# Loading common functions
source /opt/kolla/kolla-common.sh

# Generate run command
python /opt/kolla/set_configs.py
CMD=$(cat /run_command)

# Loading functions
source /opt/kolla/config/config-galera.sh

chown mysql: /var/lib/mysql

# This catches all cases of the BOOTSTRAP variable being set, including empty
if [[ "${!KOLLA_BOOTSTRAP[@]}" ]] && [[ ! -e /var/lib/mysql/cluster.exists ]]; then
    ARGS="--wsrep-new-cluster"
    touch /var/lib/mysql/cluster.exists
    populate_db
    bootstrap_db
    exec $CMD $ARGS
    exit 0
fi

echo "Running command: ${CMD}"
exec $CMD