Skip to content
This repository was archived by the owner on Nov 24, 2025. It is now read-only.

Golang DB admin#3047

Merged
dangogh merged 6 commits intoapache:masterfrom
rawlinp:go-db-admin
Dec 13, 2018
Merged

Golang DB admin#3047
dangogh merged 6 commits intoapache:masterfrom
rawlinp:go-db-admin

Conversation

@rawlinp
Copy link
Copy Markdown
Contributor

@rawlinp rawlinp commented Nov 20, 2018

What does this PR do?

Add a golang implementation of the TO db/admin.pl script. Vendor the gopkg.in/yaml.v2 package for parsing the dbconf.yml file (the config file for goose). Build the golang executable into the TO rpm next to the db/admin.pl script. Add a deprecation warning to the db/admin.pl script to use the db/admin binary instead. Add a docker environment for running DB tests (uses the golang db/admin binary to test the sql migrations, seeds, patches, etc).

Which TC components are affected by this PR?

  • Documentation
  • Grove
  • Traffic Analytics
  • Traffic Monitor
  • Traffic Ops
  • Traffic Ops ORT
  • Traffic Portal
  • Traffic Router
  • Traffic Stats
  • Traffic Vault
  • Other _________

What is the best way to verify this PR?

Pull down this PR locally and:

cd traffic_ops/app/db
go build admin.go
cd ..
db/admin <insert arg here>

Go back and forth between using db/admin and db/admin.pl to verify that the behavior of the same arguments is the same for both.
Run the provided DB test using docker-compose (pass it a traffic_ops.rpm and initial DB dump from your local TO instance):

To build and copy the traffic_ops.rpm:
./pkg -v traffic_ops_build
cp dist/traffic_ops-* traffic_ops_db/test/docker/traffic_ops.rpm

To grab an initial DB dump and place it for the test, use the <insert your TO hostname here>/api/1.3/dbdump endpoint and copy the response to traffic_ops_db/test/docker/initdb.d/.
Then run the tests w/ docker-compose:

cd traffic_ops_db/test/docker
docker-compose build
docker-compose up --exit-code-from trafficops-db-admin

Check all that apply

  • This PR includes tests
  • This PR includes documentation updates
  • This PR includes an update to CHANGELOG.md
  • This PR includes all required license headers
  • This PR includes a database migration (ensure that migration sequence is correct)
  • This PR fixes a serious security flaw. Read more: www.apache.org/security

@rawlinp rawlinp added new feature A new feature, capability or behavior Traffic Ops related to Traffic Ops labels Nov 20, 2018
@asfgit
Copy link
Copy Markdown
Contributor

asfgit commented Nov 20, 2018

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/trafficcontrol-PR/2825/
Test FAILed.

@ezelkow1
Copy link
Copy Markdown
Member

Tested with a dummy migration and could see the up/down being tested

@asfgit
Copy link
Copy Markdown
Contributor

asfgit commented Dec 11, 2018

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/trafficcontrol-PR/2934/
Test PASSed.

- moved .gitignore items into a .gitignore closer to the actual files
- added workaround to use golang package in centos7
- fixed missing && in Dockerfile-db-admin RUN line
@asfgit
Copy link
Copy Markdown
Contributor

asfgit commented Dec 11, 2018

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/trafficcontrol-PR/2935/
Test PASSed.

@dangogh dangogh self-assigned this Dec 11, 2018
@dangogh dangogh merged commit 00dc941 into apache:master Dec 13, 2018
@dangogh
Copy link
Copy Markdown
Member

dangogh commented Dec 13, 2018

tested in cdn-in-a-box -- all commands worked as advertised..

@rawlinp rawlinp deleted the go-db-admin branch December 13, 2018 22:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

new feature A new feature, capability or behavior Traffic Ops related to Traffic Ops

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants