You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by ne...@apache.org on 2016/11/21 16:38:06 UTC

[1/4] incubator-trafficcontrol git commit: add more casts

Repository: incubator-trafficcontrol
Updated Branches:
  refs/heads/psql-rebase 030507336 -> 29eb31789


add more casts


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

Branch: refs/heads/psql-rebase
Commit: 88cf38c21f3c9fb5758bafb8fea6db930f31e89c
Parents: cee22b7
Author: Dan Kirkwood <da...@gmail.com>
Authored: Fri Nov 18 17:47:45 2016 -0700
Committer: David Neuman <da...@gmail.com>
Committed: Mon Nov 21 09:36:16 2016 -0700

----------------------------------------------------------------------
 traffic_ops/app/db/pg-migration/runpgloader.sh | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/88cf38c2/traffic_ops/app/db/pg-migration/runpgloader.sh
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/runpgloader.sh b/traffic_ops/app/db/pg-migration/runpgloader.sh
index 3ae3055..9f698f3 100755
--- a/traffic_ops/app/db/pg-migration/runpgloader.sh
+++ b/traffic_ops/app/db/pg-migration/runpgloader.sh
@@ -10,4 +10,9 @@ for c in "$POSTGRES_HOST 5432" "$MYSQL_HOST 3306"; do
 	done
 done
 
-pgloader -v --cast 'type tinyint to smallint drop typemod' mysql://$MYSQL_USER:$MYSQL_PASSWORD@$MYSQL_HOST/traffic_ops_db postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST/$POSTGRES_DB
+pgloader -v \
+	--cast 'type tinyint to smallint drop typemod' \
+	--cast 'type varchar to text drop typemod' \
+	--cast 'type double to numeric drop typemod' \
+	mysql://$MYSQL_USER:$MYSQL_PASSWORD@$MYSQL_HOST/traffic_ops_db \
+	postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST/$POSTGRES_DB


[3/4] incubator-trafficcontrol git commit: add traffic ops client container to grab TO from old server

Posted by ne...@apache.org.
add traffic ops client container to grab TO from old server


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

Branch: refs/heads/psql-rebase
Commit: be813150e0a2d86acd19ee1091760325f10a1f7d
Parents: 0305073
Author: Dan Kirkwood <da...@gmail.com>
Authored: Wed Nov 16 16:44:08 2016 -0700
Committer: David Neuman <da...@gmail.com>
Committed: Mon Nov 21 09:36:16 2016 -0700

----------------------------------------------------------------------
 .../db/pg-migration/Dockerfile-traffic_ops-client | 14 ++++++++++++++
 .../app/db/pg-migration/docker-compose.yml        | 18 ++++++++++++++++++
 traffic_ops/app/db/pg-migration/get-to-data.sh    | 15 +++++++++++++++
 .../mysql/initdb.d/AAA-wait-for-data.sh           |  6 ++++++
 4 files changed, 53 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/be813150/traffic_ops/app/db/pg-migration/Dockerfile-traffic_ops-client
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/Dockerfile-traffic_ops-client b/traffic_ops/app/db/pg-migration/Dockerfile-traffic_ops-client
new file mode 100644
index 0000000..f8a6018
--- /dev/null
+++ b/traffic_ops/app/db/pg-migration/Dockerfile-traffic_ops-client
@@ -0,0 +1,14 @@
+FROM debian
+MAINTAINER Dan Kirkwood <da...@apache.org>
+
+# install nc to check that postgres and mysql are ready..
+RUN apt-get -y update && apt-get -y install curl
+
+ENV TO_SERVER=$TO_SERVER
+ENV TO_USER=$TO_USER
+ENV TO_PASSWORD=$TO_PASSWORD
+
+ADD get-to-data.sh /
+
+# get data, trigger mysql startup
+CMD /get-to-data.sh /docker-entrypoint-initdb.d/traffic_ops.sql

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/be813150/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 2d0a0b8..ef17488 100644
--- a/traffic_ops/app/db/pg-migration/docker-compose.yml
+++ b/traffic_ops/app/db/pg-migration/docker-compose.yml
@@ -1,5 +1,18 @@
 version: '2'
 services:
+  dataimport:
+    build:
+        dockerfile: Dockerfile-traffic_ops-client
+        context: .
+    restart: "no"
+    environment:
+      - TO_USER
+      - TO_PASSWORD
+      - TO_SERVER
+
+    volumes:
+      - ./mysql/initdb.d:/docker-entrypoint-initdb.d
+
   mysql_host:
     image: mysql:5.6
     restart: "no"
@@ -8,6 +21,8 @@ services:
       - MYSQL_RANDOM_ROOT_PASSWORD=yes
       - MYSQL_PASSWORD=twelve
       - MYSQL_USER=to_user
+    depends_on:
+      - dataimport
     volumes:
       - ./mysql/conf.d:/etc/mysql/conf.d
       - ./mysql/initdb.d:/docker-entrypoint-initdb.d
