#Private URL not working (public URL works fine)

20 messages · Page 1 of 1 (latest)

subtle flower
#

I've spun a new database service inside my project to run a libSQL database (https://github.com/tursodatabase/libsql/blob/main/docs/DOCKER.md).

The service itself is running fine and I can connect to it via its public URL from another service (a Bun API) inside the same project.

But using the private URL to connect does not work.

This is what I've done:

  • Enabled private networking for both apps
  • Added 3s of sleep before the start command. I can see the delays in my logs. From my Dockerfile:
ENTRYPOINT [ "/bin/sh", "-c", "sleep 3; ./migrator && ./server" ]
  • "migrator" is an executable that runs migrations on my database, and "server" is the API itself. The errors are coming from my migrator command.
  • Manually set the PORT env variable in the libSQL service so that I can use it in the private URL from the API
  • (just in case) Added ENABLE_ALPINE_PRIVATE_NETWORKING as true in my API service. I'm using an external image in my Dockerfile that I'm not sure is Alpine, so this might not be having an effect.

API logs (with private URL and port):

Connecting to database: http://webmuds-libsql.railway.internal:8080
ConnectionRefused: Unable to connect. Is the computer able to access the url?
path: "http://webmuds-libsql.railway.internal:8080/v2/pipeline";
Connecting to database: http://webmuds-libsql.railway.internal:8080
ConnectionRefused: Unable to connect. Is the computer able to access the url?
path: "http://webmuds-libsql.railway.internal:8080/v2/pipeline";
(... repeat until health check timeout...)

Project ID: 71754a48-09bb-4250-b361-ff5ab1df9597

void valleyBOT
#

Project ID: 71754a48-09bb-4250-b361-ff5ab1df9597

crystal arch
#

hey @subtle flower does this template work for you? https://railway.app/template/p121Tx
i was able to confirm it was working through the private network for me.

+-------------------------+------------------------------+----------+---------+-------+--------------+
|           ENV           |             Host             |  Scheme  | Status  | Error |   Duration   |
+-------------------------+------------------------------+----------+---------+-------+--------------+
| LIBSQL_PRIVATE_URL      | libsql.railway.internal      | libsql   | Success | N/A   | 14.043832ms  |
| LIBSQL_PUBLIC_URL       | libsql.railway.app           | libsql   | Success | N/A   | 43.969466ms  |
+-------------------------+------------------------------+----------+---------+-------+--------------+
|                                                                               Total | 44.105432ms  |
+-------------------------+------------------------------+----------+---------+-------+--------------+
subtle flower
#

how do I deploy it inside my project? it doesn't show up in the template list, and I can't seem to be able to select the project when I click "Deploy Now"

crystal arch
#

haha blame cache, just hard refresh and it will show up

subtle flower
#

indeed 🙂 deploying now and trying to connect to it

#

is there a clever way to get a variable from a service to use it in another service? namely the private URL from the libSQL service

#

(I can just copy/paste in the meanwhile)

crystal arch
subtle flower
#

thanks, that worked!

crystal arch
#

awsome

subtle flower
#

10MB memory usage on the libsql service ✨ will watch how it behaves with large amounts of data later

crystal arch
#

i'd like to know that too!

subtle flower
#

API endpoint that hits the db = 4ms 🥳

#

about the 3s sleep, I should keep it for now, right?
looking forward to removing it when it's no longer needed (heard it's being planned) -- is there somewhere I can track this change?

crystal arch
#

yeah it's still needed, unfortunately I don't have a place for you to track the new runtime, I haven't even heard anything about it lately

subtle flower
#

np, it would only affect app wakeup, and a 3s time on that is not too bad

crystal arch
#

keep it hot instead 🙂

glossy helmBOT
violet socketBOT
#

New reply sent from Help Station thread:

"haha blame cache, just hard refresh and it will show up" - how can I do a "hard refresh"?

You're seeing this because this thread has been automatically linked to the Help Station thread.