You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by mi...@apache.org on 2017/01/10 03:38:48 UTC

[36/50] incubator-trafficcontrol git commit: break docker-compose to smaller components

break docker-compose to smaller components


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/d5552db9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/d5552db9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/d5552db9

Branch: refs/heads/master
Commit: d5552db921282a1315c9f38a83e97bf284581691
Parents: 3476d77
Author: Dan Kirkwood <da...@gmail.com>
Authored: Mon Dec 12 15:10:27 2016 -0700
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Sun Jan 8 21:05:01 2017 -0700

----------------------------------------------------------------------
 traffic_ops/app/db/pg-migration/convert.yml     | 23 ++++++
 traffic_ops/app/db/pg-migration/dataimport.yml  | 26 +++++++
 .../app/db/pg-migration/docker-compose.yml      | 76 ++++++++------------
 traffic_ops/app/db/pg-migration/mysql.env       |  4 ++
 traffic_ops/app/db/pg-migration/mysql_host.yml  | 20 ++++++
 traffic_ops/app/db/pg-migration/pgloader.yml    | 24 +++++++
 traffic_ops/app/db/pg-migration/postgres.env    |  4 ++
 .../app/db/pg-migration/postgres_host.yml       | 26 +++++++
 8 files changed, 155 insertions(+), 48 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/d5552db9/traffic_ops/app/db/pg-migration/convert.yml
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/convert.yml b/traffic_ops/app/db/pg-migration/convert.yml
new file mode 100644
index 0000000..ab547e1
--- /dev/null
+++ b/traffic_ops/app/db/pg-migration/convert.yml
@@ -0,0 +1,23 @@
+#
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#
+version: '2'
+
+services:
+  # convert runs necessary post-import conversion(s) in postgres
+  convert:
+    build:
+      context: ..
+      dockerfile: pg-migration/Dockerfile-convert
+    env_file:
+      - postgres.env

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/d5552db9/traffic_ops/app/db/pg-migration/dataimport.yml
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/dataimport.yml b/traffic_ops/app/db/pg-migration/dataimport.yml
new file mode 100644
index 0000000..1087efa
--- /dev/null
+++ b/traffic_ops/app/db/pg-migration/dataimport.yml
@@ -0,0 +1,26 @@
+#
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#
+version: '2'
+
+services:
+  # dataimport reads data from an existing traffic_ops server running mysql thru the API
+  dataimport:
+    build:
+        context: .
+        dockerfile: Dockerfile-traffic_ops-client
+    restart: "no"
+    environment:
+      - TO_USER
+      - TO_PASSWORD
+      - TO_SERVER

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/d5552db9/traffic_ops/app/db/pg-migration/docker-compose.yml
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/docker-compose.yml b/traffic_ops/app/db/pg-migration/docker-compose.yml
index ce7c8b3..b611f75 100644
--- a/traffic_ops/app/db/pg-migration/docker-compose.yml
+++ b/traffic_ops/app/db/pg-migration/docker-compose.yml
@@ -19,81 +19,61 @@ volumes:
 services:
   # dataimport reads data from an existing traffic_ops server running mysql thru the API
   dataimport:
-    build:
-        context: .
-        dockerfile: Dockerfile-traffic_ops-client
-    restart: "no"
-    environment:
-      - TO_USER
-      - TO_PASSWORD
-      - TO_SERVER
-
+    extends:
+      service: dataimport
+      file: dataimport.yml
     volumes:
       - ./mysql/initdb.d:/docker-entrypoint-initdb.d
+    volumes:
+      - sync:/sync
 
   # mysql_host loads mysql data locally and provides direct access for pgloader
-  mysql_host:
-    image: mysql:5.6
-    restart: "no"
-    environment:
-      - MYSQL_DATABASE=traffic_ops_db
-      - MYSQL_RANDOM_ROOT_PASSWORD=yes
-      - MYSQL_PASSWORD=twelve
-      - MYSQL_USER=to_user
+  mysql:
+    extends:
+      service: mysql_host
+      file: mysql_host.yml
     depends_on:
       - dataimport
     volumes:
+      - sync:/sync
       - ./mysql/conf.d:/etc/mysql/conf.d
       - ./mysql/initdb.d:/docker-entrypoint-initdb.d
 
   # postgres_host provides a postgres data to import data to
-  postgres_host:
-    build:
-      context: ..
-      dockerfile: pg-migration/Dockerfile-postgres
-    restart: "no"
+  postgres:
+    extends:
+      service: postgres_host
+      file: postgres_host.yml
     environment:
       - POSTGRES_DB=traffic_ops
       - POSTGRES_PASSWORD=twelve
       - POSTGRES_USER=traffic_ops
