Closed sbrl closed 5 months ago
hey @sbrl . Thanks for opening an issue and your feedback. I will make sure to update the docker documentation to make it a bit more clear. Please refer to the getting started docs to see what is required for setting up the DB: https://github.com/Shelf-nu/shelf.nu/blob/main/docs/get-started.md#development
Based on the error, it seems like the string provided is invalid string. Is that an error you get when you run the docker like this:
docker run -d \
--name "shelf" \
-e "DATABASE_URL=postgres://{USER}:{PASSWORD}@{HOST}:6543/{DB_NAME}?pgbouncer=true" \
-e "DIRECT_URL=postgres://{USER}:{PASSWORD}@{HOST}:5432/{DB_NAME}" \
-e 'SUPABASE_ANON_PUBLIC=ANON_PUBLIC' \
-e 'SUPABASE_SERVICE_ROLE=SERVICE_ROLE' \
-e 'SUPABASE_URL=https://{YOUR_INSTANCE_NAME}.supabase.co' \
-e 'SESSION_SECRET=super-duper-s3cret' \
-e 'SERVER_URL=http://localhost:3000' \
-e 'MAPTILER_TOKEN=maptiler-token' \
-e 'SMTP_HOST=mail.example.com' \
-e 'SMTP_USER=some-email@example.com' \
-e 'SMTP_FROM="Carlos from shelf.nu" <carlos@shelf.nu>' \
-e 'SMTP_PWD=super-safe-passw0rd' \
-p 3000:8080 \
--restart unless-stopped \
ghcr.io/shelf-nu/shelf.nu:latest
@anatolinicolae do you have any idea what the issue is with this?
🤔 My deployment has the same formatting as OP's, so it should be working just fine.
Best tip off the top of my head is probably adding a command and just using printenv
to see if those were correctly passed, so:
name: shelf
services:
shelf:
image: ghcr.io/shelf-nu/shelf.nu:latest
container_name: shelf
environment:
- DATABASE_URL="postgres://postgres.[USER]:[PASSWORD]@aws-0-eu-west-2.pooler.supabase.com:6543/postgres?pgbouncer=true"
- DIRECT_URL="postgres://postgres.[USER]:[PASSWORD]@aws-0-eu-west-2.pooler.supabase.com:6543/postgres"
- SUPABASE_ANON_PUBLIC=[REDACTED]
- SUPABASE_SERVICE_ROLE=[REDACTED]
- SUPABASE_URL=https://[USER].supabase.co
- SESSION_SECRET=[REDACTED]
- SERVER_URL=supabase:6747
ports:
- 6746:8080
networks:
- shelf
restart: unless-stopped
command: printenv
networks:
shelf:
name: shelf
If that doesn't work, try the same overriding the entrypoint instead.
I just had the same problem as OP. I fixed this issue by removing the quotation marks in the docker compose environment description. The variables in yaml spec are either supposed to be strings in dotenv format, i.e.
environment:
# wrong
- key="incorrect"
# right
- key=correct
or an object with yaml values (those are optionally quoted)
environment:
# right
key1: "correct1"
# also right
key2: correct2
I assume this causes your actual variable to be prefixed with a quotation char. This means the URI protocol is now literally "postgres:
which does not work.
Great tip, Michael!
If you'd like to still use quotes, I believe the best way to do is to fully wrap the var like:
environment:
- "DATABASE_URL=postgres://postgres.[USER]:[PASSWORD]@aws-0-eu-west-2.pooler.supabase.com:6543/postgres?pgbouncer=true"
Thanks for all the help, everyone! I hate yaml so much........
It's now hanging on npm run db_deploy
, but that's likely due to an internal firewall issue.
Thanks for the help!
Contact Details
I'm opening an issue, you do not need my email address. We can go back and forth as needed in this issue.
What happened?
Steps to reproduce:
What is the expected behaviour?
It should start without crashing.
Context, since your form doesn't seem to ask for it
The issue appears to be with
DATABASE_URL
ref the docker containerghcr.io/shelf-nu/shelf.nu:latest
.I tried this:
...I also tried
postgresql
as the schema name ref linked prism documentation.I tried a local PostgreSQL database container.
Also I tried a connection string from Supabase.
The Docker documentation is unclear on what is required ref the connection string.
I'm writing a Docker compose file for Shelf.nu. I print it below:
Version
Self-hosted
What browsers are you seeing the problem on?
n/a
Relevant log output