You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by fr...@apache.org on 2017/06/14 19:36:39 UTC
[8/9] incubator-trafficcontrol git commit: added installer for the
Postgres Docker service
added installer for the Postgres Docker service
(cherry picked from commit c0157f5374488cb194666e89e70819f09c537f5e)
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/e0e50416
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/e0e50416
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/e0e50416
Branch: refs/heads/2.0.x
Commit: e0e504165c26241f8e2ba17659d0738b9b5915d9
Parents: 5f6d364
Author: Dewayne Richardson <de...@apache.org>
Authored: Thu May 11 15:11:48 2017 -0600
Committer: Eric Friedrich <fr...@apache.org>
Committed: Wed Jun 14 15:35:59 2017 -0400
----------------------------------------------------------------------
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 | 29 -----
.../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, 865 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/e0e50416/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/e0e50416/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/e0e50416/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/e0e50416/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/e0e50416/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/e0e50416/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/e0e50416/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/e0e50416/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/e0e50416/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/e0e50416/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/e0e50416/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/e0e50416/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/e0e50416/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/e0e50416/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/e0e50416/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/e0e50416/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/e0e50416/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/e0e50416/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/e0e50416/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/e0e50416/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/e0e50416/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 100644
index f5609c9..0000000
--- a/traffic_ops/app/db/pg-migration/runwaiter.sh
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/bin/bash
-# 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.
-
-
-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/e0e50416/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/e0e50416/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/e0e50416/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/e0e50416/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');