diff options
author | Justin chi <chigang@huawei.com> | 2018-02-27 02:35:13 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2018-02-27 02:35:13 +0000 |
commit | 15a7cbc925bed896c3c09a5635454c33dbffbadc (patch) | |
tree | 7ea5215fdd29696b621014174edb9bb64f740546 /compass-db | |
parent | aa9931ff28b599455f181267b9510e14ddbe8830 (diff) | |
parent | 8e4c3c0e8e6c82b84501ef577e4fd069e9c05b02 (diff) |
Merge "compass-db: support arm64"opnfv-6.1.0opnfv-6.0.0
Diffstat (limited to 'compass-db')
-rw-r--r-- | compass-db/Dockerfile-arm64 | 15 | ||||
-rw-r--r-- | compass-db/entrypoint-arm64.sh | 43 |
2 files changed, 58 insertions, 0 deletions
diff --git a/compass-db/Dockerfile-arm64 b/compass-db/Dockerfile-arm64 new file mode 100644 index 0000000..7b5755c --- /dev/null +++ b/compass-db/Dockerfile-arm64 @@ -0,0 +1,15 @@ +FROM ubuntu:trusty + +EXPOSE 3306 +ARG BRANCH=master + +RUN (apt-get update || true) && \ + DEBIAN_FRONTEND=noninteractive apt-get install -y mysql-server && \ + rm -rf /var/lib/apt/lists/* + +COPY entrypoint-arm64.sh /sbin/entrypoint.sh +RUN chmod 755 /sbin/entrypoint.sh + +VOLUME ["/var/lib/mysql"] + +CMD ["/sbin/entrypoint.sh"] diff --git a/compass-db/entrypoint-arm64.sh b/compass-db/entrypoint-arm64.sh new file mode 100644 index 0000000..37b3437 --- /dev/null +++ b/compass-db/entrypoint-arm64.sh @@ -0,0 +1,43 @@ +#!/bin/bash +set -x + +create_users_and_dbs() { + /usr/bin/mysqld_safe > /dev/null 2>&1 & + + timeout=30 + # wait up to 30 secs... + while ! /usr/bin/mysqladmin -u root status > /dev/null 2>&1 + do + timeout=$(($timeout - 1)) + if [ $timeout -eq 0 ]; then + echo -e "\nCould not connect to database server. Aborting..." + exit 1 + fi + echo -n "." + sleep 1 + done + + echo "Creating user..." + mysqladmin -h127.0.0.1 --port=3306 -u root password root + mysql -h127.0.0.1 --port=3306 -uroot -proot -e "create database compass" + mysql -h127.0.0.1 --port=3306 -uroot -proot -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root'" + mysqladmin -uroot -proot shutdown +} + +listen_on_all_interfaces() { + cat >> /etc/mysql/conf.d/mysql-listen-compass.cnf <<EOF +[mysqld] +bind-address=0.0.0.0 +[mysqld_safe] +bind-address=0.0.0.0 +EOF +} + + +if [[ -z ${1} ]]; then + if [ ! -f /etc/mysql/conf.d/mysql-listen-compass.cnf ]; then + create_users_and_dbs + listen_on_all_interfaces + fi + /usr/bin/mysqld_safe +fi |