edgedb / edgedb-docker

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

docker run -it --rm --link=edgedb not working #89

Closed EncompassingResidential closed 3 months ago

EncompassingResidential commented 3 months ago

Create Docker volume for persistent data

docker volume create edgedb-data
docker volume ls
docker volume inspect edgedb-data

Manually see the volume contents / files:

docker run -it --rm -v edgedb-data:/data ubuntu bash
----------   OR   ----------

You can go to command prompt using Docker desktop

Create a network for CLI security

docker network create edgedb-network

Run the EdgeDB server in the Docker network

docker run -d --name edgedb          \
  --network edgedb-network           \
  -e EDGEDB_SERVER_PASSWORD=secret   \
  -e EDGEDB_SERVER_TLS_CERT_MODE=generate_self_signed \
  -v edgedb-data:/var/lib/edgedb/data \
  edgedb/edgedb
docker images

Run the CLI in the same Docker network

docker run -it --rm --network edgedb-network     \
           edgedb/edgedb-cli  --tls-security=insecure \
           --dsn "edgedb://edgedb:secret@edgedb:5656"

My original post and errors.

Discord posted on 4/16/24: https://discordapp.com/channels/841451783728529451/1113918639985401896/1229926207974281466 As of 4/19/24 I didn't get a response to this Docker creation question(s):

Hello, trying to get docker image and container created. I have Docker Desktop version 4.28.0 installed. Windows 11 edgedb --version EdgeDB CLI 4.1.1+1520d83

This command works and I see the container running: docker run --name edgedb -d -e EDGEDB_SERVER_SECURITY=insecure_dev_mode edgedb/edgedb

Band_Tree_DB already exists on my local machine, there exists \Band Tree\edgedb.toml and \Band Tree\dbschema\default.esdl and dbschema\migrations\00001.edgeql, etc.:

But then in my BASH shell, this doesn't work.

docker run -it --rm --link=edgedb \ -e EDGEDB_SERVER_PASSWORD=secret \ -v edgedb-cli-config:/.config/edgedb edgedb/edgedb-cli \ -H edgedb instance link my_instance

Unable to find image 'edgedb/edgedb-cli:latest' locally latest: Pulling from edgedb/edgedb-cli dfa24c70b482: Pull complete 37ef7359bc7d: Pull complete Digest: sha256:84428264b4a5aaf338a25c63d718cf78b0e95ffd2dba5c851f7a32b3149c0823 Status: Downloaded newer image for edgedb/edgedb-cli:latest Specify server port [default: 5656]:

5656 Specify database user [default: edgedb]: edgedb Specify database name [default: edgedb]: Band_Tree_DB Unknown server certificate: SHA1:8a26889a73af0f234b447fddf0c7b35b251e0c9a. Trust? [y/N] y edgedb error: UnknownDatabaseError: database 'Band_Tree_DB' does not exist Server traceback: Traceback (most recent call last): File "edb/server/dbview/dbview.pyx", line 1200, in edb.server.dbview.dbview.DatabaseIndex.get_db KeyError: 'Band_Tree_DB'

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "edb/server/protocol/frontend.pyx", line 347, in edb.server.protocol.frontend.FrontendConnection.main
    File "edb/server/protocol/binary.pyx", line 986, in authenticate
    File "edb/server/protocol/binary.pyx", line 295, in auth
    File "edb/server/protocol/binary.pyx", line 390, in _start_connection
    File "/usr/lib/x86_64-linux-gnu/edgedb-server-4/lib/python3.11/site-packages/edb/server/tenant.py", line 1028, in new_dbview
      db = self.get_db(dbname=dbname)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/lib/x86_64-linux-gnu/edgedb-server-4/lib/python3.11/site-packages/edb/server/tenant.py", line 293, in get_db
      return self._dbindex.get_db(dbname)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "edb/server/dbview/dbview.pyx", line 1202, in edb.server.dbview.dbview.DatabaseIndex.get_db
  edb.errors.UnknownDatabaseError: database 'Band_Tree_DB' does not exist

Then I replied to my own post with more specific questions on 4/16/24 (https://discordapp.com/channels/841451783728529451/1113918639985401896/1229926207974281466):

when I changed the "docker run -it --rm --link-edgedb ..." DB instance response to: Specify database name [default: edgedb]:

edgedb

Then it seems to run correctly. But when I run: Successfully linked to remote instance. To connect run: edgedb -I edgedb

John@LAPTOP MINGW64 /c/repos/Band Tree (fly.io-bandtree-2024-03-20) $ edgedb -I edgedb edgedb error: ClientError: cannot read credentials file C:\Users\John\AppData\Local\EdgeDB\config\credentials\edgedb.json: The system cannot find the file specified. (os error 2)

$ date; docker exec -it edgedb bash; date Tue, Apr 16, 2024 3:36:05 PM root@217e064a560d:/# edgedb -I edgedb [2024-04-16T22:36:17Z WARN edgedb::version_check] Newer version of edgedb tool exists 4.1.1+1504ebf (current 4.1.0+127aeb9) edgedb error: ClientError: cannot read credentials file /root/.config/edgedb/credentials/edgedb.json: No such file or directory (os error 2)

Noticed this Discord conversation 2/13/24 about Docker building:

<@224957816681660416> in https://discordapp.com/channels/841451783728529451/1205355511764221962/1206945365530644540 mentions linking the CLI, but I don't think that is working?

When I went inside the edgedb docker Container, edgedb runs but no creation commands work:

root@217e064a560d:/# edgedb [2024-04-16T22:39:16Z WARN edgedb::version_check] Newer version of edgedb tool exists 4.1.1+1504ebf (current 4.1.0+127aeb9)

edgedb error: no edgedb.toml found and no connection options are specified Hint: Run edgedb project init or use any of -H, -P, -I arguments to specify connection parameters. See --help for details

root@217e064a560d:/# edgedb project init [2024-04-16T22:39:26Z WARN edgedb::version_check] Newer version of edgedb tool exists 4.1.1+1504ebf (current 4.1.0+127aeb9)

edgedb error: edgedb project init is not supported in Docker containers.

fmoor commented 3 months ago

@EncompassingResidential thanks for the thorough write up!

It seems like you have this worked out, so I'm going to close this. Feel free to reopen if I missed something.

EncompassingResidential commented 3 months ago

Thanks. Can you look at my new issue on Discord… in cloud section today 4/24/24 …

Sincerely and Thanks, John Ritz, Software Engineer II 503-309-6411 cell @.*** www.linkedin.com/in/johntritz https://github.com/EncompassingResidential/Band-Tree

On Wed, Apr 24, 2024 at 11:43 AM Frederick @.***> wrote:

@EncompassingResidential https://github.com/EncompassingResidential thanks for the thorough write up!

It seems like you have this worked out, so I'm going to close this. Feel free to reopen if I missed something.

— Reply to this email directly, view it on GitHub https://github.com/edgedb/edgedb-docker/issues/89#issuecomment-2075598687, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWOLCDO5VTXPM3ACLGIPTCLY674LVAVCNFSM6AAAAABGPQWVOOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANZVGU4TQNRYG4 . You are receiving this because you were mentioned.Message ID: @.***>