Database connection not working

Hi, i was trying to create a template for coolify, but i can't make it work.. My docker compose:
# documentation: https://www.rivet.dev/docs
# slogan: Open-source visual AI programming environment for building AI agents with LLMs
# category: ai
# tags: ai, visual programming, llm, chatbot, agent, postgresql
# logo: svgs/rivet.svg
# port: 6420

services:
rivet-engine:
image: rivetkit/engine:25.8.0
environment:
- SERVICE_URL_RIVET_6420
- RIVET__POSTGRES__URL=postgresql://$SERVICE_USER_POSTGRESQL:$SERVICE_PASSWORD_POSTGRESQL@postgresql:5432/${POSTGRESQL_DATABASE-rivet}
- RIVET__FILE_SYSTEM__PATH=/data
volumes:
- rivet-data:/data
depends_on:
postgresql:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "wget --no-verbose --tries=1 --spider http://127.0.0.1:6420/health || exit 1"]
interval: 5s
timeout: 20s
retries: 10

postgresql:
image: postgres:15-alpine
volumes:
- rivet-postgresql-data:/var/lib/postgresql/data
environment:
- POSTGRES_USER=${SERVICE_USER_POSTGRESQL}
- POSTGRES_PASSWORD=${SERVICE_PASSWORD_POSTGRESQL}
- POSTGRES_DB=${POSTGRESQL_DATABASE-rivet}
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
interval: 5s
timeout: 20s
retries: 10
# documentation: https://www.rivet.dev/docs
# slogan: Open-source visual AI programming environment for building AI agents with LLMs
# category: ai
# tags: ai, visual programming, llm, chatbot, agent, postgresql
# logo: svgs/rivet.svg
# port: 6420

services:
rivet-engine:
image: rivetkit/engine:25.8.0
environment:
- SERVICE_URL_RIVET_6420
- RIVET__POSTGRES__URL=postgresql://$SERVICE_USER_POSTGRESQL:$SERVICE_PASSWORD_POSTGRESQL@postgresql:5432/${POSTGRESQL_DATABASE-rivet}
- RIVET__FILE_SYSTEM__PATH=/data
volumes:
- rivet-data:/data
depends_on:
postgresql:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "wget --no-verbose --tries=1 --spider http://127.0.0.1:6420/health || exit 1"]
interval: 5s
timeout: 20s
retries: 10

postgresql:
image: postgres:15-alpine
volumes:
- rivet-postgresql-data:/var/lib/postgresql/data
environment:
- POSTGRES_USER=${SERVICE_USER_POSTGRESQL}
- POSTGRES_PASSWORD=${SERVICE_PASSWORD_POSTGRESQL}
- POSTGRES_DB=${POSTGRESQL_DATABASE-rivet}
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
interval: 5s
timeout: 20s
retries: 10
Container log:
Error: failed to deserialize config

Caused by:
unknown field `postgres`
Error: failed to deserialize config
Caused by:
unknown field `file_system`
Error: failed to deserialize config
Error: failed to deserialize config

Caused by:
unknown field `postgres`
Error: failed to deserialize config
Caused by:
unknown field `file_system`
Error: failed to deserialize config
35 Replies
Nathan
Nathan2mo ago
hey! rivet requires either postgres or the file system. the issue is both were specified.
services:
rivet-engine:
image: rivetkit/engine:25.8.0
platform: linux/amd64
ports:
- "6420:6420"
environment:
- RIVET__POSTGRES__URL=postgresql://rivet:rivet@postgresql:5432/rivet
depends_on:
postgresql:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "wget --no-verbose --tries=1 --spider http://127.0.0.1:6420/health || exit 1"]
interval: 5s
timeout: 20s
retries: 10