@@ -29,6 +44,9 @@ services:
       dockerfile: Dockerfile-pgloader
       context: .
     restart: "no"
+    depends_on:
+      - mysql_host
+      - postgres_host
     environment:
       - MYSQL_HOST=mysql_host
       - MYSQL_DATABASE=traffic_ops_db

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/be813150/traffic_ops/app/db/pg-migration/get-to-data.sh
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/get-to-data.sh b/traffic_ops/app/db/pg-migration/get-to-data.sh
new file mode 100755
index 0000000..a4676fe
--- /dev/null
+++ b/traffic_ops/app/db/pg-migration/get-to-data.sh
@@ -0,0 +1,15 @@
+#!/bin/bash -x
+
+output=$1
+[[ -n $output ]] && output="-o $output"
+
+
+cookiejar=/tmp/cookiejar
+cred=/tmp/cred.json
+
+cat >$cred <<-CREDS
+	{ "u" : "$TO_USER", "p" : "$TO_PASSWORD" }
+CREDS
+
+curl -k -H "Accept: application/json" --cookie "$cookiejar" --cookie-jar "$cookiejar" -X POST --data @"$cred" "$TO_SERVER/api/1.2/user/login"
+curl $output -k -s --cookie "$cookiejar" -X GET "$TO_SERVER/dbdump"

http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/be813150/traffic_ops/app/db/pg-migration/mysql/initdb.d/AAA-wait-for-data.sh
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/mysql/initdb.d/AAA-wait-for-data.sh b/traffic_ops/app/db/pg-migration/mysql/initdb.d/AAA-wait-for-data.sh
new file mode 100755
index 0000000..69681ab
--- /dev/null
+++ b/traffic_ops/app/db/pg-migration/mysql/initdb.d/AAA-wait-for-data.sh
@@ -0,0 +1,6 @@
+#!/bin/bash -x
+
+# wait for traffic_ops.sql file to appear
+while [[ ! -f /docker-entrypoint-initdb.d/traffic_ops.sql ]]; do
+	sleep 1
+done


[4/4] incubator-trafficcontrol git commit: This closes #91

Posted by ne...@apache.org.
This closes #91


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

Branch: refs/heads/psql-rebase
Commit: 29eb317899e68173fcc40f33544ecdb72ee72f6d
Parents: 88cf38c
Author: David Neuman <da...@gmail.com>
Authored: Mon Nov 21 09:36:41 2016 -0700
Committer: David Neuman <da...@gmail.com>
Committed: Mon Nov 21 09:36:41 2016 -0700

----------------------------------------------------------------------

----------------------------------------------------------------------



[2/4] incubator-trafficcontrol git commit: update psql migration README

Posted by ne...@apache.org.
update psql migration README


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

Branch: refs/heads/psql-rebase
Commit: cee22b79e4d7cf0c75d935ed0a29039f0b3f8fd9
Parents: be81315
Author: Dan Kirkwood <da...@gmail.com>
Authored: Thu Nov 17 18:46:40 2016 +0000
Committer: David Neuman <da...@gmail.com>
Committed: Mon Nov 21 09:36:16 2016 -0700

----------------------------------------------------------------------
 traffic_ops/app/db/pg-migration/README.md | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/cee22b79/traffic_ops/app/db/pg-migration/README.md
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/README.md b/traffic_ops/app/db/pg-migration/README.md
index ed31e54..89ace35 100644
--- a/traffic_ops/app/db/pg-migration/README.md
+++ b/traffic_ops/app/db/pg-migration/README.md
@@ -1,19 +1,21 @@
 
 # Converting existing mysql `traffic_ops` database to postgres
 
-* Requires `docker-engine` and `docker-compose`.
+* Requires a recent ( 1.12 ) version of `docker-engine` and `docker-compose`.
 
 * Ensure database is up-to-date with latest `traffic_ops` migrations for `mysql` (last 1.x release of `traffic_ops`)
   * `cd /opt/traffic_ops/app;  ./db/admin.pl --env=production upgrade`
 
-* Get a database dump from `traffic_ops`
-  * `Tools->DB Dump`
-
 * In development environment, `cd traffic_ops/app/db/pg-migration`.
 
-* Move the `mysql` database dump file into `./mysql/initdb.d` directory.  The file must have a `.sql` suffix.
+* Provide URL, username password for existing mysql install of `traffic_ops`:
 
-* `docker-compose down -v && docker-compose build && docker-compose up`
+  * `docker-compose down -v && docker-compose build && TO_SERVER=https://traffic_ops.kabletown.com TO_USER=me TO_PASSWORD='my!passwd' docker-compose up`
 
 * Postgres is still running in a docker container -- dump the database to a file:
   `docker exec -it pgmigration_postgres_host_1 pg_dump -Utraffic_ops >pg.sql`
+
+* Or examine the database directly:
+  * `docker run -it --rm --network pgmigration_default --link pgmigration_postgres_host_1:postgres postgres psql -h postgres -U traffic_ops -d traffic_ops`
+  * `\dt`
+  * `select * from cdns;`