Please sign in to comment.
Options to use local Docker for temporary schema (#45)
BACKGROUND: Skeema's behavior does not rely on parsing SQL DDL, as this can be too brittle across various MySQL versions and vendors, which have subtle differences in features and functionality. Instead, Skeema uses metadata reported directly from the database to introspect schemas, using information_schema as well as various SHOW commands. In order to accurately introspect the schemas represented in your filesystem's *.sql files, Skeema actually runs the files' CREATE TABLE statements in a temporary location, now called a "workspace." Previously (and still by default), Skeema creates, uses, and then drops a temporary schema on each database it interacts with. WHAT'S NEW: This PR adds the ability to instead use a local Docker container for workspace operations. Two new options control this behavior: * `workspace=docker` tells Skeema to dynamically manage local Docker container(s) for workspace operations, instead of using a temporary schema on each live DB. * `docker-cleanup` controls how to manage the container lifecycle as Skeema is exiting. The default, `docker-cleanup=none`, leaves containers running so that subsequent invocations of Skeema are faster. Setting `docker-cleanup=stop` stops containers but does not remove them, and `docker-cleanup=destroy` deletes them entirely. This functionality is especially useful when running Skeema from a different region/datacenter than your database -- for example, running Skeema on your laptop, when your databases are in AWS. Using `workspace=docker` greatly reduces painful network latency in this scenario, especially if you have a large number of tables. See discussion in #25 for background.
- Loading branch information...
Showing with 813 additions and 360 deletions.
- +4 −4 Gopkg.lock
- +4 −4 README.md
- +20 −23 applier/target.go
- +7 −0 applier/target_test.go
- +28 −20 applier/verifier.go
- +15 −21 cmd_lint.go
- +18 −28 cmd_pull.go
- +3 −1 doc/config.md
- +16 −16 doc/faq.md
- +63 −8 doc/options.md
- +9 −10 doc/requirements.md
- +20 −19 fs/dir.go
- +9 −9 fs/dir_test.go
- +8 −5 fs/statement.go
- +6 −0 fs/statement_test.go
- +5 −2 skeema.go
- +6 −0 skeema_cmd_test.go
- +4 −4 skeema_test.go
- +2 −0 util/config.go
- +10 −1 vendor/github.com/skeema/mybase/config.go
- +37 −2 vendor/github.com/skeema/tengo/docker.go
- +0 −26 vendor/github.com/skeema/tengo/testing.go
- +136 −0 workspace/localdocker.go
- +109 −0 workspace/localdocker_test.go
- +7 −6 workspace/tempschema.go
- +14 −17 workspace/tempschema_test.go
- +161 −88 workspace/workspace.go
- +92 −46 workspace/workspace_test.go
Oops, something went wrong.