abundant-dawn-56438
08/30/2023, 1:51 PMtall-angle-41306
08/30/2023, 1:53 PMabundant-dawn-56438
08/30/2023, 1:53 PMabundant-dawn-56438
08/30/2023, 1:54 PMfailed to connect to `host=crdb-kratos user=kratos database=kratos`: server error (ERROR: password authentication failed for user kratos (SQLSTATE 28P01))
tall-angle-41306
08/30/2023, 1:55 PMsslmode
?abundant-dawn-56438
08/30/2023, 1:56 PM- DSN=cockroach://${COCKROACH_USER}:${COCKROACH_PASSWORD}@${COCKROACH_HOST}:${COCKROACH_PORT}/${COCKROACH_DATABASE}?sslmode=disable&max_conns=20&max_idle_conns=4
and
- DSN=postgres://${COCKROACH_USER}:${COCKROACH_PASSWORD}@${COCKROACH_HOST}:${COCKROACH_PORT}/${COCKROACH_DATABASE}?sslmode=disable&max_conns=20&max_idle_conns=4
I have also tried putting password as a query for both.abundant-dawn-56438
08/30/2023, 1:57 PMtall-angle-41306
08/30/2023, 1:57 PMabundant-dawn-56438
08/30/2023, 1:57 PMabundant-dawn-56438
08/30/2023, 2:00 PM# CockroachDB for Ory
COCKROACH_DATABASE=kratos
COCKROACH_PASSWORD=secret
COCKROACH_USER=kratos
COCKROACH_HOST=crdb-kratos # Default host and port: localhost:26257
COCKROACH_PORT=26257
Most of my docker compose:
########################## TO TEST KRATOS ##########################
# <https://www.cockroachlabs.com/docs/stable/cockroach-commands>
# <https://www.cockroachlabs.com/docs/stable/start-a-local-cluster-in-docker-linux>
crdb-kratos:
restart: 'always'
image: 'cockroachdb/cockroach:v23.1.8'
env_file:
- .env
command: 'start-single-node --insecure'
healthcheck:
test: ["CMD", "curl", "-f", "<http://localhost:8080/health?ready=1>"]
interval: '10s'
timeout: '30s'
retries: 5
start_period: '20s'
ports:
- '9090:8080'
- '26257:26257'
volumes:
- type: volume
source: crdb-kratos-volume
target: /cockroach/cockroach-data
# there is a distroless image version for production
kratos-selfservice-ui-node:
image: oryd/kratos-selfservice-ui-node:latest
environment:
- KRATOS_PUBLIC_URL=<http://host.docker.internal:8080/> # For connectivity between containers
- KRATOS_BROWSER_URL=<http://127.0.0.1:8080/>
restart: on-failure
kratos-migrate:
image: oryd/kratos:v1.0.0
links:
- crdb-kratos:crdb-kratos
env_file:
- .env
environment:
# <https://www.cockroachlabs.com/docs/stable/connection-parameters>
# connection url from cockroach docs: postgres://<username>:<password>@<host>:<port>/<database>?<parameters
# <https://www.ory.sh/docs/self-hosted/deployment#cockroachdb>
# connection url from ory docs: <cockroach://user:password@host:123/database>
- DSN=cockroach://${COCKROACH_USER}:${COCKROACH_PASSWORD}@${COCKROACH_HOST}:${COCKROACH_PORT}/${COCKROACH_DATABASE}?sslmode=disable&max_conns=20&max_idle_conns=4
volumes:
- type: bind
source: ./kratos
target: /etc/config/kratos
command: -c /etc/config/kratos/kratos.yml migrate sql -e --yes
kratos:
image: oryd/kratos:v1.0.0
links:
- crdb-kratos:crdb-kratos
env_file:
- .env
environment:
- DSN=cockroach://${COCKROACH_USER}:${COCKROACH_PASSWORD}@${COCKROACH_HOST}:${COCKROACH_PORT}/${COCKROACH_DATABASE}?sslmode=disable&max_conns=20&max_idle_conns=4
volumes:
- type: bind
source: ./kratos
target: /etc/config/kratos
command: serve -c /etc/config/kratos/kratos.yml --dev --watch-courier
mailslurper:
image: oryd/mailslurper:latest-smtps
tall-angle-41306
08/30/2023, 2:01 PMabundant-dawn-56438
08/30/2023, 2:01 PMabundant-dawn-56438
08/30/2023, 2:03 PMabundant-dawn-56438
08/30/2023, 2:05 PMabundant-dawn-56438
08/30/2023, 2:08 PMabundant-dawn-56438
08/30/2023, 2:08 PMtall-angle-41306
08/30/2023, 2:39 PMexec
into the container and echo $DSN
Is the string correctly formatted?tall-angle-41306
08/30/2023, 2:40 PMDSN
isn't formatting correctly (maybe escaping the string etc)abundant-dawn-56438
08/30/2023, 2:41 PMDSN=<postgres://kratos@crdb-kratos:26257/kratos?sslmode=disable&max_conns=20&max_idle_conns=4&?password=secret>
abundant-dawn-56438
08/30/2023, 2:41 PMtall-angle-41306
08/30/2023, 2:42 PM&?
abundant-dawn-56438
08/30/2023, 2:44 PMabundant-dawn-56438
08/30/2023, 2:44 PMabundant-dawn-56438
08/30/2023, 2:44 PMtall-angle-41306
08/30/2023, 2:45 PM@
&
!
*
|
etc?abundant-dawn-56438
08/30/2023, 2:45 PMabundant-dawn-56438
08/30/2023, 2:46 PM<postgres://kratos:secret@crdb-kratos:26257/kratos?sslmode=disable&max_conns=20&max_idle_conns=4>
tall-angle-41306
08/30/2023, 2:46 PMsecret
just to avoid sharing the actual password 😅abundant-dawn-56438
08/30/2023, 2:46 PMabundant-dawn-56438
08/30/2023, 2:46 PMabundant-dawn-56438
08/30/2023, 2:46 PMabundant-dawn-56438
08/30/2023, 2:46 PMabundant-dawn-56438
08/30/2023, 2:47 PMabundant-dawn-56438
08/30/2023, 2:47 PMabundant-dawn-56438
08/30/2023, 2:47 PMtall-angle-41306
08/30/2023, 2:49 PMabundant-dawn-56438
08/30/2023, 2:49 PMabundant-dawn-56438
08/30/2023, 2:49 PMabundant-dawn-56438
08/30/2023, 2:49 PMabundant-dawn-56438
08/30/2023, 2:50 PMabundant-dawn-56438
08/30/2023, 2:51 PMtall-angle-41306
08/30/2023, 2:51 PMroot
user, which won't need a password?abundant-dawn-56438
08/30/2023, 2:51 PMabundant-dawn-56438
08/30/2023, 2:51 PMtall-angle-41306
08/30/2023, 2:51 PMabundant-dawn-56438
08/30/2023, 2:51 PMabundant-dawn-56438
08/30/2023, 2:53 PMabundant-dawn-56438
08/30/2023, 2:53 PMabundant-dawn-56438
08/30/2023, 2:57 PMtall-angle-41306
08/30/2023, 3:05 PM==== create key for new user kratos ====
ERROR: setting or updating a password is not supported in insecure mode
SQLSTATE: 28P01
abundant-dawn-56438
08/30/2023, 3:05 PMabundant-dawn-56438
08/30/2023, 3:06 PMabundant-dawn-56438
08/30/2023, 3:06 PMabundant-dawn-56438
08/30/2023, 3:09 PM* INFO: To start a secure server without mandating TLS for clients,
* consider --accept-sql-without-tls instead. For other options, see:
but then you need some certs and to pass that with --cert-dirabundant-dawn-56438
08/30/2023, 3:10 PMabundant-dawn-56438
08/30/2023, 3:10 PMtall-angle-41306
08/30/2023, 3:12 PM--insecure
you can't use COCKROACH_USER
etc to provision the user. You either have to create the user yourself, or using docker-entrypoint-initdb.d
to create them after startup.
If you want to use COCKROACH_USER
then you'll need to setup secure mode properlyabundant-dawn-56438
08/30/2023, 3:13 PMabundant-dawn-56438
08/30/2023, 3:13 PMabundant-dawn-56438
08/30/2023, 3:13 PMabundant-dawn-56438
08/30/2023, 3:13 PMabundant-dawn-56438
08/30/2023, 3:14 PMabundant-dawn-56438
08/30/2023, 3:44 PMabundant-dawn-56438
08/30/2023, 3:44 PMabundant-dawn-56438
08/30/2023, 3:44 PMmagnificent-energy-493
abundant-dawn-56438
08/30/2023, 6:48 PM