postgresql:
image: postgres:17-alpine
volumes:
- rivet-postgresql-data:/var/lib/postgresql/data
environment:
- POSTGRES_USER=rivet
- POSTGRES_PASSWORD=rivet
- POSTGRES_DB=rivet
healthcheck:
test: ["CMD-SHELL", "pg_isready -U rivet -d rivet"]
interval: 5s
timeout: 20s
retries: 10
volumes:
rivet-postgresql-data:
services:
rivet-engine:
image: rivetkit/engine:25.8.0
platform: linux/amd64
ports:
- "6420:6420"
environment:
- RIVET__POSTGRES__URL=postgresql://rivet:rivet@postgresql:5432/rivet
depends_on:
postgresql:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "wget --no-verbose --tries=1 --spider http://127.0.0.1:6420/health || exit 1"]
interval: 5s
timeout: 20s
retries: 10

postgresql:
image: postgres:17-alpine
volumes:
- rivet-postgresql-data:/var/lib/postgresql/data
environment:
- POSTGRES_USER=rivet
- POSTGRES_PASSWORD=rivet
- POSTGRES_DB=rivet
healthcheck:
test: ["CMD-SHELL", "pg_isready -U rivet -d rivet"]
interval: 5s
timeout: 20s
retries: 10
volumes:
rivet-postgresql-data:
Yipfram
YipframOP2mo ago
i'm getting
Nathan
Nathan2mo ago
is that the exact same docker compose i sent? try running docker compose down -v then docker compose up again. my version upgraded pg to v17
Yipfram
YipframOP2mo ago
yes i did also With and without platform tag:
# documentation: https://www.rivet.dev/docs
# slogan: Open-source visual AI programming environment for building AI agents with LLMs
# category: ai
# tags: ai, visual programming, llm, chatbot, agent, postgresql
# logo: svgs/rivet.svg
# port: 6420

services:
rivet-engine:
image: rivetkit/engine:25.8.0
platform: linux/amd64
environment:
- SERVICE_URL_RIVET_6420
- RIVET__POSTGRES__URL=postgresql://$SERVICE_USER_POSTGRESQL:$SERVICE_PASSWORD_POSTGRESQL@postgresql:5432/${POSTGRESQL_DATABASE-rivet}
depends_on:
postgresql:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "wget --no-verbose --tries=1 --spider http://127.0.0.1:6420/health || exit 1"]
interval: 5s
timeout: 20s
retries: 10

postgresql:
image: postgres:17-alpine
volumes:
- rivet-postgresql-data:/var/lib/postgresql/data
environment:
- POSTGRES_USER=${SERVICE_USER_POSTGRESQL}
- POSTGRES_PASSWORD=${SERVICE_PASSWORD_POSTGRESQL}
- POSTGRES_DB=${POSTGRESQL_DATABASE-rivet}
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
interval: 5s
timeout: 20s
retries: 10
# documentation: https://www.rivet.dev/docs
# slogan: Open-source visual AI programming environment for building AI agents with LLMs
# category: ai
# tags: ai, visual programming, llm, chatbot, agent, postgresql
# logo: svgs/rivet.svg
# port: 6420

services:
rivet-engine:
image: rivetkit/engine:25.8.0
platform: linux/amd64
environment:
- SERVICE_URL_RIVET_6420
- RIVET__POSTGRES__URL=postgresql://$SERVICE_USER_POSTGRESQL:$SERVICE_PASSWORD_POSTGRESQL@postgresql:5432/${POSTGRESQL_DATABASE-rivet}
depends_on:
postgresql:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "wget --no-verbose --tries=1 --spider http://127.0.0.1:6420/health || exit 1"]
interval: 5s
timeout: 20s
retries: 10

