Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker-compose example is broken #6521

Closed
deepthi opened this issue Jul 31, 2020 · 12 comments · Fixed by #6584
Closed

docker-compose example is broken #6521

deepthi opened this issue Jul 31, 2020 · 12 comments · Fixed by #6584
Assignees
Milestone

Comments

@deepthi
Copy link
Member

deepthi commented Jul 31, 2020

Overview of the Issue

docker-compose example doesn't work.
Reported by @jamisonhyatt on 7.0 (docker tag v7.0.0), I have confirmed on master.

Reproduction Steps

Follow the steps in https://github.com/vitessio/vitess/blob/master/examples/compose/README.md
Run any query against vtgate.

$ docker exec -it compose_vtgate_1 mysql -u root -h 127.0.0.1 -P 15306 -D test_keyspace -e 'select * from information_schema.tables;' 
ERROR 1105 (HY000) at line 1: vtgate: http://38f13b547dc9:8080/: target: test_keyspace.-80.master: no valid tablet

Binary version

vitess/base:latest

        "Id": "sha256:f8df41a172ccfb00438fe17e6f2374136a1f65556ff102dc6a23f34287a91d22",
        "RepoTags": [
            "vitess/base:latest"
        ],
        "RepoDigests": [
            "vitess/base@sha256:b8f89b94f17220183e4593b4825cc2447344e332b6f0bb0a7f5ebaecc62d402b"
        ],
        "Parent": "",
        "Comment": "",
        "Created": "2020-07-31T04:09:58.529785637Z",
        "Container": "f5fdc67e5200c436d44bfd06b48f3634220a6b8f0852ddb7947ee1073b453dbe",

Operating system and Environment details

$ docker --version
Docker version 19.03.6, build 369ce74a3c

Log Fragments

https://gist.github.com/deepthi/c2dc42858d47c92895f2536615b8ef6e

@deepthi
Copy link
Member Author

deepthi commented Jul 31, 2020

This is because of the incompatible changes made in #6131 and #6345
The example uses InitTablet ... -allow_master to set a master tablet per shard. InitTablet is deprecated. Instead once all the tablets are up, it is necessary to use InitShardMaster to designate a master tablet.

@deepthi deepthi changed the title docker-compose is broken docker-compose example is broken Jul 31, 2020
@jamisonhyatt
Copy link

Thanks @deepthi - creating this was on my to-do list just hadn't gotten around to it.

@deepthi
Copy link
Member Author

deepthi commented Aug 3, 2020

cc @shlomi-noach

@shlomi-noach shlomi-noach self-assigned this Aug 10, 2020
@shlomi-noach
Copy link
Contributor

@jamisonhyatt hi 👋 ! I'd like to understand better what it is you're trying to achieve -- we haven't been looking into Docker compose for a while and have been looking at alternate paths. I'd like to understand whether those other paths can work out for whatever it is you're doing.

@jamisonhyatt
Copy link

jamisonhyatt commented Aug 10, 2020

Short version: I was using the docker-compose to run the complete Vitess stack (for lack of a better term) for local development/testing and CI integration testing.

To be fair, nothing is stopping me from completely rolling my own. As someone completely new to Vitess I will say examples/compose probably saved me hours, if not days, of time figuring out all the different layers which needed to be wired up to get it running locally. I had to make my own modifications to the resulting compose & included bash scripts, but it was working great (before it broke.)

Longer version: I was working on a feature to add a DB to an existing service. Production was going to run against Vitess, so having it running locally was really helpful in making sure I wasn't using things that work in mysql, but do not work in Vitess. I'm also a strong believer in being able to develop locally without a reliance on the network (e.g., I shouldn't have to be VPN'd to get the things done) and pristine CI test environments. Spinning up Vitess as an integration test dependency on every CI run via compose was a good way to maintain high confidence that everything was working as expected. IE you can run your service on your laptop with a vitess sharded keyspace and be confident that you haven't developed something that will fall down at deploy time (or worse.)

@shlomi-noach
Copy link
Contributor

shlomi-noach commented Aug 18, 2020

@jamisonhyatt sorry to have dropped this. We recently published a docker build/image called local, described here. TL;DR make docker_local && ./docker/local/run.sh will give you:

  • A MySQL replication topology with 1*master, 1*replica, 1*rdonly (a replica, but for OLAP purposes)
  • vttablet for each of the above
  • vtgate, vtctld
  • sample schema

All in a single docker image, no compose.

I wonder if that's something that might satisfy your needs. Please let me know either way. I'll meanwhile also look into what broke in our compose. Eventually we'll need to decide whether we want to continue both approaches or pick one. Your input will be valuable to us.

@shlomi-noach
Copy link
Contributor

#6584 fixes docker-compose example, please feel free to try it out. For your convenience, attached is a working docker-compose.yml file (renamed as .txt so that GitHub permits the attachement).

docker-compose.yml.txt

@jamisonhyatt
Copy link

I don't think I really mind whether it's one container or many via compose, but let me be a little naive - It's my understanding that some queries against an unsharded schema are supported which are not allowed against a sharded schema. So, if someone testing their application which has no vschema, then they'd be fine with this container. However, if they need to test against a sharded vschema, they would need utilize compose.

Is that true, or have I misunderstood?

@shlomi-noach
Copy link
Contributor

@jamisonhyatt I believe you're right, but I'll defer to @deepthi on this.

(noting that the issue was auto-closed by merging #6584, but let's keep the discussion running)

@deepthi
Copy link
Member Author

deepthi commented Aug 18, 2020

Even with a single shard, you can define a sharded vschema and that will immediately start affecting how queries are handled.
Regardless, since we did not deprecate docker-compose in 7.0, we should keep it working until and unless we make a conscious decision to deprecate it. It is now fixed in master and release-7.0 thanks to @shlomi-noach.

@deepthi deepthi added this to the 7.0.1 milestone Aug 21, 2020
@deepthi
Copy link
Member Author

deepthi commented Aug 21, 2020

@jamisonhyatt the example still uses the (old) discoverygateway. are you still using that or have you switched to tabletgateway?
I'd like to change the example to tabletgateway since we have deprecated discoverygateway.

@jamisonhyatt
Copy link

Feel free, I am currently pointing to a MySQL instance in dev/test and have an issue to switch back to the local container, but with a sharded vschema since it appears that will satisfy our needs. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants