blob: 9a6164806c5acd7e218d80957666ebafbd0ca847 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#!/bin/bash
# find other running nodes
other_nodes_found=1
for i in $(echo "{{ openbook_gcomm_addresses }}" | sed -e 's|,| |g'); do
if [ "${i}" != "{{ ansible_default_ipv4.address }}" ]; then
nc ${i} 4567 </dev/null >/dev/null
if [ "${?}" == "0" ]; then
other_nodes_found=0
fi
fi
done
# bootstrap or cluster join depending on whether other nodes were found
if [ "${other_nodes_found}" == "0" ]; then
mysql_args=""
else
mysql_args="--wsrep-new-cluster"
fi
docker run -d --rm --net=host -p 3306:3306 -p 4444:4444 -p 4567:4567 -p 4567:4567/udp -p 4568:4568 -p 9200:9200 -v /etc/openbook/database:/etc/mysql -v /var/lib/mysql:/var/lib/mysql -v /var/log/mysql:/var/log/mysql --name database openbook-docker-registry.verizoncloudplatform.com/openbook_database ${mysql_args}
exit 0
|