postgresql:
image: postgres:17-alpine
volumes:
- rivet-postgresql-data:/var/lib/postgresql/data
environment:
- POSTGRES_USER=${SERVICE_USER_POSTGRESQL}
- POSTGRES_PASSWORD=${SERVICE_PASSWORD_POSTGRESQL}
- POSTGRES_DB=${POSTGRESQL_DATABASE-rivet}
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
interval: 5s
timeout: 20s
retries: 10
Nathan
Nathan2mo ago
can you try a new folder with exactly the same thing i sent and see if you get it?
Yipfram
YipframOP2mo ago
volumes is not necessary
Nathan
Nathan2mo ago
is this error in docker or on coolify?
Yipfram
YipframOP2mo ago
docker container log
Nathan
Nathan2mo ago
hmm, i'm not sure what could be different if the files are identical and the volumes were wiped
Yipfram
YipframOP2mo ago
Postgres sorry
Nathan
Nathan2mo ago
clarifying – did you have a chance to try the exact same file with volumes wiped?
Yipfram
YipframOP2mo ago
Healthcheck does not pass, but no postgres error
Nathan
Nathan2mo ago
health check takes a second the way i configured it. think i need to turn down the interval oh i see rivet-engine heatlh one sec
Yipfram
YipframOP2mo ago
It's almost 3 in the morning in my time, i'll stay up to test your fix but then i'll go zzzzz
Nathan
Nathan2mo ago
that one passes for me whoops formatting, one sec
Nathan
Nathan2mo ago
services:
rivet-engine:
image: rivetkit/engine:25.8.0
platform: linux/amd64
ports:
- "6420:6420"
environment:
- RIVET__POSTGRES__URL=postgresql://rivet:rivet@postgresql:5432/rivet
depends_on:
postgresql:
condition: service_healthy
healthcheck:
test:
- CMD
- curl
- '-f'
- http://127.0.0.1:6420/health
interval: 2s
timeout: 10s
retries: 10
start_period: 30s

postgresql:
image: postgres:17-alpine
volumes:
- rivet-postgresql-data:/var/lib/postgresql/data
environment:
- POSTGRES_USER=rivet
- POSTGRES_PASSWORD=rivet
- POSTGRES_DB=rivet
healthcheck:
test: ["CMD-SHELL", "pg_isready -U rivet -d rivet"]
interval: 5s
timeout: 20s
retries: 10
volumes:
rivet-postgresql-data:
services:
rivet-engine:
image: rivetkit/engine:25.8.0
platform: linux/amd64
ports:
- "6420:6420"
environment:
- RIVET__POSTGRES__URL=postgresql://rivet:rivet@postgresql:5432/rivet
depends_on:
postgresql:
condition: service_healthy
healthcheck:
test:
- CMD
- curl
- '-f'
- http://127.0.0.1:6420/health
interval: 2s
timeout: 10s
retries: 10
start_period: 30s

postgresql:
image: postgres:17-alpine
volumes:
- rivet-postgresql-data:/var/lib/postgresql/data
environment:
- POSTGRES_USER=rivet
- POSTGRES_PASSWORD=rivet
- POSTGRES_DB=rivet
healthcheck:
test: ["CMD-SHELL", "pg_isready -U rivet -d rivet"]
interval: 5s
timeout: 20s
retries: 10
volumes:
rivet-postgresql-data:
Yipfram
YipframOP2mo ago
Works 🚀🚀 What changed? curl i applied the curl change but my docker compose fails...
# documentation: https://www.rivet.dev/docs
# slogan: Open-source visual AI programming environment for building AI agents with LLMs
# category: ai
# tags: ai, visual programming, llm, chatbot, agent, postgresql
# logo: svgs/rivet.svg
# port: 6420

services:
rivet-engine:
image: rivetkit/engine:25.8.0
platform: linux/amd64
environment:
- SERVICE_URL_RIVET_6420
- RIVET__POSTGRES__URL=postgresql://$SERVICE_USER_POSTGRESQL:$SERVICE_PASSWORD_POSTGRESQL@postgresql:5432/${POSTGRESQL_DATABASE-rivet}
depends_on:
postgresql:
condition: service_healthy
healthcheck:
test:
- CMD
- curl
- '-f'
- http://127.0.0.1:6420/health
interval: 2s
timeout: 10s
retries: 10
start_period: 30s

