You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by de...@apache.org on 2018/06/14 18:05:18 UTC

[trafficcontrol] 06/20: use one network; better readiness check

This is an automated email from the ASF dual-hosted git repository.

dewrich pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git

commit 43d86b562e304c73a8b65abef1e30721dd9d8dc8
Author: Dan Kirkwood <da...@gmail.com>
AuthorDate: Fri Jun 1 22:10:16 2018 +0000

    use one network; better readiness check
---
 .../cdn-in-a-box/traffic_ops/docker-compose.yml    | 25 +++++++---------------
 infrastructure/cdn-in-a-box/traffic_ops/run.sh     | 12 +++++++++--
 2 files changed, 18 insertions(+), 19 deletions(-)

diff --git a/infrastructure/cdn-in-a-box/traffic_ops/docker-compose.yml b/infrastructure/cdn-in-a-box/traffic_ops/docker-compose.yml
index 23f91ee..579403c 100644
--- a/infrastructure/cdn-in-a-box/traffic_ops/docker-compose.yml
+++ b/infrastructure/cdn-in-a-box/traffic_ops/docker-compose.yml
@@ -33,7 +33,7 @@
 version: '2.1'
 
 networks:
-  dbnet:
+  tcnet:
     driver: bridge
     enable_ipv6: true
     ipam:
@@ -41,20 +41,12 @@ networks:
       config:
         - subnet: 172.13.239.0/24
         - subnet: "fc01:9400:1000:8::/64"
-  trafficopsnet:
-    driver: bridge
-    enable_ipv6: true
-    ipam:
-      driver: default
-      config:
-        - subnet: 172.13.238.0/24
-        - subnet: "fc01:9400:1000:7::/64"
 
 services:
   db:
     image: postgres:9.6.6
     networks:
-      - dbnet
+      - tcnet
     env_file:
       - variables.env
     # TODO: change to expose: "5432" to limit to containers
@@ -63,7 +55,7 @@ services:
 
   dbinit:
     networks:
-      - dbnet
+      - tcnet
     env_file:
       - variables.env
     build:
@@ -75,8 +67,7 @@ services:
   trafficops-perl:
     image: trafficops-perl
     networks:
-      - dbnet
-      - trafficopsnet
+      - tcnet
     env_file:
       - variables.env
     expose: 
@@ -86,13 +77,12 @@ services:
       args:
         RPM: traffic_ops.rpm 
     depends_on:
-      - dbinit
+      - db
 
   trafficops:
     image: trafficops-go
     networks:
-      - dbnet
-      - trafficopsnet
+      - tcnet
     env_file:
       - variables.env
     ports: 
@@ -101,4 +91,5 @@ services:
       context: .
       dockerfile: Dockerfile-go
     depends_on:
-      - dbinit
+      - db
+      - trafficops-perl
diff --git a/infrastructure/cdn-in-a-box/traffic_ops/run.sh b/infrastructure/cdn-in-a-box/traffic_ops/run.sh
index b56d6f4..c635ae3 100755
--- a/infrastructure/cdn-in-a-box/traffic_ops/run.sh
+++ b/infrastructure/cdn-in-a-box/traffic_ops/run.sh
@@ -45,10 +45,16 @@ do
 done
 
 # Write config files
-if [[ -x /config.sh ]]; then
-	/config.sh
+set -x
+if [[ -r /config.sh ]]; then
+	. /config.sh
 fi
 
+while ! nc $DB_SERVER $DB_PORT </dev/null; do # &>/dev/null; do
+        echo "waiting for $DB_SERVER $DB_PORT"
+        sleep 3
+done
+
 while true; do
 	echo "Checking for existence of role $DB_USER"
 	psql -U postgres -h $DB_SERVER -p $DB_PORT postgres -tAc "SELECT 1 FROM pg_roles WHERE rolname='$DB_USER'" | grep -q 1 && break
@@ -56,6 +62,8 @@ while true; do
 done
 
 TO_DIR=/opt/traffic_ops/app
+cat conf/production/database.conf
+
 export PERL5LIB=$TO_DIR/lib:$TO_DIR/local/lib/perl5
 cd $TO_DIR && ./db/admin.pl -env production reset
 

-- 
To stop receiving notification emails like this one, please contact
dewrich@apache.org.