dg4prez closed pull request #2966: Backport #2962 to 3.0.x URL: https://github.com/apache/trafficcontrol/pull/2966
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/traffic_ops_db/pg-migration/Dockerfile-convert b/traffic_ops_db/pg-migration/Dockerfile-convert deleted file mode 100644 index 454f58a04..000000000 --- a/traffic_ops_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 pg-migration/convert_bools.sql . - -CMD ./runconvert.sh diff --git a/traffic_ops_db/pg-migration/Dockerfile-mysql b/traffic_ops_db/pg-migration/Dockerfile-mysql deleted file mode 100644 index 0b3d0dff5..000000000 --- a/traffic_ops_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 diff --git a/traffic_ops_db/pg-migration/Dockerfile-mysql-to-postgres b/traffic_ops_db/pg-migration/Dockerfile-mysql-to-postgres deleted file mode 100644 index b1da689cc..000000000 --- a/traffic_ops_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 <[email protected]> - -# 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 diff --git a/traffic_ops_db/pg-migration/Dockerfile-pgloader b/traffic_ops_db/pg-migration/Dockerfile-pgloader deleted file mode 100644 index fec7f97e3..000000000 --- a/traffic_ops_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 <[email protected]> - -ADD pg-migration/runpgloader.sh . -ADD create_tables.sql . -CMD ./runpgloader.sh diff --git a/traffic_ops_db/pg-migration/Dockerfile-postgres b/traffic_ops_db/pg-migration/Dockerfile-postgres deleted file mode 100644 index 6f3c634ec..000000000 --- a/traffic_ops_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" diff --git a/traffic_ops_db/pg-migration/Dockerfile-waiter b/traffic_ops_db/pg-migration/Dockerfile-waiter deleted file mode 100644 index 0531c7162..000000000 --- a/traffic_ops_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 diff --git a/traffic_ops_db/pg-migration/README.md b/traffic_ops_db/pg-migration/README.md deleted file mode 100644 index beeb755e7..000000000 --- a/traffic_ops_db/pg-migration/README.md +++ /dev/null @@ -1,35 +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. ---> - -# 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` diff --git a/traffic_ops_db/pg-migration/convert.yml b/traffic_ops_db/pg-migration/convert.yml deleted file mode 100644 index fb130e9ba..000000000 --- a/traffic_ops_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 diff --git a/traffic_ops_db/pg-migration/convert_bools.sql b/traffic_ops_db/pg-migration/convert_bools.sql deleted file mode 100755 index 5835e6cc8..000000000 --- a/traffic_ops_db/pg-migration/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; diff --git a/traffic_ops_db/pg-migration/migrate.sh b/traffic_ops_db/pg-migration/migrate.sh deleted file mode 100755 index 3cb029dc1..000000000 --- a/traffic_ops_db/pg-migration/migrate.sh +++ /dev/null @@ -1,122 +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 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 - IMAGE=$IMAGE"_1" - docker rm $IMAGE - - # 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 diff --git a/traffic_ops_db/pg-migration/mysql-to-postgres.env b/traffic_ops_db/pg-migration/mysql-to-postgres.env deleted file mode 100644 index 086e68e07..000000000 --- a/traffic_ops_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 diff --git a/traffic_ops_db/pg-migration/mysql-to-postgres.sh b/traffic_ops_db/pg-migration/mysql-to-postgres.sh deleted file mode 100755 index 7ab7013b6..000000000 --- a/traffic_ops_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 - diff --git a/traffic_ops_db/pg-migration/mysql-to-postgres.yml b/traffic_ops_db/pg-migration/mysql-to-postgres.yml deleted file mode 100644 index b5c99df2a..000000000 --- a/traffic_ops_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 diff --git a/traffic_ops_db/pg-migration/mysql/conf.d/mysql.cnf b/traffic_ops_db/pg-migration/mysql/conf.d/mysql.cnf deleted file mode 100755 index c2c94fe91..000000000 --- a/traffic_ops_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 diff --git a/traffic_ops_db/pg-migration/mysql_host.yml b/traffic_ops_db/pg-migration/mysql_host.yml deleted file mode 100644 index fb02e3b5f..000000000 --- a/traffic_ops_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" diff --git a/traffic_ops_db/pg-migration/pgloader.yml b/traffic_ops_db/pg-migration/pgloader.yml deleted file mode 100644 index d9e314977..000000000 --- a/traffic_ops_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 diff --git a/traffic_ops_db/pg-migration/postgres.yml b/traffic_ops_db/pg-migration/postgres.yml deleted file mode 100644 index 72a765e1c..000000000 --- a/traffic_ops_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 - diff --git a/traffic_ops_db/pg-migration/runconvert.sh b/traffic_ops_db/pg-migration/runconvert.sh deleted file mode 100755 index 59b1afb13..000000000 --- a/traffic_ops_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 diff --git a/traffic_ops_db/pg-migration/runmysql.sh b/traffic_ops_db/pg-migration/runmysql.sh deleted file mode 100755 index 0c29dee46..000000000 --- a/traffic_ops_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 diff --git a/traffic_ops_db/pg-migration/runpgloader.sh b/traffic_ops_db/pg-migration/runpgloader.sh deleted file mode 100755 index f6a7d7d8e..000000000 --- a/traffic_ops_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 diff --git a/traffic_ops_db/pg-migration/runwaiter.sh b/traffic_ops_db/pg-migration/runwaiter.sh deleted file mode 100644 index f5609c994..000000000 --- a/traffic_ops_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 diff --git a/traffic_ops_db/pg-migration/waiter.yml b/traffic_ops_db/pg-migration/waiter.yml deleted file mode 100644 index 27967379a..000000000 --- a/traffic_ops_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 ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