postgresql:
image: postgres:17-alpine
volumes:
- rivet-postgresql-data:/var/lib/postgresql/data
environment:
- POSTGRES_USER=${SERVICE_USER_POSTGRESQL}
- POSTGRES_PASSWORD=${SERVICE_PASSWORD_POSTGRESQL}
- POSTGRES_DB=${POSTGRESQL_DATABASE-rivet}
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
interval: 5s
timeout: 20s
retries: 10
# documentation: https://www.rivet.dev/docs
# slogan: Open-source visual AI programming environment for building AI agents with LLMs
# category: ai
# tags: ai, visual programming, llm, chatbot, agent, postgresql
# logo: svgs/rivet.svg
# port: 6420

services:
rivet-engine:
image: rivetkit/engine:25.8.0
platform: linux/amd64
environment:
- SERVICE_URL_RIVET_6420
- RIVET__POSTGRES__URL=postgresql://$SERVICE_USER_POSTGRESQL:$SERVICE_PASSWORD_POSTGRESQL@postgresql:5432/${POSTGRESQL_DATABASE-rivet}
depends_on:
postgresql:
condition: service_healthy
healthcheck:
test:
- CMD
- curl
- '-f'
- http://127.0.0.1:6420/health
interval: 2s
timeout: 10s
retries: 10
start_period: 30s

postgresql:
image: postgres:17-alpine
volumes:
- rivet-postgresql-data:/var/lib/postgresql/data
environment:
- POSTGRES_USER=${SERVICE_USER_POSTGRESQL}
- POSTGRES_PASSWORD=${SERVICE_PASSWORD_POSTGRESQL}
- POSTGRES_DB=${POSTGRESQL_DATABASE-rivet}
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
interval: 5s
timeout: 20s
retries: 10
Nathan
Nathan2mo ago
how does it fail?
Yipfram
YipframOP2mo ago
PostgreSQL Database directory appears to contain a database; Skipping initialization

2025-10-22 01:03:45.385 UTC [1] LOG: starting PostgreSQL 17.6 on x86_64-pc-linux-musl, compiled by gcc (Alpine 14.2.0) 14.2.0, 64-bit
2025-10-22 01:03:45.385 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
2025-10-22 01:03:45.385 UTC [1] LOG: listening on IPv6 address "::", port 5432
2025-10-22 01:03:45.392 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2025-10-22 01:03:45.400 UTC [29] LOG: database system was shut down at 2025-10-22 01:03:43 UTC
2025-10-22 01:03:45.408 UTC [1] LOG: database system is ready to accept connections
2025-10-22 01:03:51.081 UTC [45] ERROR: conflicting key value violates exclusion constraint "conflict_ranges_range_data_conflict_type_int8range_start_v_excl"
2025-10-22 01:03:51.081 UTC [45] DETAIL: Key (range_data, conflict_type, int8range(start_version, commit_version, '[]'::text), start_version)=(["\\x1415011502155b15040265706f78795f636f6f7264696e61746f725f7265636f6e66696775726500","\\x1415011502155b15040265706f78795f636f6f7264696e61746f725f7265636f6e6669677572650000"), write, [414,417), 414) conflicts with existing key (range_data, conflict_type, int8range(start_version, commit_version, '[]'::text), start_version)=(["\\x1415011502155b00","\\x1415011502155bff"), read, [413,416), 413).
2025-10-22 01:03:51.081 UTC [45] STATEMENT:
INSERT INTO conflict_ranges (range_data, conflict_type, start_version, commit_version)
SELECT
bytearange(begin_key, end_key, '[)'),
conflict_type::range_type,
$4,
$5
FROM UNNEST($1::bytea[], $2::bytea[], $3::text[]) AS t(begin_key, end_key, conflict_type)
PostgreSQL Database directory appears to contain a database; Skipping initialization

