Closed Mulugruntz closed 3 years ago
The default Docker image no longer defaults to Trust
auth for security considerations, you need to make an explicit choice: either set -v EDGEDB_PASSWORD=...
to configure an explicit password or set -v EDGEDB_BOOTSTRAP_COMMAND="CONFIGURE SYSTEM INSERT Auth {priority := 0, method := (INSERT Trust)}"
to restore the old insecure behavior. Both need to be specified once when you first run a container on a fresh data dir.
All that said, the recommended way is to use the edgedb server
CLI instead:
edgedb server install --method=docker --version=1-beta1
edgedb server init --version=1-beta1 my_instance
This will configure strong auth and store credentials in a local file (under ~/.edgedb
by default). Then, connecting to a named instance is as easy as:
async def main():
pool = await edgedb.create_async_pool('my_instance', min_size=2)
Thanks @elprans .
However, I'm not sure I understand the recommended way. If I use docker-compose with something like
services:
app:
container_name: app
build: .
edgedb:
container_name: edgedb
image: edgedb/edgedb:1-beta1
# ...
where would I do my edgedb server
commands?
In the client container (app
)? As it doesn't seem to be a command for the container. Which still raises the question if the official hub image is still "plug and play".
Or maybe that implies that the "recommended way" is to not use the docker hub image?
Oh, for compose, the EDGEDB_PASSWORD
is probably simplest. Example: https://github.com/edgedb/edgedb-docker/blob/master/tests/compose/docker-compose.yml
Thanks for your quick reply as always, @elprans .
I'm not sure if I'm missing something obvious here.
I actually already digged in this repo and found this EDGEDB_PASSWORD
/EDGEDB_USER
env. I already added them into my compose file, but it didn't change the result.
I just tried by adding this &pwd
/[*pwd]
thing as well. And it's still the same result.
edgedb:
container_name: edgedb
image: edgedb/edgedb:1-beta1
environment:
- EDGEDB_USER=edgedb
- EDGEDB_PASSWORD=edgedb
$> docker exec -it 784e971341f5 env
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
HOSTNAME=784e971341f5
TERM=xterm
EDGEDB_USER=edgedb
EDGEDB_PASSWORD=edgedb
GOSU_VERSION=1.11
LANG=en_US.utf8
VERSION=1-beta1
EDGEDB_DATADIR=/var/lib/edgedb/data
HOME=/root
import edgedb
edgedb.connect(user='edgedb', password='edgedb')
Traceback (most recent call last):
File "/Users/sgiffard/Library/Application Support/JetBrains/PyCharm2020.3/scratches/scratch_17.py", line 2, in <module>
edgedb.connect(user='edgedb', password='edgedb')
File "/Users/sgiffard/.local/share/virtualenvs/cfd-bot-async-dKbG-5ki/lib/python3.9/site-packages/edgedb/blocking_con.py", line 374, in connect
conn.ensure_connected()
File "/Users/sgiffard/.local/share/virtualenvs/cfd-bot-async-dKbG-5ki/lib/python3.9/site-packages/edgedb/blocking_con.py", line 165, in ensure_connected
self._reconnect(single_attempt=single_attempt)
File "/Users/sgiffard/.local/share/virtualenvs/cfd-bot-async-dKbG-5ki/lib/python3.9/site-packages/edgedb/blocking_con.py", line 171, in _reconnect
self._impl.connect(self._addrs, self._config, self._params,
File "/Users/sgiffard/.local/share/virtualenvs/cfd-bot-async-dKbG-5ki/lib/python3.9/site-packages/edgedb/blocking_con.py", line 62, in connect
self._connect_addr(addr, config, params, connection)
File "/Users/sgiffard/.local/share/virtualenvs/cfd-bot-async-dKbG-5ki/lib/python3.9/site-packages/edgedb/blocking_con.py", line 126, in _connect_addr
proto.sync_connect()
File "edgedb/protocol/blocking_proto.pyx", line 88, in edgedb.protocol.blocking_proto.BlockingIOProtocol.sync_connect
File "edgedb/protocol/blocking_proto.pyx", line 77, in edgedb.protocol.blocking_proto.BlockingIOProtocol._iter_coroutine
File "edgedb/protocol/protocol.pyx", line 915, in connect
File "edgedb/protocol/protocol.pyx", line 983, in _auth_sasl
edgedb.errors.AuthenticationError: invalid SCRAM verifier for user 'edgedb'
When changing to
edgedb:
container_name: edgedb
image: edgedb/edgedb:1-beta1
environment:
- EDGEDB_USER=test1
- EDGEDB_PASSWORD=test2
import edgedb
edgedb.connect(user='test1', password='test2')
I get a different error message:
Traceback (most recent call last):
File "/Users/sgiffard/Library/Application Support/JetBrains/PyCharm2020.3/scratches/scratch_17.py", line 2, in <module>
edgedb.connect(user='test1', password='test2')
File "/Users/sgiffard/.local/share/virtualenvs/cfd-bot-async-dKbG-5ki/lib/python3.9/site-packages/edgedb/blocking_con.py", line 374, in connect
conn.ensure_connected()
File "/Users/sgiffard/.local/share/virtualenvs/cfd-bot-async-dKbG-5ki/lib/python3.9/site-packages/edgedb/blocking_con.py", line 165, in ensure_connected
self._reconnect(single_attempt=single_attempt)
File "/Users/sgiffard/.local/share/virtualenvs/cfd-bot-async-dKbG-5ki/lib/python3.9/site-packages/edgedb/blocking_con.py", line 171, in _reconnect
self._impl.connect(self._addrs, self._config, self._params,
File "/Users/sgiffard/.local/share/virtualenvs/cfd-bot-async-dKbG-5ki/lib/python3.9/site-packages/edgedb/blocking_con.py", line 62, in connect
self._connect_addr(addr, config, params, connection)
File "/Users/sgiffard/.local/share/virtualenvs/cfd-bot-async-dKbG-5ki/lib/python3.9/site-packages/edgedb/blocking_con.py", line 126, in _connect_addr
proto.sync_connect()
File "edgedb/protocol/blocking_proto.pyx", line 88, in edgedb.protocol.blocking_proto.BlockingIOProtocol.sync_connect
File "edgedb/protocol/blocking_proto.pyx", line 77, in edgedb.protocol.blocking_proto.BlockingIOProtocol._iter_coroutine
File "edgedb/protocol/protocol.pyx", line 915, in connect
File "edgedb/protocol/protocol.pyx", line 1023, in _auth_sasl
edgedb.errors.AuthenticationError: authentication failed
EDGEDB_PASSWORD/EDGEDB_USER
are only applied on new datadirs, so make sure the mounted data volume is empty when you change them.
It works! Thanks @elprans !
Should I open an issue to update documentation? Here or on the other repo? Or should I leave this one open?
I already opened #17 for the docs issue. Feel free to close this.
I switched to edgedb/edgedb:1-beta1 and just running this code fails:
Error message:
The Python client is 0.13.0 https://pypi.org/project/edgedb/0.13.0/
Is it related to the new CLI mentioned here? https://www.edgedb.com/blog/edgedb-1-0-beta-1-sirius I tried to search for an answer in the docs but couldn't. Would they need to be updated?