+    depends_on:
+      - mysql
     volumes:
       - /opt/traffic_ops-db:/var/lib/postgresql/data
     ports:
       - 5432
+    volumes:
+      - sync:/sync
 
   # pgloader converts the data from mysql to postgres
   pgloader:
-    build:
-      context: ..
-      dockerfile: pg-migration/Dockerfile-pgloader
-    restart: "no"
+    extends:
+      service: pgloader
+      file: pgloader.yml
     depends_on:
-      - mysql_host
-      - postgres_host
-    environment:
-      - MYSQL_HOST=mysql_host
-      - MYSQL_DATABASE=traffic_ops_db
-      - MYSQL_PASSWORD=twelve
-      - MYSQL_USER=to_user
-      - POSTGRES_HOST=postgres_host
-      - POSTGRES_DB=traffic_ops
-      - POSTGRES_PASSWORD=twelve
-      - POSTGRES_USER=traffic_ops
+      - mysql
+      - postgres
     volumes:
       - sync:/sync
 
-  # convert runs necessary post-import conversion(s) in postgres
+  # convert runs needed post-migration conversions
   convert:
-    build:
-      context: ..
-      dockerfile: pg-migration/Dockerfile-convert
-    restart: "no"
+    extends:
+      service: convert
+      file: convert.yml
     depends_on:
-      - postgres_host
-    environment:
-      - POSTGRES_HOST=postgres_host
-      - POSTGRES_DB=traffic_ops
-      - POSTGRES_PASSWORD=twelve
-      - POSTGRES_USER=traffic_ops
+      - postgres
     volumes:
       - sync:/sync

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/d5552db9/traffic_ops/app/db/pg-migration/mysql.env
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/mysql.env b/traffic_ops/app/db/pg-migration/mysql.env
new file mode 100644
index 0000000..b6cba06
--- /dev/null
+++ b/traffic_ops/app/db/pg-migration/mysql.env
@@ -0,0 +1,4 @@
+MYSQL_DATABASE=traffic_ops_db
+MYSQL_RANDOM_ROOT_PASSWORD=yes
+MYSQL_PASSWORD=twelve
+MYSQL_USER=to_user

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/d5552db9/traffic_ops/app/db/pg-migration/mysql_host.yml
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/mysql_host.yml b/traffic_ops/app/db/pg-migration/mysql_host.yml
new file mode 100644
index 0000000..e7be262
--- /dev/null
+++ b/traffic_ops/app/db/pg-migration/mysql_host.yml
@@ -0,0 +1,20 @@
+#
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#
+version: '2'
+
+services:
+  mysql_host:
+    image: mysql:5.6
+    env_file:
+      - mysql.env

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/d5552db9/traffic_ops/app/db/pg-migration/pgloader.yml
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/pgloader.yml b/traffic_ops/app/db/pg-migration/pgloader.yml
new file mode 100644
index 0000000..23329a7
--- /dev/null
+++ b/traffic_ops/app/db/pg-migration/pgloader.yml
@@ -0,0 +1,24 @@
+#
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#
+version: '2'
+
+services:
+  # pgloader converts the data from mysql to postgres
+  pgloader:
+    build:
+      context: ..
+      dockerfile: pg-migration/Dockerfile-pgloader
+    env_file:
+      - mysql.env
+      - postgres.env

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/d5552db9/traffic_ops/app/db/pg-migration/postgres.env
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/postgres.env b/traffic_ops/app/db/pg-migration/postgres.env
new file mode 100644
index 0000000..dbd85cd
--- /dev/null
+++ b/traffic_ops/app/db/pg-migration/postgres.env
@@ -0,0 +1,4 @@
+POSTGRES_HOST=postgres_host
+POSTGRES_DB=traffic_ops
+POSTGRES_PASSWORD=twelve
+POSTGRES_USER=traffic_ops

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/d5552db9/traffic_ops/app/db/pg-migration/postgres_host.yml
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/postgres_host.yml b/traffic_ops/app/db/pg-migration/postgres_host.yml
new file mode 100644
index 0000000..f8e0439
--- /dev/null
+++ b/traffic_ops/app/db/pg-migration/postgres_host.yml
@@ -0,0 +1,26 @@
+#
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#
+version: '2'
+
+services:
+  postgres_host:
+    build:
+      context: ..
+      dockerfile: pg-migration/Dockerfile-postgres
+    environment:
+      - POSTGRES_DB=traffic_ops
+      - POSTGRES_PASSWORD=twelve
+      - POSTGRES_USER=traffic_ops
+    ports:
+      - 5432