2025-10-22 01:03:45.385 UTC [1] LOG: starting PostgreSQL 17.6 on x86_64-pc-linux-musl, compiled by gcc (Alpine 14.2.0) 14.2.0, 64-bit
2025-10-22 01:03:45.385 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
2025-10-22 01:03:45.385 UTC [1] LOG: listening on IPv6 address "::", port 5432
2025-10-22 01:03:45.392 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2025-10-22 01:03:45.400 UTC [29] LOG: database system was shut down at 2025-10-22 01:03:43 UTC
2025-10-22 01:03:45.408 UTC [1] LOG: database system is ready to accept connections
2025-10-22 01:03:51.081 UTC [45] ERROR: conflicting key value violates exclusion constraint "conflict_ranges_range_data_conflict_type_int8range_start_v_excl"
2025-10-22 01:03:51.081 UTC [45] DETAIL: Key (range_data, conflict_type, int8range(start_version, commit_version, '[]'::text), start_version)=(["\\x1415011502155b15040265706f78795f636f6f7264696e61746f725f7265636f6e66696775726500","\\x1415011502155b15040265706f78795f636f6f7264696e61746f725f7265636f6e6669677572650000"), write, [414,417), 414) conflicts with existing key (range_data, conflict_type, int8range(start_version, commit_version, '[]'::text), start_version)=(["\\x1415011502155b00","\\x1415011502155bff"), read, [413,416), 413).
2025-10-22 01:03:51.081 UTC [45] STATEMENT:
INSERT INTO conflict_ranges (range_data, conflict_type, start_version, commit_version)
SELECT
bytearange(begin_key, end_key, '[)'),
conflict_type::range_type,
$4,
$5
FROM UNNEST($1::bytea[], $2::bytea[], $3::text[]) AS t(begin_key, end_key, conflict_type)
Nathan
Nathan2mo ago
don't forget port mapping on rivet btw
Yipfram
YipframOP2mo ago
done by SERVICE_URL_RIVET_6420 does reverse proxy by coolify
Nathan
Nathan2mo ago
both show as healthy for me?
Nathan
Nathan2mo ago
No description
Nathan
Nathan2mo ago
this is your dockerfile this error is docker or coolify?
Yipfram
YipframOP2mo ago
My bad, i had too much coolify tabs open, checked the wrong one.... It works I'll push PR before going to bed can I add you as contributor?
Nathan
Nathan2mo ago
yes! this is awesome, tysm
Nathan
Nathan2mo ago
cc @ABC
Yipfram
YipframOP2mo ago
What is your github @?
Nathan
Nathan2mo ago
NathanFlurry
Yipfram
YipframOP2mo ago
GitHub
Add Rivet template by yipfram · Pull Request #6963 · coollabsio/c...
Description This PR adds a Docker Compose template for Rivet - an open-source visual AI programming environment for building AI agents with LLMs. What's included rivet-engine: Main Rivet ...
Yipfram
YipframOP2mo ago
BTW, should i call the service template "Rivet Engine"?
Yipfram
YipframOP2mo ago
I'm so stupid, this is the correct PR: https://github.com/coollabsio/coolify-docs/pull/408 Also, there was a question about platform image: https://github.com/coollabsio/coolify/pull/6963#discussion_r2450446559
GitHub
feat(services): add Rivet Engine service template by yipfram · Pul...
Add Rivet Engine as a new service template with comprehensive documentation, official logo, and integration into the services list. Add Rivet Engine documentation with features and use cases Add r...
GitHub
Add Rivet template by yipfram · Pull Request #6963 · coollabsio/c...
Description This PR adds a Docker Compose template for Rivet - an open-source visual AI programming environment for building AI agents with LLMs. What's included rivet-engine: Main Rivet ...
Yipfram
YipframOP2mo ago
Pr was merged today 🙂
Nathan
Nathan2mo ago
we'll post this on socials next week, cheers! i answered the q

Did you find this page helpful?