You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by da...@apache.org on 2017/05/16 19:41:27 UTC
[1/5] incubator-trafficcontrol git commit: added cleanup for the
waiter container
Repository: incubator-trafficcontrol
Updated Branches:
refs/heads/master 23791a5e3 -> f9e1aaf20
added cleanup for the waiter container
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/72ca7cfc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/72ca7cfc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/72ca7cfc
Branch: refs/heads/master
Commit: 72ca7cfce02b068068df5ee72e8d5bcb834c2d60
Parents: c0157f5
Author: Dewayne Richardson <de...@apache.org>
Authored: Sun May 14 08:09:24 2017 -0600
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Tue May 16 13:40:46 2017 -0600
----------------------------------------------------------------------
traffic_ops_db/pg-migration/migrate.sh | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/72ca7cfc/traffic_ops_db/pg-migration/migrate.sh
----------------------------------------------------------------------
diff --git a/traffic_ops_db/pg-migration/migrate.sh b/traffic_ops_db/pg-migration/migrate.sh
index f5b4388..3cb029d 100755
--- a/traffic_ops_db/pg-migration/migrate.sh
+++ b/traffic_ops_db/pg-migration/migrate.sh
@@ -107,6 +107,8 @@ function clean() {
docker rmi $IMAGE --force
IMAGE=$docker_project"_waiter"
docker rmi $IMAGE --force
+ IMAGE=$IMAGE"_1"
+ docker rm $IMAGE
# Cleanup any dangling volumes
docker volume rm $(docker volume ls -qf dangling=true)
[5/5] incubator-trafficcontrol git commit: This closes #573.
Posted by da...@apache.org.
This closes #573.
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/f9e1aaf2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/f9e1aaf2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/f9e1aaf2
Branch: refs/heads/master
Commit: f9e1aaf203d15dee8a581bad9228c5b45a189fac
Parents: 72ca7cf
Author: Dan Kirkwood <da...@gmail.com>
Authored: Tue May 16 13:41:18 2017 -0600
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Tue May 16 13:41:18 2017 -0600
----------------------------------------------------------------------
----------------------------------------------------------------------
[4/5] incubator-trafficcontrol git commit: added installer for the
Postgres Docker service-a
Posted by da...@apache.org.
added installer for the Postgres Docker service-a
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/e4872fdf
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/e4872fdf
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/e4872fdf
Branch: refs/heads/master
Commit: e4872fdf24ab0dd464933e5866bd04848dabbf11
Parents: ac0d7d7
Author: Dewayne Richardson <de...@apache.org>
Authored: Thu May 11 15:11:47 2017 -0600
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Tue May 16 13:40:46 2017 -0600
----------------------------------------------------------------------
traffic_ops_db/bin/install_systemd_unit.sh | 4 +++
traffic_ops_db/systemd/traffic_ops_db.service | 30 ++++++++++++++++++++++
2 files changed, 34 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/e4872fdf/traffic_ops_db/bin/install_systemd_unit.sh
----------------------------------------------------------------------
diff --git a/traffic_ops_db/bin/install_systemd_unit.sh b/traffic_ops_db/bin/install_systemd_unit.sh
index 321a101..454b3e2 100644
--- a/traffic_ops_db/bin/install_systemd_unit.sh
+++ b/traffic_ops_db/bin/install_systemd_unit.sh
@@ -14,3 +14,7 @@
# limitations under the License.
#
+systemctl enable traffic_ops_db.service
+
+printf "\nNow you can start manually start the traffic_ops service with the command:\n"
+printf "systemctl start traffic_ops_db\n"
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/e4872fdf/traffic_ops_db/systemd/traffic_ops_db.service
----------------------------------------------------------------------
diff --git a/traffic_ops_db/systemd/traffic_ops_db.service b/traffic_ops_db/systemd/traffic_ops_db.service
new file mode 100644
index 0000000..31110e3
--- /dev/null
+++ b/traffic_ops_db/systemd/traffic_ops_db.service
@@ -0,0 +1,30 @@
+
+#
+# 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.
+#
+#-----------------------------------------
+# {{ ansible_managed }}
+#-----------------------------------------
+#
+[Unit]
+Description=Traffic Ops Postgres Docker Container
+Requires=docker.service
+After=docker.service
+
+[Service]
+Restart=always
+ExecStart=/usr/bin/docker-compose -p trafficops -f /opt/traffic_ops_db/docker/docker-compose.yml up
+ExecStop=/usr/bin/docker-compose -p trafficops -f /opt/traffic_ops_db/docker/docker-compose.yml stop
+
+[Install]
+WantedBy=default.target
[2/5] incubator-trafficcontrol git commit: added installer for the
Postgres Docker service
Posted by da...@apache.org.
added installer for the Postgres Docker service
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/c0157f53
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/c0157f53
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/c0157f53
Branch: refs/heads/master
Commit: c0157f5374488cb194666e89e70819f09c537f5e
Parents: e4872fd
Author: Dewayne Richardson <de...@apache.org>
Authored: Thu May 11 15:11:48 2017 -0600
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Tue May 16 13:40:46 2017 -0600
----------------------------------------------------------------------
traffic_ops/app/db/convert_bools.sql | 112 -----------------
.../app/db/pg-migration/Dockerfile-convert | 28 -----
.../app/db/pg-migration/Dockerfile-mysql | 26 ----
.../pg-migration/Dockerfile-mysql-to-postgres | 38 ------
.../app/db/pg-migration/Dockerfile-pgloader | 19 ---
.../app/db/pg-migration/Dockerfile-postgres | 29 -----
.../app/db/pg-migration/Dockerfile-waiter | 24 ----
traffic_ops/app/db/pg-migration/README.md | 16 ---
traffic_ops/app/db/pg-migration/convert.yml | 23 ----
traffic_ops/app/db/pg-migration/migrate.sh | 121 -------------------
.../app/db/pg-migration/mysql-to-postgres.env | 43 -------
.../app/db/pg-migration/mysql-to-postgres.sh | 65 ----------
.../app/db/pg-migration/mysql-to-postgres.yml | 24 ----
.../app/db/pg-migration/mysql/conf.d/mysql.cnf | 21 ----
traffic_ops/app/db/pg-migration/mysql_host.yml | 24 ----
traffic_ops/app/db/pg-migration/pgloader.yml | 23 ----
traffic_ops/app/db/pg-migration/postgres.yml | 34 ------
traffic_ops/app/db/pg-migration/runconvert.sh | 15 ---
traffic_ops/app/db/pg-migration/runmysql.sh | 16 ---
traffic_ops/app/db/pg-migration/runpgloader.sh | 24 ----
traffic_ops/app/db/pg-migration/runwaiter.sh | 13 --
.../app/db/pg-migration/start_postgres.sh | 54 ---------
traffic_ops/app/db/pg-migration/waiter.yml | 24 ----
traffic_ops/app/db/reset.sh | 16 ---
traffic_ops/app/db/setup_migrations.sql | 17 ---
25 files changed, 849 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/c0157f53/traffic_ops/app/db/convert_bools.sql
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/convert_bools.sql b/traffic_ops/app/db/convert_bools.sql
deleted file mode 100644
index 5835e6c..0000000
--- a/traffic_ops/app/db/convert_bools.sql
+++ /dev/null
@@ -1,112 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one
--- or more contributor license agreements. See the NOTICE file
--- distributed with this work for additional information
--- regarding copyright ownership. The ASF licenses this file
--- to you 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.
-
-ALTER TABLE cdn
- ALTER COLUMN dnssec_enabled DROP DEFAULT,
- ALTER COLUMN dnssec_enabled TYPE boolean
- USING CASE WHEN dnssec_enabled = 1 THEN TRUE
- ELSE FALSE
- END,
- ALTER COLUMN dnssec_enabled SET DEFAULT FALSE;
-
-ALTER TABLE deliveryservice
- ALTER COLUMN active DROP DEFAULT,
- ALTER COLUMN active TYPE boolean
- USING CASE WHEN active = 1 THEN TRUE
- ELSE FALSE
- END,
- ALTER COLUMN active SET DEFAULT FALSE;
-
-ALTER TABLE deliveryservice
- ALTER COLUMN signed DROP DEFAULT,
- ALTER COLUMN signed TYPE boolean
- USING CASE WHEN signed = 1 THEN TRUE
- ELSE FALSE
- END,
- ALTER COLUMN signed SET DEFAULT FALSE;
-
-ALTER TABLE deliveryservice
- ALTER COLUMN ipv6_routing_enabled DROP DEFAULT,
- ALTER COLUMN ipv6_routing_enabled TYPE boolean
- USING CASE WHEN ipv6_routing_enabled = 1 THEN TRUE
- ELSE FALSE
- END,
- ALTER COLUMN ipv6_routing_enabled SET DEFAULT FALSE;
-
-ALTER TABLE deliveryservice
- ALTER COLUMN multi_site_origin DROP DEFAULT,
- ALTER COLUMN multi_site_origin TYPE boolean
- USING CASE WHEN multi_site_origin = 1 THEN TRUE
- ELSE FALSE
- END,
- ALTER COLUMN multi_site_origin SET DEFAULT FALSE;
-
-ALTER TABLE deliveryservice
- ALTER COLUMN regional_geo_blocking DROP DEFAULT,
- ALTER COLUMN regional_geo_blocking TYPE boolean
- USING CASE WHEN regional_geo_blocking = 1 THEN TRUE
- ELSE FALSE
- END,
- ALTER COLUMN regional_geo_blocking SET DEFAULT FALSE;
-
-ALTER TABLE deliveryservice
- ALTER COLUMN logs_enabled DROP DEFAULT,
- ALTER COLUMN logs_enabled TYPE boolean
- USING CASE WHEN logs_enabled = 1 THEN TRUE
- ELSE FALSE
- END,
- ALTER COLUMN logs_enabled SET DEFAULT FALSE;
-
- ALTER TABLE goose_db_version
- ALTER COLUMN is_applied DROP DEFAULT,
- ALTER COLUMN is_applied TYPE boolean
- USING CASE WHEN is_applied = 1 THEN TRUE
- ELSE FALSE
- END,
- ALTER COLUMN is_applied SET DEFAULT FALSE;
-
-ALTER TABLE parameter
- ALTER COLUMN secure DROP DEFAULT,
- ALTER COLUMN secure TYPE boolean
- USING CASE WHEN secure = 1 THEN TRUE
- ELSE FALSE
- END,
- ALTER COLUMN secure SET DEFAULT FALSE;
-
-ALTER TABLE server
- ALTER COLUMN upd_pending DROP DEFAULT,
- ALTER COLUMN upd_pending TYPE boolean
- USING CASE WHEN upd_pending = 1 THEN TRUE
- ELSE FALSE
- END,
- ALTER COLUMN upd_pending SET DEFAULT FALSE;
-
-ALTER TABLE tm_user
- ALTER COLUMN new_user DROP DEFAULT,
- ALTER COLUMN new_user TYPE boolean
- USING CASE WHEN new_user = 1 THEN TRUE
- ELSE FALSE
- END,
- ALTER COLUMN new_user SET DEFAULT FALSE;
-
-ALTER TABLE to_extension
- ALTER COLUMN isactive DROP DEFAULT,
- ALTER COLUMN isactive TYPE boolean
- USING CASE WHEN isactive = 1 THEN TRUE
- ELSE FALSE
- END,
- ALTER COLUMN isactive SET DEFAULT FALSE;
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/c0157f53/traffic_ops/app/db/pg-migration/Dockerfile-convert
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/Dockerfile-convert b/traffic_ops/app/db/pg-migration/Dockerfile-convert
deleted file mode 100644
index 941912f..0000000
--- a/traffic_ops/app/db/pg-migration/Dockerfile-convert
+++ /dev/null
@@ -1,28 +0,0 @@
-#
-# 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.
-#
-FROM dewrich/postgres:latest
-
-MAINTAINER Dan Kirkwood
-
-# Postgres Access
-ENV POSTGRES_HOST=$POSTGRES_HOST
-ENV POSTGRES_PORT=$POSTGRES_PORT
-ENV POSTGRES_DATABASE=$POSTGRES_DATABASE
-ENV POSTGRES_PASSWORD=$POSTGRES_PASSWORD
-
-RUN apt-get update
-ADD pg-migration/runconvert.sh .
-ADD convert_bools.sql .
-
-CMD ./runconvert.sh
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/c0157f53/traffic_ops/app/db/pg-migration/Dockerfile-mysql
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/Dockerfile-mysql b/traffic_ops/app/db/pg-migration/Dockerfile-mysql
deleted file mode 100644
index 0b3d0df..0000000
--- a/traffic_ops/app/db/pg-migration/Dockerfile-mysql
+++ /dev/null
@@ -1,26 +0,0 @@
-#
-# 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.
-#
-FROM mysql:5.6
-
-MAINTAINER Dan Kirkwood
-
-# Mysql Access
-ENV MYSQL_HOST=$MYSQL_HOST
-ENV MYSQL_PORT=$MYSQL_PORT
-ENV MYSQL_PASSWORD=$MYSQL_PASSWORD
-ENV MYSQL_DATABASE=$MYSQL_DATABASE
-
-EXPOSE 3306
-ADD runmysql.sh /
-CMD /runmysql.sh
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/c0157f53/traffic_ops/app/db/pg-migration/Dockerfile-mysql-to-postgres
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/Dockerfile-mysql-to-postgres b/traffic_ops/app/db/pg-migration/Dockerfile-mysql-to-postgres
deleted file mode 100644
index b1da689..0000000
--- a/traffic_ops/app/db/pg-migration/Dockerfile-mysql-to-postgres
+++ /dev/null
@@ -1,38 +0,0 @@
-#
-# 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.
-#
-FROM dimitri/pgloader:latest
-MAINTAINER Dan Kirkwood <da...@apache.org>
-
-# Traffic Ops Access
-ENV TO_SERVER=$TO_SERVER
-ENV TO_USER=$TO_USER
-ENV TO_PASSWORD=$TO_PASSWORD
-
-# Mysql Access
-ENV MYSQL_HOST=$MYSQL_HOST
-ENV MYSQL_PORT=$MYSQL_PORT
-ENV MYSQL_PASSWORD=$MYSQL_PASSWORD
-ENV MYSQL_DATABASE=$MYSQL_DATABASE
-
-# Postgres Access
-ENV POSTGRES_HOST=$POSTGRES_HOST
-ENV POSTGRES_PORT=$POSTGRES_PORT
-ENV POSTGRES_DATABASE=$POSTGRES_DATABASE
-ENV POSTGRES_PASSWORD=$POSTGRES_PASSWORD
-
-# install the tools for getting data
-RUN apt-get -y update && apt-get -y install curl mysql-client
-
-ADD mysql-to-postgres.sh .
-CMD ./mysql-to-postgres.sh
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/c0157f53/traffic_ops/app/db/pg-migration/Dockerfile-pgloader
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/Dockerfile-pgloader b/traffic_ops/app/db/pg-migration/Dockerfile-pgloader
deleted file mode 100644
index fec7f97..0000000
--- a/traffic_ops/app/db/pg-migration/Dockerfile-pgloader
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# 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.
-#
-FROM dimitri/pgloader:latest
-MAINTAINER Dan Kirkwood <da...@apache.org>
-
-ADD pg-migration/runpgloader.sh .
-ADD create_tables.sql .
-CMD ./runpgloader.sh
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/c0157f53/traffic_ops/app/db/pg-migration/Dockerfile-postgres
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/Dockerfile-postgres b/traffic_ops/app/db/pg-migration/Dockerfile-postgres
deleted file mode 100644
index 6f3c634..0000000
--- a/traffic_ops/app/db/pg-migration/Dockerfile-postgres
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-# 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.
-#
-FROM dewrich/postgres:latest
-
-MAINTAINER Dan Kirkwood
-
-# Postgres Access
-ENV POSTGRES_HOST=$POSTGRES_HOST
-ENV POSTGRES_PORT=$POSTGRES_PORT
-ENV POSTGRES_DATABASE=$POSTGRES_DATABASE
-ENV POSTGRES_PASSWORD=$POSTGRES_PASSWORD
-
-# Adjust PostgreSQL configuration so that remote connections to the
-# database are possible.
-RUN echo "host all all 0.0.0.0/0 md5" >> $PGDATA/pg_hba.conf
-RUN echo "listen_addresses='*'" >> $PGDATA/postgresql.conf
-
-EXPOSE "5432:5432"
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/c0157f53/traffic_ops/app/db/pg-migration/Dockerfile-waiter
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/Dockerfile-waiter b/traffic_ops/app/db/pg-migration/Dockerfile-waiter
deleted file mode 100644
index 0531c71..0000000
--- a/traffic_ops/app/db/pg-migration/Dockerfile-waiter
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# 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.
-#
-FROM dimitri/pgloader:latest
-
-MAINTAINER Dewayne Richardson
-
-RUN apt-get -y update && apt-get -y install netcat
-
-ENV WAITER_HOST=$WAITER_HOST
-ENV WAITER_PORT=$WAITER_PORT
-
-ADD pg-migration/runwaiter.sh .
-CMD ./runwaiter.sh
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/c0157f53/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
deleted file mode 100644
index 8ff9d67..0000000
--- a/traffic_ops/app/db/pg-migration/README.md
+++ /dev/null
@@ -1,16 +0,0 @@
-# Converts existing mysql `traffic_ops` database to postgres
-
-* Requires a recent ( 1.12 ) version of `docker-engine` and `docker-compose`.
-
-* Modify the mysql-to-postgres.env file for the parameters in your Migration
-
-* Ensure that your new Postgres service is running (local or remote)
-
-* Run your Postgres Instance and configure mysql-to-postgres.env accordingly
-
-* A sample Postgres Docker container has been provided for testing
- * `sh start_postgres.sh`
-
-
-* Run the Mysql to Postgres Migration Docker flow
- * `sh migrate.sh`
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/c0157f53/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
deleted file mode 100644
index fb130e9..0000000
--- a/traffic_ops/app/db/pg-migration/convert.yml
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# 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:
- - mysql-to-postgres.env
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/c0157f53/traffic_ops/app/db/pg-migration/migrate.sh
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/migrate.sh b/traffic_ops/app/db/pg-migration/migrate.sh
deleted file mode 100755
index 46ce9a1..0000000
--- a/traffic_ops/app/db/pg-migration/migrate.sh
+++ /dev/null
@@ -1,121 +0,0 @@
-#!/bin/bash
-#
-# 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.
-#
-
-. mysql-to-postgres.env
-
-#Traffic Ops Settings
-# The following configs should be configured to point to the
-# Traffic Ops instances that is connected to the MySQL that
-# you want to convert
-separator="---------------------------------------"
-docker_project="pgmigration"
-
-function display_env() {
-
- echo "TO_SERVER: $TO_SERVER"
- echo "TO_USER: $TO_USER"
- echo "TO_PASSWORD: $TO_PASSWORD"
- echo "MYSQL_HOST: $MYSQL_HOST"
- echo "MYSQL_PORT: $MYSQL_PORT"
- echo "MYSQL_DATABASE: $MYSQL_DATABASE"
- echo "MYSQL_USER: $MYSQL_USER"
- echo "MYSQL_PASSWORD: $MYSQL_PASSWORD"
-
- echo "POSTGRES_HOST: $POSTGRES_HOST"
- echo "POSTGRES_PORT: $POSTGRES_PORT"
- echo "POSTGRES_DATABASE: $POSTGRES_DATABASE"
- echo "POSTGRES_USER: $POSTGRES_USER"
- echo "POSTGRES_PASSOWRD: $POSTGRES_PASSWORD"
- echo "PGDATA: $PGDATA"
- echo "PGDATA_VOLUME: $PGDATA_VOLUME"
- echo "PGLOGS_VOLUME: $PGLOGS_VOLUME"
-
-}
-
-
-function start_staging_mysql_server() {
-
- docker-compose -p $docker_project -f mysql_host.yml down --remove-orphans
- docker-compose -p $docker_project -f mysql_host.yml up --build -d
-
- #Wait for MySQL to come up
- export WAITER_HOST=$MYSQL_HOST
- export WAITER_PORT=$MYSQL_PORT
- docker-compose -p $docker_project -f waiter.yml up --build
- echo $separator
- echo "Mysql Host is started..."
- echo $separator
-
- #Ensure the Postgres instance is up
- export WAITER_HOST=$POSTGRES_HOST
- export WAITER_PORT=$POSTGRES_PORT
- docker-compose -p $docker_project -f waiter.yml up --build
- echo $separator
- echo "Postgres Host is started..."
- echo $separator
-
-}
-
-function migrate_data_from_mysql_to_postgres() {
-
- echo $separator
- echo "Starting Mysql to Postgres Migration..."
- echo $separator
- docker-compose -p $docker_project -f mysql-to-postgres.yml down
- docker-compose -p $docker_project -f mysql-to-postgres.yml up --build
-}
-
-
-function run_postgres_datatypes_conversion() {
- echo $separator
- echo "Starting Mysql to Postgres Datatype Conversion..."
- echo $separator
- docker-compose -p $docker_project -f convert.yml up --build
-}
-
-
-function clean() {
- echo $separator
- echo "Cleaning up..."
- echo $separator
-
- # Powerdown the containers (to remove them)
- docker-compose -p $docker_project -f waiter.yml down --remove-orphans
- docker-compose -p $docker_project -f mysql-to-postgres.yml down --remove-orphans
- docker-compose -p $docker_project -f convert.yml down --remove-orphans
-
- # Cleanup any temporary images
- IMAGE=$docker_project"_mysql-to-postgres"
- echo "IMAGE: $IMAGE"
- docker rmi $IMAGE
- IMAGE=$docker_project"_convert"
- docker rmi $IMAGE
- docker rmi mysql:5.6
- docker rmi dimitri/pgloader:latest
- IMAGE=$docker_project"_mysql_host"
- docker rmi $IMAGE --force
- IMAGE=$docker_project"_waiter"
- docker rmi $IMAGE --force
-
- # Cleanup any dangling volumes
- docker volume rm $(docker volume ls -qf dangling=true)
-}
-
-clean
-start_staging_mysql_server
-#display_env
-migrate_data_from_mysql_to_postgres
-run_postgres_datatypes_conversion
-clean
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/c0157f53/traffic_ops/app/db/pg-migration/mysql-to-postgres.env
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/mysql-to-postgres.env b/traffic_ops/app/db/pg-migration/mysql-to-postgres.env
deleted file mode 100644
index 086e68e..0000000
--- a/traffic_ops/app/db/pg-migration/mysql-to-postgres.env
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/bin/bash
-#
-# 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.
-#
-
-#Traffic Ops Settings
-# The following configs should be configured to point to the
-# Traffic Ops instances that is connected to the MySQL that
-# you want to convert
-TO_SERVER=to_url
-TO_USER=(your_user)
-TO_PASSWORD=(your_password)
-
-# Staging Mysql
-# These variables are for the "staging" Docker MySQL instance that is used
-# to load the Traffic Ops "dbdump" into. ONLY change the MYSQL_HOST variable
-# Leave the other variables.
-MYSQL_HOST=( the_ip_address_running_this_migration )
-MYSQL_PORT=3306
-MYSQL_DATABASE=traffic_ops_db
-MYSQL_USER=to_user
-MYSQL_PASSWORD=twelve
-MYSQL_RANDOM_ROOT_PASSWORD=yes
-
-# New production Postgres Settings, these variables should be changed for the Postgres
-# instance that will contain the existing MySQL data converted
-POSTGRES_HOST=( the_ip_address_running_this_migration )
-POSTGRES_PORT=5432
-# NOTE: The new database name for Traffic Ops
-POSTGRES_DATABASE=traffic_ops
-POSTGRES_USER=traffic_ops
-POSTGRES_PASSWORD=( your_new_postgres_password )
-PGDATA=/opt/postgresql/data/pgdata
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/c0157f53/traffic_ops/app/db/pg-migration/mysql-to-postgres.sh
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/mysql-to-postgres.sh b/traffic_ops/app/db/pg-migration/mysql-to-postgres.sh
deleted file mode 100755
index 7ab7013..0000000
--- a/traffic_ops/app/db/pg-migration/mysql-to-postgres.sh
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/bin/bash
-#
-# 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.
-#
-# ------------------------------------------------------
-
-echo "Dumping Data from Traffic Ops Instance: $TO_SERVER"
-output=/tmp/trafficops_init.sql
-[[ -n $output ]] && output="-o $output"
-
-cookiejar=/tmp/cookiejar
-cred=/tmp/cred.json
-
-echo "----------------------------------------"
-echo "Migrating Mysql data from:"
-echo "----------------------------------------"
-echo "MYSQL_HOST: $MYSQL_HOST"
-echo "MYSQL_USER: $MYSQL_USER"
-echo "MYSQL_DATABASE: $MYSQL_DATABASE"
-echo "----------------------------------------"
-
-echo "----------------------------------------"
-echo "To Postgres..."
-echo "----------------------------------------"
-echo "POSTGRES_HOST: $POSTGRES_HOST"
-echo "POSTGRES_USER: $POSTGRES_USER"
-echo "POSTGRES_DATABASE: $POSTGRES_DATABASE"
-echo "----------------------------------------"
-
-cat >$cred <<-CREDS
- { "u" : "$TO_USER", "p" : "$TO_PASSWORD" }
-CREDS
-
-curl -f -k -H "Accept: application/json" --cookie "$cookiejar" --cookie-jar "$cookiejar" -X POST --data @"$cred" "$TO_SERVER/api/1.2/user/login" || exit 1
-curl $output -f -k -s --cookie "$cookiejar" -X GET "$TO_SERVER/dbdump" || exit 1
-
-echo "[client]" > /root/.my.cnf
-echo "user=$MYSQL_USER" >> /root/.my.cnf
-echo "password=$MYSQL_PASSWORD" >> /root/.my.cnf
-chmod 0600 /root/.my.cnf
-mysql -h $MYSQL_HOST $MYSQL_DATABASE < /tmp/trafficops_init.sql
-
-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/$MYSQL_DATABASE \
- postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST/$POSTGRES_DATABASE
-
-# For debugging
-#while true; do
-# echo "Waiting.."
-# sleep 3
-#done
-
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/c0157f53/traffic_ops/app/db/pg-migration/mysql-to-postgres.yml
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/mysql-to-postgres.yml b/traffic_ops/app/db/pg-migration/mysql-to-postgres.yml
deleted file mode 100644
index b5c99df..0000000
--- a/traffic_ops/app/db/pg-migration/mysql-to-postgres.yml
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# 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
- mysql-to-postgres:
- build:
- context: .
- dockerfile: Dockerfile-mysql-to-postgres
- restart: "no"
- env_file:
- - mysql-to-postgres.env
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/c0157f53/traffic_ops/app/db/pg-migration/mysql/conf.d/mysql.cnf
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/mysql/conf.d/mysql.cnf b/traffic_ops/app/db/pg-migration/mysql/conf.d/mysql.cnf
deleted file mode 100755
index c2c94fe..0000000
--- a/traffic_ops/app/db/pg-migration/mysql/conf.d/mysql.cnf
+++ /dev/null
@@ -1,21 +0,0 @@
-#
-# 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.
-#
-# This is custom config file attached from docker host
-
-[mysql]
-default_character_set = utf8
-
-[mysqld]
-character_set_server = utf8 # If you prefer utf8
-collation_server = utf8_general_ci
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/c0157f53/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
deleted file mode 100644
index fb02e3b..0000000
--- a/traffic_ops/app/db/pg-migration/mysql_host.yml
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# 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:
- build:
- context: .
- dockerfile: Dockerfile-mysql
- env_file:
- - mysql-to-postgres.env
- ports:
- - "3306:3306"
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/c0157f53/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
deleted file mode 100644
index d9e3149..0000000
--- a/traffic_ops/app/db/pg-migration/pgloader.yml
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# 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-to-postgres.env
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/c0157f53/traffic_ops/app/db/pg-migration/postgres.yml
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/postgres.yml b/traffic_ops/app/db/pg-migration/postgres.yml
deleted file mode 100644
index 72a765e..0000000
--- a/traffic_ops/app/db/pg-migration/postgres.yml
+++ /dev/null
@@ -1,34 +0,0 @@
-#
-# 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:
- db:
- build:
- context: ..
- dockerfile: pg-migration/Dockerfile-postgres
- env_file:
- - mysql-to-postgres.env
- ports:
- - 5432:5432
- volumes:
- - ./pgdata:/opt/postgresql/data/pgdata
- - ./postgres_logs:/var/log/postgresql
- networks:
- - default
-
-networks:
- default:
- driver: bridge
-
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/c0157f53/traffic_ops/app/db/pg-migration/runconvert.sh
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/runconvert.sh b/traffic_ops/app/db/pg-migration/runconvert.sh
deleted file mode 100755
index 59b1afb..0000000
--- a/traffic_ops/app/db/pg-migration/runconvert.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/bash -x
-#
-# 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.
-# Load required conversion of booleans
-psql postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST/$POSTGRES_DATABASE < ./convert_bools.sql
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/c0157f53/traffic_ops/app/db/pg-migration/runmysql.sh
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/runmysql.sh b/traffic_ops/app/db/pg-migration/runmysql.sh
deleted file mode 100755
index 0c29dee..0000000
--- a/traffic_ops/app/db/pg-migration/runmysql.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/bash -x
-#
-# 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.
-#
-
-docker-entrypoint.sh mysqld
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/c0157f53/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
deleted file mode 100755
index f6a7d7d..0000000
--- a/traffic_ops/app/db/pg-migration/runpgloader.sh
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/bash -x
-#
-# 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.
-#
-
-pgloader -v \
- --before create_tables.sql \
- --cast 'type tinyint to smallint drop typemod' \
- --cast 'type varchar to text drop typemod' \
- --cast 'type double to numeric drop typemod' \
- --with truncate \
- mysql://$MYSQL_USER:$MYSQL_PASSWORD@$MYSQL_HOST/traffic_ops_db \
- postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST/$POSTGRES_DATABASE
-exit 0
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/c0157f53/traffic_ops/app/db/pg-migration/runwaiter.sh
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/runwaiter.sh b/traffic_ops/app/db/pg-migration/runwaiter.sh
deleted file mode 100755
index 7cf2222..0000000
--- a/traffic_ops/app/db/pg-migration/runwaiter.sh
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/bash
-
-
-echo "WAITER_HOST: $WAITER_HOST"
-echo "WAITER_PORT: $WAITER_PORT"
-
-for c in "$WAITER_HOST $WAITER_PORT" ; do
- while true; do
- echo "Waiting 3 seconds for Host and Port: $c "
- sleep 3
- nc -z $c && break
- done
-done
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/c0157f53/traffic_ops/app/db/pg-migration/start_postgres.sh
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/start_postgres.sh b/traffic_ops/app/db/pg-migration/start_postgres.sh
deleted file mode 100755
index f89d1f4..0000000
--- a/traffic_ops/app/db/pg-migration/start_postgres.sh
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/bin/bash
-#
-# 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.
-#
-
-. mysql-to-postgres.env
-
-#Traffic Ops Settings
-# The following configs should be configured to point to the
-# Traffic Ops instances that is connected to the MySQL that
-# you want to convert
-separator="---------------------------------------"
-
-function display_env() {
-
- echo "TO_SERVER: $TO_SERVER"
- echo "TO_USER: $TO_USER"
- echo "TO_PASSWORD: $TO_PASSWORD"
- echo "MYSQL_HOST: $MYSQL_HOST"
- echo "MYSQL_PORT: $MYSQL_PORT"
- echo "MYSQL_DATABASE: $MYSQL_DATABASE"
- echo "MYSQL_USER: $MYSQL_USER"
- echo "MYSQL_PASSWORD: $MYSQL_PASSWORD"
-
- echo "POSTGRES_HOST: $POSTGRES_HOST"
- echo "POSTGRES_PORT: $POSTGRES_PORT"
- echo "POSTGRES_DATABASE: $POSTGRES_DATABASE"
- echo "POSTGRES_USER: $POSTGRES_USER"
- echo "POSTGRES_PASSOWRD: $POSTGRES_PASSWORD"
- echo "PGDATA: $PGDATA"
- echo "PGDATA_VOLUME: $PGDATA_VOLUME"
- echo "PGLOGS_VOLUME: $PGLOGS_VOLUME"
-
-}
-
-function start_staging_postgres_server() {
-
- docker-compose -v -p trafficops -f postgres.yml down
-
- docker-compose -p trafficops -f postgres.yml up -d --build
-
-}
-
-start_staging_postgres_server
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/c0157f53/traffic_ops/app/db/pg-migration/waiter.yml
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/pg-migration/waiter.yml b/traffic_ops/app/db/pg-migration/waiter.yml
deleted file mode 100644
index 2796737..0000000
--- a/traffic_ops/app/db/pg-migration/waiter.yml
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# 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:
- # waits for a port to be available
- waiter:
- build:
- context: ..
- dockerfile: pg-migration/Dockerfile-waiter
- environment:
- - WAITER_HOST
- - WAITER_PORT
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/c0157f53/traffic_ops/app/db/reset.sh
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/reset.sh b/traffic_ops/app/db/reset.sh
deleted file mode 100644
index 751fad7..0000000
--- a/traffic_ops/app/db/reset.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-mysql twelve_monkeys_test -utwelve_monkeys -ptwelve -e 'drop database twelve_monkeys_test; create database twelve_monkeys_test;';
-#
-#
-# 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.
-#
-mysql twelve_monkeys_test -utwelve_monkeys -ptwelve < create_tables.sql
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/c0157f53/traffic_ops/app/db/setup_migrations.sql
----------------------------------------------------------------------
diff --git a/traffic_ops/app/db/setup_migrations.sql b/traffic_ops/app/db/setup_migrations.sql
deleted file mode 100644
index 84ff88d..0000000
--- a/traffic_ops/app/db/setup_migrations.sql
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
-
- 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.
-*/
-
-insert ignore into role (name, description, priv_level) values ('migrations','Migrations User', 20);
-insert ignore into tm_user (username,role,full_name) values ('migration',(select id from role where name='migrations'),'migrations user - DO NOT REMOVE');
[3/5] incubator-trafficcontrol git commit: initial version of the
traffic_ops_db top level project
Posted by da...@apache.org.
initial version of the traffic_ops_db top level project
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/ac0d7d76
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/ac0d7d76
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/ac0d7d76
Branch: refs/heads/master
Commit: ac0d7d761cfe8266a39e53d7687598f03eb8fdb7
Parents: 23791a5
Author: Dewayne Richardson <de...@apache.org>
Authored: Thu May 11 11:06:00 2017 -0600
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Tue May 16 13:40:46 2017 -0600
----------------------------------------------------------------------
traffic_ops_db/bin/install_systemd_unit.sh | 16 +++
traffic_ops_db/docker/Dockerfile | 25 ++++
traffic_ops_db/docker/docker-compose.yml | 42 +++++++
traffic_ops_db/docker/todb.sh | 51 ++++++++
traffic_ops_db/pg-migration/Dockerfile-convert | 28 +++++
traffic_ops_db/pg-migration/Dockerfile-mysql | 26 ++++
.../pg-migration/Dockerfile-mysql-to-postgres | 38 ++++++
traffic_ops_db/pg-migration/Dockerfile-pgloader | 19 +++
traffic_ops_db/pg-migration/Dockerfile-postgres | 29 +++++
traffic_ops_db/pg-migration/Dockerfile-waiter | 24 ++++
traffic_ops_db/pg-migration/README.md | 16 +++
traffic_ops_db/pg-migration/convert.yml | 23 ++++
traffic_ops_db/pg-migration/convert_bools.sql | 112 +++++++++++++++++
traffic_ops_db/pg-migration/migrate.sh | 120 +++++++++++++++++++
.../pg-migration/mysql-to-postgres.env | 43 +++++++
.../pg-migration/mysql-to-postgres.sh | 65 ++++++++++
.../pg-migration/mysql-to-postgres.yml | 24 ++++
.../pg-migration/mysql/conf.d/mysql.cnf | 21 ++++
traffic_ops_db/pg-migration/mysql_host.yml | 24 ++++
traffic_ops_db/pg-migration/pgloader.yml | 23 ++++
traffic_ops_db/pg-migration/postgres.yml | 34 ++++++
traffic_ops_db/pg-migration/runconvert.sh | 15 +++
traffic_ops_db/pg-migration/runmysql.sh | 16 +++
traffic_ops_db/pg-migration/runpgloader.sh | 24 ++++
traffic_ops_db/pg-migration/runwaiter.sh | 13 ++
traffic_ops_db/pg-migration/waiter.yml | 24 ++++
26 files changed, 895 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/ac0d7d76/traffic_ops_db/bin/install_systemd_unit.sh
----------------------------------------------------------------------
diff --git a/traffic_ops_db/bin/install_systemd_unit.sh b/traffic_ops_db/bin/install_systemd_unit.sh
new file mode 100644
index 0000000..321a101
--- /dev/null
+++ b/traffic_ops_db/bin/install_systemd_unit.sh
@@ -0,0 +1,16 @@
+#!/usr/bin/env bash
+
+#
+# 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.
+#
+
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/ac0d7d76/traffic_ops_db/docker/Dockerfile
----------------------------------------------------------------------
diff --git a/traffic_ops_db/docker/Dockerfile b/traffic_ops_db/docker/Dockerfile
new file mode 100644
index 0000000..23556d6
--- /dev/null
+++ b/traffic_ops_db/docker/Dockerfile
@@ -0,0 +1,25 @@
+#
+# 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.
+#
+FROM postgres:latest
+
+MAINTAINER Dan Kirkwood
+
+# Postgres Access
+ENV POSTGRES_USER=$POSTGRES_USER
+ENV POSTGRES_HOST=$POSTGRES_HOST
+ENV POSTGRES_PORT=$POSTGRES_PORT
+ENV POSTGRES_DATABASE=$POSTGRES_DATABASE
+#COPY docker-entrypoint-initdb.d/* /docker-entrypoint-initdb.d
+
+EXPOSE "5432:5432"
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/ac0d7d76/traffic_ops_db/docker/docker-compose.yml
----------------------------------------------------------------------
diff --git a/traffic_ops_db/docker/docker-compose.yml b/traffic_ops_db/docker/docker-compose.yml
new file mode 100644
index 0000000..494c154
--- /dev/null
+++ b/traffic_ops_db/docker/docker-compose.yml
@@ -0,0 +1,42 @@
+#
+# 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:
+ db:
+ build:
+ context: .
+ dockerfile: Dockerfile
+ environment:
+ - POSTGRES_HOST=localhost
+ - POSTGRES_PORT=5432
+ - POSTGRES_DATABASE=traffic_ops
+ - POSTGRES_USER=postgres
+ - POSTGRES_USER_UID=9999
+ - POSTGRES_USER_GID=9999
+ - PGDATA=${PGDATA}
+ ports:
+ - 5432:5432
+ volumes:
+ - ./pgdata:/pgdata
+ - ./logs:/var/log/postgresql
+ networks:
+ - default
+
+networks:
+ default:
+ driver: bridge
+
+volumes:
+ pgdata:
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/ac0d7d76/traffic_ops_db/docker/todb.sh
----------------------------------------------------------------------
diff --git a/traffic_ops_db/docker/todb.sh b/traffic_ops_db/docker/todb.sh
new file mode 100755
index 0000000..7a6e6e4
--- /dev/null
+++ b/traffic_ops_db/docker/todb.sh
@@ -0,0 +1,51 @@
+#!/usr/bin/env bash
+
+#
+# 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.
+#
+
+# Docker wrapper script to start/manage your Postgres container
+
+ACTION=$1
+
+PROJECT_NAME=trafficops
+CONTAINER_NAME=trafficops_db_1
+
+if [[ "$ACTION" == "setup" ]];then
+ createuser traffic_ops -U postgres -h localhost
+ createdb traffic_ops --owner traffic_ops -U postgres -h localhost
+ psql -c "\l" -U postgres -h localhost
+ echo "Setup complete"
+
+elif [[ "$ACTION" == "run" ]];then
+ docker-compose -p $PROJECT_NAME up -d
+ echo "Started Docker container: $CONTAINER_NAME"
+
+elif [[ "$ACTION" == "stop" ]];then
+ docker-compose -p $PROJECT_NAME down -v
+ echo "Stopping Docker container: $CONTAINER_NAME"
+
+elif [[ "$ACTION" == "clean" ]];then
+ rm -rf pgdata
+ docker stop $CONTAINER_NAME
+ docker rm $CONTAINER_NAME
+ docker rmi $PROJECT_NAME
+
+elif [[ "$ACTION" == "seed" ]];then
+ docker-compose -p $PROJECT_NAME down -v
+else
+ echo "Valid actions: 'setup', 'run', 'stop', 'clean'"
+ exit 0
+fi
+
+docker ps
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/ac0d7d76/traffic_ops_db/pg-migration/Dockerfile-convert
----------------------------------------------------------------------
diff --git a/traffic_ops_db/pg-migration/Dockerfile-convert b/traffic_ops_db/pg-migration/Dockerfile-convert
new file mode 100644
index 0000000..454f58a
--- /dev/null
+++ b/traffic_ops_db/pg-migration/Dockerfile-convert
@@ -0,0 +1,28 @@
+#
+# 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.
+#
+FROM dewrich/postgres:latest
+
+MAINTAINER Dan Kirkwood
+
+# Postgres Access
+ENV POSTGRES_HOST=$POSTGRES_HOST
+ENV POSTGRES_PORT=$POSTGRES_PORT
+ENV POSTGRES_DATABASE=$POSTGRES_DATABASE
+ENV POSTGRES_PASSWORD=$POSTGRES_PASSWORD
+
+RUN apt-get update
+ADD pg-migration/runconvert.sh .
+ADD pg-migration/convert_bools.sql .
+
+CMD ./runconvert.sh
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/ac0d7d76/traffic_ops_db/pg-migration/Dockerfile-mysql
----------------------------------------------------------------------
diff --git a/traffic_ops_db/pg-migration/Dockerfile-mysql b/traffic_ops_db/pg-migration/Dockerfile-mysql
new file mode 100644
index 0000000..0b3d0df
--- /dev/null
+++ b/traffic_ops_db/pg-migration/Dockerfile-mysql
@@ -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.
+#
+FROM mysql:5.6
+
+MAINTAINER Dan Kirkwood
+
+# Mysql Access
+ENV MYSQL_HOST=$MYSQL_HOST
+ENV MYSQL_PORT=$MYSQL_PORT
+ENV MYSQL_PASSWORD=$MYSQL_PASSWORD
+ENV MYSQL_DATABASE=$MYSQL_DATABASE
+
+EXPOSE 3306
+ADD runmysql.sh /
+CMD /runmysql.sh
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/ac0d7d76/traffic_ops_db/pg-migration/Dockerfile-mysql-to-postgres
----------------------------------------------------------------------
diff --git a/traffic_ops_db/pg-migration/Dockerfile-mysql-to-postgres b/traffic_ops_db/pg-migration/Dockerfile-mysql-to-postgres
new file mode 100644
index 0000000..b1da689
--- /dev/null
+++ b/traffic_ops_db/pg-migration/Dockerfile-mysql-to-postgres
@@ -0,0 +1,38 @@
+#
+# 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.
+#
+FROM dimitri/pgloader:latest
+MAINTAINER Dan Kirkwood <da...@apache.org>
+
+# Traffic Ops Access
+ENV TO_SERVER=$TO_SERVER
+ENV TO_USER=$TO_USER
+ENV TO_PASSWORD=$TO_PASSWORD
+
+# Mysql Access
+ENV MYSQL_HOST=$MYSQL_HOST
+ENV MYSQL_PORT=$MYSQL_PORT
+ENV MYSQL_PASSWORD=$MYSQL_PASSWORD
+ENV MYSQL_DATABASE=$MYSQL_DATABASE
+
+# Postgres Access
+ENV POSTGRES_HOST=$POSTGRES_HOST
+ENV POSTGRES_PORT=$POSTGRES_PORT
+ENV POSTGRES_DATABASE=$POSTGRES_DATABASE
+ENV POSTGRES_PASSWORD=$POSTGRES_PASSWORD
+
+# install the tools for getting data
+RUN apt-get -y update && apt-get -y install curl mysql-client
+
+ADD mysql-to-postgres.sh .
+CMD ./mysql-to-postgres.sh
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/ac0d7d76/traffic_ops_db/pg-migration/Dockerfile-pgloader
----------------------------------------------------------------------
diff --git a/traffic_ops_db/pg-migration/Dockerfile-pgloader b/traffic_ops_db/pg-migration/Dockerfile-pgloader
new file mode 100644
index 0000000..fec7f97
--- /dev/null
+++ b/traffic_ops_db/pg-migration/Dockerfile-pgloader
@@ -0,0 +1,19 @@
+#
+# 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.
+#
+FROM dimitri/pgloader:latest
+MAINTAINER Dan Kirkwood <da...@apache.org>
+
+ADD pg-migration/runpgloader.sh .
+ADD create_tables.sql .
+CMD ./runpgloader.sh
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/ac0d7d76/traffic_ops_db/pg-migration/Dockerfile-postgres
----------------------------------------------------------------------
diff --git a/traffic_ops_db/pg-migration/Dockerfile-postgres b/traffic_ops_db/pg-migration/Dockerfile-postgres
new file mode 100644
index 0000000..6f3c634
--- /dev/null
+++ b/traffic_ops_db/pg-migration/Dockerfile-postgres
@@ -0,0 +1,29 @@
+#
+# 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.
+#
+FROM dewrich/postgres:latest
+
+MAINTAINER Dan Kirkwood
+
+# Postgres Access
+ENV POSTGRES_HOST=$POSTGRES_HOST
+ENV POSTGRES_PORT=$POSTGRES_PORT
+ENV POSTGRES_DATABASE=$POSTGRES_DATABASE
+ENV POSTGRES_PASSWORD=$POSTGRES_PASSWORD
+
+# Adjust PostgreSQL configuration so that remote connections to the
+# database are possible.
+RUN echo "host all all 0.0.0.0/0 md5" >> $PGDATA/pg_hba.conf
+RUN echo "listen_addresses='*'" >> $PGDATA/postgresql.conf
+
+EXPOSE "5432:5432"
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/ac0d7d76/traffic_ops_db/pg-migration/Dockerfile-waiter
----------------------------------------------------------------------
diff --git a/traffic_ops_db/pg-migration/Dockerfile-waiter b/traffic_ops_db/pg-migration/Dockerfile-waiter
new file mode 100644
index 0000000..0531c71
--- /dev/null
+++ b/traffic_ops_db/pg-migration/Dockerfile-waiter
@@ -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.
+#
+FROM dimitri/pgloader:latest
+
+MAINTAINER Dewayne Richardson
+
+RUN apt-get -y update && apt-get -y install netcat
+
+ENV WAITER_HOST=$WAITER_HOST
+ENV WAITER_PORT=$WAITER_PORT
+
+ADD pg-migration/runwaiter.sh .
+CMD ./runwaiter.sh
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/ac0d7d76/traffic_ops_db/pg-migration/README.md
----------------------------------------------------------------------
diff --git a/traffic_ops_db/pg-migration/README.md b/traffic_ops_db/pg-migration/README.md
new file mode 100644
index 0000000..005e6e5
--- /dev/null
+++ b/traffic_ops_db/pg-migration/README.md
@@ -0,0 +1,16 @@
+# Converts existing mysql `traffic_ops` database to postgres
+
+* Requires a fairly recent ( 17.05.0-ce ) version of `docker-engine` and `docker-compose`.
+
+* Modify the mysql-to-postgres.env file for the parameters in your Traffic Ops environment
+
+* Ensure that your new Postgres service is running (local or remote)
+
+* A sample Postgres Docker container has been provided for testing
+ 1. `cd ../docker`
+ 2. `$ sh todb.sh run` - to download/start your Postgres Test Docker container
+ 3. `$ sh todb.sh setup` - to create your new 'traffic_ops' role and 'traffic_ops' database
+
+* Run the Mysql to Postgres Migration Docker flow
+ 1. `$ cd ../pg-migration`
+ 2. `$ sh migrate.sh`
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/ac0d7d76/traffic_ops_db/pg-migration/convert.yml
----------------------------------------------------------------------
diff --git a/traffic_ops_db/pg-migration/convert.yml b/traffic_ops_db/pg-migration/convert.yml
new file mode 100644
index 0000000..fb130e9
--- /dev/null
+++ b/traffic_ops_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:
+ - mysql-to-postgres.env
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/ac0d7d76/traffic_ops_db/pg-migration/convert_bools.sql
----------------------------------------------------------------------
diff --git a/traffic_ops_db/pg-migration/convert_bools.sql b/traffic_ops_db/pg-migration/convert_bools.sql
new file mode 100755
index 0000000..5835e6c
--- /dev/null
+++ b/traffic_ops_db/pg-migration/convert_bools.sql
@@ -0,0 +1,112 @@
+-- Licensed to the Apache Software Foundation (ASF) under one
+-- or more contributor license agreements. See the NOTICE file
+-- distributed with this work for additional information
+-- regarding copyright ownership. The ASF licenses this file
+-- to you 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.
+
+ALTER TABLE cdn
+ ALTER COLUMN dnssec_enabled DROP DEFAULT,
+ ALTER COLUMN dnssec_enabled TYPE boolean
+ USING CASE WHEN dnssec_enabled = 1 THEN TRUE
+ ELSE FALSE
+ END,
+ ALTER COLUMN dnssec_enabled SET DEFAULT FALSE;
+
+ALTER TABLE deliveryservice
+ ALTER COLUMN active DROP DEFAULT,
+ ALTER COLUMN active TYPE boolean
+ USING CASE WHEN active = 1 THEN TRUE
+ ELSE FALSE
+ END,
+ ALTER COLUMN active SET DEFAULT FALSE;
+
+ALTER TABLE deliveryservice
+ ALTER COLUMN signed DROP DEFAULT,
+ ALTER COLUMN signed TYPE boolean
+ USING CASE WHEN signed = 1 THEN TRUE
+ ELSE FALSE
+ END,
+ ALTER COLUMN signed SET DEFAULT FALSE;
+
+ALTER TABLE deliveryservice
+ ALTER COLUMN ipv6_routing_enabled DROP DEFAULT,
+ ALTER COLUMN ipv6_routing_enabled TYPE boolean
+ USING CASE WHEN ipv6_routing_enabled = 1 THEN TRUE
+ ELSE FALSE
+ END,
+ ALTER COLUMN ipv6_routing_enabled SET DEFAULT FALSE;
+
+ALTER TABLE deliveryservice
+ ALTER COLUMN multi_site_origin DROP DEFAULT,
+ ALTER COLUMN multi_site_origin TYPE boolean
+ USING CASE WHEN multi_site_origin = 1 THEN TRUE
+ ELSE FALSE
+ END,
+ ALTER COLUMN multi_site_origin SET DEFAULT FALSE;
+
+ALTER TABLE deliveryservice
+ ALTER COLUMN regional_geo_blocking DROP DEFAULT,
+ ALTER COLUMN regional_geo_blocking TYPE boolean
+ USING CASE WHEN regional_geo_blocking = 1 THEN TRUE
+ ELSE FALSE
+ END,
+ ALTER COLUMN regional_geo_blocking SET DEFAULT FALSE;
+
+ALTER TABLE deliveryservice
+ ALTER COLUMN logs_enabled DROP DEFAULT,
+ ALTER COLUMN logs_enabled TYPE boolean
+ USING CASE WHEN logs_enabled = 1 THEN TRUE
+ ELSE FALSE
+ END,
+ ALTER COLUMN logs_enabled SET DEFAULT FALSE;
+
+ ALTER TABLE goose_db_version
+ ALTER COLUMN is_applied DROP DEFAULT,
+ ALTER COLUMN is_applied TYPE boolean
+ USING CASE WHEN is_applied = 1 THEN TRUE
+ ELSE FALSE
+ END,
+ ALTER COLUMN is_applied SET DEFAULT FALSE;
+
+ALTER TABLE parameter
+ ALTER COLUMN secure DROP DEFAULT,
+ ALTER COLUMN secure TYPE boolean
+ USING CASE WHEN secure = 1 THEN TRUE
+ ELSE FALSE
+ END,
+ ALTER COLUMN secure SET DEFAULT FALSE;
+
+ALTER TABLE server
+ ALTER COLUMN upd_pending DROP DEFAULT,
+ ALTER COLUMN upd_pending TYPE boolean
+ USING CASE WHEN upd_pending = 1 THEN TRUE
+ ELSE FALSE
+ END,
+ ALTER COLUMN upd_pending SET DEFAULT FALSE;
+
+ALTER TABLE tm_user
+ ALTER COLUMN new_user DROP DEFAULT,
+ ALTER COLUMN new_user TYPE boolean
+ USING CASE WHEN new_user = 1 THEN TRUE
+ ELSE FALSE
+ END,
+ ALTER COLUMN new_user SET DEFAULT FALSE;
+
+ALTER TABLE to_extension
+ ALTER COLUMN isactive DROP DEFAULT,
+ ALTER COLUMN isactive TYPE boolean
+ USING CASE WHEN isactive = 1 THEN TRUE
+ ELSE FALSE
+ END,
+ ALTER COLUMN isactive SET DEFAULT FALSE;
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/ac0d7d76/traffic_ops_db/pg-migration/migrate.sh
----------------------------------------------------------------------
diff --git a/traffic_ops_db/pg-migration/migrate.sh b/traffic_ops_db/pg-migration/migrate.sh
new file mode 100755
index 0000000..f5b4388
--- /dev/null
+++ b/traffic_ops_db/pg-migration/migrate.sh
@@ -0,0 +1,120 @@
+#!/bin/bash
+#
+# 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.
+#
+
+. mysql-to-postgres.env
+
+#Traffic Ops Settings
+# The following configs should be configured to point to the
+# Traffic Ops instances that is connected to the MySQL that
+# you want to convert
+separator="---------------------------------------"
+docker_project="pgmigration"
+
+function display_env() {
+
+ echo "TO_SERVER: $TO_SERVER"
+ echo "TO_USER: $TO_USER"
+ echo "TO_PASSWORD: $TO_PASSWORD"
+ echo "MYSQL_HOST: $MYSQL_HOST"
+ echo "MYSQL_PORT: $MYSQL_PORT"
+ echo "MYSQL_DATABASE: $MYSQL_DATABASE"
+ echo "MYSQL_USER: $MYSQL_USER"
+ echo "MYSQL_PASSWORD: $MYSQL_PASSWORD"
+
+ echo "POSTGRES_HOST: $POSTGRES_HOST"
+ echo "POSTGRES_PORT: $POSTGRES_PORT"
+ echo "POSTGRES_DATABASE: $POSTGRES_DATABASE"
+ echo "POSTGRES_USER: $POSTGRES_USER"
+ echo "POSTGRES_PASSOWRD: $POSTGRES_PASSWORD"
+ echo "PGDATA: $PGDATA"
+ echo "PGDATA_VOLUME: $PGDATA_VOLUME"
+ echo "PGLOGS_VOLUME: $PGLOGS_VOLUME"
+
+}
+
+
+function start_staging_mysql_server() {
+
+ docker-compose -p $docker_project -f mysql_host.yml down --remove-orphans
+ docker-compose -p $docker_project -f mysql_host.yml up --build -d
+
+ #Wait for MySQL to come up
+ export WAITER_HOST=$MYSQL_HOST
+ export WAITER_PORT=$MYSQL_PORT
+ docker-compose -p $docker_project -f waiter.yml up --build
+ echo $separator
+ echo "Mysql Host is started..."
+ echo $separator
+
+ #Ensure the Postgres instance is up
+ export WAITER_HOST=$POSTGRES_HOST
+ export WAITER_PORT=$POSTGRES_PORT
+ docker-compose -p $docker_project -f waiter.yml up --build
+ echo $separator
+ echo "Postgres Host is started..."
+ echo $separator
+
+}
+
+function migrate_data_from_mysql_to_postgres() {
+
+ echo $separator
+ echo "Starting Mysql to Postgres Migration..."
+ echo $separator
+ docker-compose -p $docker_project -f mysql-to-postgres.yml down
+ docker-compose -p $docker_project -f mysql-to-postgres.yml up --build
+}
+
+
+function run_postgres_datatypes_conversion() {
+ echo $separator
+ echo "Starting Mysql to Postgres Datatype Conversion..."
+ echo $separator
+ docker-compose -p $docker_project -f convert.yml up --build
+}
+
+
+function clean() {
+ echo $separator
+ echo "Cleaning up..."
+ echo $separator
+
+ # Powerdown the containers (to remove them)
+ docker-compose -p $docker_project -f mysql-to-postgres.yml down --remove-orphans
+ docker-compose -p $docker_project -f convert.yml down --remove-orphans
+
+ # Cleanup any temporary images
+ IMAGE=$docker_project"_mysql-to-postgres"
+ echo "IMAGE: $IMAGE"
+ docker rmi $IMAGE
+ IMAGE=$docker_project"_convert"
+ docker rmi $IMAGE
+ docker rmi mysql:5.6
+ docker rmi dimitri/pgloader:latest
+ IMAGE=$docker_project"_mysql_host"
+ docker rmi $IMAGE --force
+ IMAGE=$docker_project"_waiter"
+ docker rmi $IMAGE --force
+
+ # Cleanup any dangling volumes
+ docker volume rm $(docker volume ls -qf dangling=true)
+}
+
+clean
+start_staging_mysql_server
+#display_env
+migrate_data_from_mysql_to_postgres
+run_postgres_datatypes_conversion
+clean
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/ac0d7d76/traffic_ops_db/pg-migration/mysql-to-postgres.env
----------------------------------------------------------------------
diff --git a/traffic_ops_db/pg-migration/mysql-to-postgres.env b/traffic_ops_db/pg-migration/mysql-to-postgres.env
new file mode 100644
index 0000000..086e68e
--- /dev/null
+++ b/traffic_ops_db/pg-migration/mysql-to-postgres.env
@@ -0,0 +1,43 @@
+#!/bin/bash
+#
+# 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.
+#
+
+#Traffic Ops Settings
+# The following configs should be configured to point to the
+# Traffic Ops instances that is connected to the MySQL that
+# you want to convert
+TO_SERVER=to_url
+TO_USER=(your_user)
+TO_PASSWORD=(your_password)
+
+# Staging Mysql
+# These variables are for the "staging" Docker MySQL instance that is used
+# to load the Traffic Ops "dbdump" into. ONLY change the MYSQL_HOST variable
+# Leave the other variables.
+MYSQL_HOST=( the_ip_address_running_this_migration )
+MYSQL_PORT=3306
+MYSQL_DATABASE=traffic_ops_db
+MYSQL_USER=to_user
+MYSQL_PASSWORD=twelve
+MYSQL_RANDOM_ROOT_PASSWORD=yes
+
+# New production Postgres Settings, these variables should be changed for the Postgres
+# instance that will contain the existing MySQL data converted
+POSTGRES_HOST=( the_ip_address_running_this_migration )
+POSTGRES_PORT=5432
+# NOTE: The new database name for Traffic Ops
+POSTGRES_DATABASE=traffic_ops
+POSTGRES_USER=traffic_ops
+POSTGRES_PASSWORD=( your_new_postgres_password )
+PGDATA=/opt/postgresql/data/pgdata
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/ac0d7d76/traffic_ops_db/pg-migration/mysql-to-postgres.sh
----------------------------------------------------------------------
diff --git a/traffic_ops_db/pg-migration/mysql-to-postgres.sh b/traffic_ops_db/pg-migration/mysql-to-postgres.sh
new file mode 100755
index 0000000..7ab7013
--- /dev/null
+++ b/traffic_ops_db/pg-migration/mysql-to-postgres.sh
@@ -0,0 +1,65 @@
+#!/bin/bash
+#
+# 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.
+#
+# ------------------------------------------------------
+
+echo "Dumping Data from Traffic Ops Instance: $TO_SERVER"
+output=/tmp/trafficops_init.sql
+[[ -n $output ]] && output="-o $output"
+
+cookiejar=/tmp/cookiejar
+cred=/tmp/cred.json
+
+echo "----------------------------------------"
+echo "Migrating Mysql data from:"
+echo "----------------------------------------"
+echo "MYSQL_HOST: $MYSQL_HOST"
+echo "MYSQL_USER: $MYSQL_USER"
+echo "MYSQL_DATABASE: $MYSQL_DATABASE"
+echo "----------------------------------------"
+
+echo "----------------------------------------"
+echo "To Postgres..."
+echo "----------------------------------------"
+echo "POSTGRES_HOST: $POSTGRES_HOST"
+echo "POSTGRES_USER: $POSTGRES_USER"
+echo "POSTGRES_DATABASE: $POSTGRES_DATABASE"
+echo "----------------------------------------"
+
+cat >$cred <<-CREDS
+ { "u" : "$TO_USER", "p" : "$TO_PASSWORD" }
+CREDS
+
+curl -f -k -H "Accept: application/json" --cookie "$cookiejar" --cookie-jar "$cookiejar" -X POST --data @"$cred" "$TO_SERVER/api/1.2/user/login" || exit 1
+curl $output -f -k -s --cookie "$cookiejar" -X GET "$TO_SERVER/dbdump" || exit 1
+
+echo "[client]" > /root/.my.cnf
+echo "user=$MYSQL_USER" >> /root/.my.cnf
+echo "password=$MYSQL_PASSWORD" >> /root/.my.cnf
+chmod 0600 /root/.my.cnf
+mysql -h $MYSQL_HOST $MYSQL_DATABASE < /tmp/trafficops_init.sql
+
+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/$MYSQL_DATABASE \
+ postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST/$POSTGRES_DATABASE
+
+# For debugging
+#while true; do
+# echo "Waiting.."
+# sleep 3
+#done
+
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/ac0d7d76/traffic_ops_db/pg-migration/mysql-to-postgres.yml
----------------------------------------------------------------------
diff --git a/traffic_ops_db/pg-migration/mysql-to-postgres.yml b/traffic_ops_db/pg-migration/mysql-to-postgres.yml
new file mode 100644
index 0000000..b5c99df
--- /dev/null
+++ b/traffic_ops_db/pg-migration/mysql-to-postgres.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:
+ # dataimport reads data from an existing traffic_ops server running mysql thru the API
+ mysql-to-postgres:
+ build:
+ context: .
+ dockerfile: Dockerfile-mysql-to-postgres
+ restart: "no"
+ env_file:
+ - mysql-to-postgres.env
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/ac0d7d76/traffic_ops_db/pg-migration/mysql/conf.d/mysql.cnf
----------------------------------------------------------------------
diff --git a/traffic_ops_db/pg-migration/mysql/conf.d/mysql.cnf b/traffic_ops_db/pg-migration/mysql/conf.d/mysql.cnf
new file mode 100755
index 0000000..c2c94fe
--- /dev/null
+++ b/traffic_ops_db/pg-migration/mysql/conf.d/mysql.cnf
@@ -0,0 +1,21 @@
+#
+# 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.
+#
+# This is custom config file attached from docker host
+
+[mysql]
+default_character_set = utf8
+
+[mysqld]
+character_set_server = utf8 # If you prefer utf8
+collation_server = utf8_general_ci
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/ac0d7d76/traffic_ops_db/pg-migration/mysql_host.yml
----------------------------------------------------------------------
diff --git a/traffic_ops_db/pg-migration/mysql_host.yml b/traffic_ops_db/pg-migration/mysql_host.yml
new file mode 100644
index 0000000..fb02e3b
--- /dev/null
+++ b/traffic_ops_db/pg-migration/mysql_host.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:
+ mysql_host:
+ build:
+ context: .
+ dockerfile: Dockerfile-mysql
+ env_file:
+ - mysql-to-postgres.env
+ ports:
+ - "3306:3306"
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/ac0d7d76/traffic_ops_db/pg-migration/pgloader.yml
----------------------------------------------------------------------
diff --git a/traffic_ops_db/pg-migration/pgloader.yml b/traffic_ops_db/pg-migration/pgloader.yml
new file mode 100644
index 0000000..d9e3149
--- /dev/null
+++ b/traffic_ops_db/pg-migration/pgloader.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:
+ # pgloader converts the data from mysql to postgres
+ pgloader:
+ build:
+ context: ..
+ dockerfile: pg-migration/Dockerfile-pgloader
+ env_file:
+ - mysql-to-postgres.env
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/ac0d7d76/traffic_ops_db/pg-migration/postgres.yml
----------------------------------------------------------------------
diff --git a/traffic_ops_db/pg-migration/postgres.yml b/traffic_ops_db/pg-migration/postgres.yml
new file mode 100644
index 0000000..72a765e
--- /dev/null
+++ b/traffic_ops_db/pg-migration/postgres.yml
@@ -0,0 +1,34 @@
+#
+# 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:
+ db:
+ build:
+ context: ..
+ dockerfile: pg-migration/Dockerfile-postgres
+ env_file:
+ - mysql-to-postgres.env
+ ports:
+ - 5432:5432
+ volumes:
+ - ./pgdata:/opt/postgresql/data/pgdata
+ - ./postgres_logs:/var/log/postgresql
+ networks:
+ - default
+
+networks:
+ default:
+ driver: bridge
+
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/ac0d7d76/traffic_ops_db/pg-migration/runconvert.sh
----------------------------------------------------------------------
diff --git a/traffic_ops_db/pg-migration/runconvert.sh b/traffic_ops_db/pg-migration/runconvert.sh
new file mode 100755
index 0000000..59b1afb
--- /dev/null
+++ b/traffic_ops_db/pg-migration/runconvert.sh
@@ -0,0 +1,15 @@
+#!/bin/bash -x
+#
+# 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.
+# Load required conversion of booleans
+psql postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST/$POSTGRES_DATABASE < ./convert_bools.sql
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/ac0d7d76/traffic_ops_db/pg-migration/runmysql.sh
----------------------------------------------------------------------
diff --git a/traffic_ops_db/pg-migration/runmysql.sh b/traffic_ops_db/pg-migration/runmysql.sh
new file mode 100755
index 0000000..0c29dee
--- /dev/null
+++ b/traffic_ops_db/pg-migration/runmysql.sh
@@ -0,0 +1,16 @@
+#!/bin/bash -x
+#
+# 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.
+#
+
+docker-entrypoint.sh mysqld
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/ac0d7d76/traffic_ops_db/pg-migration/runpgloader.sh
----------------------------------------------------------------------
diff --git a/traffic_ops_db/pg-migration/runpgloader.sh b/traffic_ops_db/pg-migration/runpgloader.sh
new file mode 100755
index 0000000..f6a7d7d
--- /dev/null
+++ b/traffic_ops_db/pg-migration/runpgloader.sh
@@ -0,0 +1,24 @@
+#!/bin/bash -x
+#
+# 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.
+#
+
+pgloader -v \
+ --before create_tables.sql \
+ --cast 'type tinyint to smallint drop typemod' \
+ --cast 'type varchar to text drop typemod' \
+ --cast 'type double to numeric drop typemod' \
+ --with truncate \
+ mysql://$MYSQL_USER:$MYSQL_PASSWORD@$MYSQL_HOST/traffic_ops_db \
+ postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST/$POSTGRES_DATABASE
+exit 0
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/ac0d7d76/traffic_ops_db/pg-migration/runwaiter.sh
----------------------------------------------------------------------
diff --git a/traffic_ops_db/pg-migration/runwaiter.sh b/traffic_ops_db/pg-migration/runwaiter.sh
new file mode 100755
index 0000000..7cf2222
--- /dev/null
+++ b/traffic_ops_db/pg-migration/runwaiter.sh
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+
+echo "WAITER_HOST: $WAITER_HOST"
+echo "WAITER_PORT: $WAITER_PORT"
+
+for c in "$WAITER_HOST $WAITER_PORT" ; do
+ while true; do
+ echo "Waiting 3 seconds for Host and Port: $c "
+ sleep 3
+ nc -z $c && break
+ done
+done
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/ac0d7d76/traffic_ops_db/pg-migration/waiter.yml
----------------------------------------------------------------------
diff --git a/traffic_ops_db/pg-migration/waiter.yml b/traffic_ops_db/pg-migration/waiter.yml
new file mode 100644
index 0000000..2796737
--- /dev/null
+++ b/traffic_ops_db/pg-migration/waiter.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:
+ # waits for a port to be available
+ waiter:
+ build:
+ context: ..
+ dockerfile: pg-migration/Dockerfile-waiter
+ environment:
+ - WAITER_HOST
+ - WAITER_PORT