summaryrefslogtreecommitdiffstats
path: root/docker
diff options
context:
space:
mode:
Diffstat (limited to 'docker')
-rwxr-xr-xdocker/Dockerfile11
-rwxr-xr-xdocker/docker-entrypoint.sh18
-rwxr-xr-xdocker/instance_config.sh24
-rwxr-xr-xdocker/instance_init.sh23
4 files changed, 18 insertions, 58 deletions
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 72a366e5..2334995f 100755
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -9,9 +9,6 @@ ENV https_proxy $HTTPS_PROXY
RUN sed -i "s|set compatible|set nocompatible|" /etc/vim/vimrc.tiny
RUN echo "set backspace=2" >> /etc/vim/vimrc.tiny
-RUN echo "mysql-server mysql-server/root_password password root" | debconf-set-selections
-RUN echo "mysql-server mysql-server/root_password_again password root" | debconf-set-selections
-
RUN apt-get update && \
apt-get install -y python-virtualenv && \
apt-get install -y python-setuptools && \
@@ -19,8 +16,6 @@ RUN apt-get update && \
apt-get install -y python-pip && \
apt-get install -y gcc && \
apt-get install -y libmysqlclient-dev && \
- apt-get install -y redis-server && \
- apt-get install -y mysql-server && \
apt-get install -y mysql-client && \
apt-get install -y wget && \
apt-get install -y unzip && \
@@ -37,16 +32,10 @@ RUN wget -q -O vfc-nfvo-lcm.zip 'https://nexus.onap.org/service/local/artifact/m
unzip vfc-nfvo-lcm.zip && \
rm -rf vfc-nfvo-lcm.zip
-RUN sed -i "s|bind-address.*|# bind-address = 127.0.0.1|" /etc/mysql/my.cnf
-
-VOLUME /var/lib/mysql
-
WORKDIR /service/vfc/nfvo/lcm
RUN pip install --pre -r requirements.txt
EXPOSE 8403
-EXPOSE 3306
-EXPOSE 6379
WORKDIR /service
ENTRYPOINT vfc/nfvo/lcm/docker/docker-entrypoint.sh
diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh
index 3a309f7d..814d1798 100755
--- a/docker/docker-entrypoint.sh
+++ b/docker/docker-entrypoint.sh
@@ -5,17 +5,18 @@ if [ -z "$SERVICE_IP" ]; then
fi
echo "SERVICE_IP=$SERVICE_IP"
-if [ -z "$MYSQL_ROOT_PASSWORD" ]; then
- export MYSQL_ROOT_PASSWORD="root"
-fi
-echo "MYSQL_ROOT_PASSWORD=$MYSQL_ROOT_PASSWORD"
-
if [ -z "$MSB_ADDR" ]; then
echo "Missing required variable MSB_ADDR: Microservices Service Bus address <ip>:<port>"
exit 1
fi
echo "MSB_ADDR=$MSB_ADDR"
+if [ -z "$MYSQL_ADDR" ]; then
+ echo "Missing required variable MYSQL_ADDR: <ip>:<port>"
+ exit 1
+fi
+echo "MYSQL_ADDR=$MYSQL_ADDR"
+
# Wait for MSB initialization
echo "Wait for MSB initialization"
for i in {1..5}; do
@@ -23,6 +24,13 @@ for i in {1..5}; do
sleep $i
done
+# Wait for DB initialization
+echo "Wait for DB initialization"
+for i in {1..5}; do
+ curl -sS -m 1 $MYSQL_ADDR > /dev/null && break
+ sleep $i
+done
+
# Configure service based on docker environment variables
vfc/nfvo/lcm/docker/instance_config.sh
diff --git a/docker/instance_config.sh b/docker/instance_config.sh
index 3a9f3a03..dc811d3f 100755
--- a/docker/instance_config.sh
+++ b/docker/instance_config.sh
@@ -26,29 +26,13 @@ if [ $SERVICE_IP ]; then
sed -i "s|\"ip\": \".*\"|\"ip\": \"$SERVICE_IP\"|" vfc/nfvo/lcm/lcm/pub/config/config.py
fi
-if [ $REDIS_HOST ]; then
- sed -i "s|REDIS_HOST.*|REDIS_HOST = '$REDIS_HOST'|" vfc/nfvo/lcm/lcm/pub/config/config.py
-fi
-
-#if [ $SDC_BASE_URL ]; then
-# sed -i "s|SDC_BASE_URL.*|SDC_BASE_URL = '$SDC_BASE_URL'|" vfc/nfvo/lcm/lcm/pub/config/config.py
-#fi
-
-sed -i "s|DB_NAME.*|DB_NAME = 'vfcnfvolcm'|" vfc/nfvo/lcm/lcm/pub/config/config.py
-sed -i "s|DB_USER.*|DB_USER = 'vfcnfvolcm'|" vfc/nfvo/lcm/lcm/pub/config/config.py
-sed -i "s|DB_PASSWD.*|DB_PASSWD = 'vfcnfvolcm'|" vfc/nfvo/lcm/lcm/pub/config/config.py
-
# Configure MYSQL
-if [ -z "$MYSQL_ADDR" ]; then
- export MYSQL_IP=`hostname -i`
- export MYSQL_PORT=3306
- export MYSQL_ADDR=$MYSQL_IP:$MYSQL_PORT
-else
- MYSQL_IP=`echo $MYSQL_ADDR | cut -d: -f 1`
- MYSQL_PORT=`echo $MYSQL_ADDR | cut -d: -f 2`
-fi
+MYSQL_IP=`echo $MYSQL_ADDR | cut -d: -f 1`
+MYSQL_PORT=`echo $MYSQL_ADDR | cut -d: -f 2`
+
echo "MYSQL_ADDR=$MYSQL_ADDR"
sed -i "s|DB_IP.*|DB_IP = '$MYSQL_IP'|" vfc/nfvo/lcm/lcm/pub/config/config.py
sed -i "s|DB_PORT.*|DB_PORT = $MYSQL_PORT|" vfc/nfvo/lcm/lcm/pub/config/config.py
+sed -i "s|REDIS_HOST.*|REDIS_HOST = '$MYSQL_IP'|" vfc/nfvo/lcm/lcm/pub/config/config.py
cat vfc/nfvo/lcm/lcm/pub/config/config.py
diff --git a/docker/instance_init.sh b/docker/instance_init.sh
index daafcc26..cfc9b0d5 100755
--- a/docker/instance_init.sh
+++ b/docker/instance_init.sh
@@ -1,23 +1,2 @@
#!/bin/bash
-
-function start_redis_server {
- redis-server &
-}
-
-function start_mysql {
- service mysql start
- sleep 1
-}
-
-function create_database {
- cd /service/vfc/nfvo/lcm/resources/bin
- if [ ! -f dbexist.txt ]; then
- echo 1 > dbexist.txt
- bash initDB.sh root $MYSQL_ROOT_PASSWORD 3306 127.0.0.1
- fi
- cd /service
-}
-
-start_redis_server
-start_mysql
-create_database
+echo "No service needs init."