edgedb / edgedb-docker

Official Docker Image packaging for EdgeDB
83 stars 16 forks source link

Basic instructions not working #6

Closed adriangb closed 3 years ago

adriangb commented 3 years ago

Thank you for this project! It is very interesting.

I'm not sure if this is a documentation problem, a bug or a lack of understanding on my end. I'm trying to spin up an EdgeDB instance inside a container. First, I bring up the container (based on the download/install instructions):

docker run -it --rm -p 5656:5656 -p 8888:8888 --name=edgedb-server -v /var/lib/edgedb/data:/var/lib/edgedb/data edgedb/edgedb

That works fine. It also differs from the instructions in the README.md of this repo (which should be updated or just point to other docs).

Next step is to connect to this container. Presumably, I would just start following the tutorial. From outside of my container (OS X for me), I run:

edgedb -Idefault
Error: cannot read credentials file /Users/.../.edgedb/credentials/default.json: could not read file `/Users/.../.edgedb/credentials/default.json`: No such file or directory (os error 2)

Alright... Next I try:

edgedb --no-password
Error: Error authenticating: ERROR: AuthenticationError: database "myusername" does not exist

Alright, I saw in docker-entrypoint.sh that admin access is set up, so I try that:

edgedb --no-password --admin
Error: No such file or directory (os error 2)

The only way I was able to connect at all was:

docker exec -it <container> bash
edgedb --no-password --admin

The errors are not giving me any useful information to go off of (like, did you create a database? or admin port not found) so I figured I'd ask here: am I missing something 😅 ?

Thanks!

tailhook commented 3 years ago

Currently, you can do:

edgedb ---database=edgedb

The ERROR: AuthenticationError: database "myusername" does not exist issue is fixed in master/nightly version of command-line tools and will be released soon. (the release will make --database=edgedb redundant).

You could also make docker installation with edgedb:

edgedb server install --method=docker
edgedb server init default
edgedb -Idefault  # << works now

We're still exploring a more correct way for authentication in docker image by default, that works better for non edgedb server install-based installations. You can use workarounds above in the meantime.

adriangb commented 3 years ago

Thank you. It seems that I also had to specify the user:

edgedb ---database=edgedb -u edgedb

But with that I have basic functionality working!

What does --method=docker do (i.e. does it spin up a docker image with docker run -d edgedb/edgedb or what exactly)?

tailhook commented 3 years ago

Thank you. It seems that I also had to specify the user:

Yes, you're right. Sorry. My only excuse is that it will not be needed after the release :)

But with that I have basic functionality working!

What does --method=docker do (i.e. does it spin up a docker image with docker run -d edgedb/edgedb or what exactly)?

Basically yes. It also creates a volume for the data. And keeps track of those instances to make server version upgrades easier.

adriangb commented 3 years ago

Very nice. Thank you!

adriangb commented 3 years ago
edgedb ---database=edgedb -u edgedb

This no longer seems to be working. I am getting:

edgedb error: Password required for the specified user/host

Are there updated instructions on getting set up with Docker? edgedb server install --method=docker isn't really an alternative to running via docker directly, or at least I don't see how I would get that to work with docker-compose.

tailhook commented 3 years ago

Instruction should be up shortly. For now you want to pass the same EDGEDB_PASSWORD both to the server process and to the client process.

See https://github.com/edgedb/edgedb-docker/pull/11 for more info and docker-compose.yml for an example.

adriangb commented 3 years ago

Thank you for the quick reply. Looking through #11, the env vars make sense. So I tried:

docker run -p 5656:5656 --env EDGEDB_PASSWORD=test --env EDGEDB_USER=edgedb edgedb/edgedb:nightly

And then tried connecting from the CLI on my host:

edgedb -u edgedb --password
EDGEDB_PASSWORD=test EDGEDB_USER=edgedb edgedb  # also works

Which worked like a charm.

It looks like this is basically what the compose is doing, so we should be all good! Thank you for the quick reply.