Having trouble deploying a Surrealdb instance
Heres my docker file
After generating a domain, I can't seem to reach the db. Trying
surreal sql --conn <generated-url>
seems to time out. The console shows the the web server is indeed running.32 Replies
Project ID:
88291032-3a21-4fc7-9023-7e430df5bc64
88291032-3a21-4fc7-9023-7e430df5bc64
does surrealdb communicate over http?
Oh, no it does not. It uses ws
websockets?
Yes
The surreal SDK will attempt to connect via
http://localhost:8000/rpc
which will then get upgraded to a ws connectionchange the CMD command to
then you use
https://<public domain, no port>/rpc
Wheres $PORT being defined?
it's automatically generated by railway
Just for sanity, this is what I have now
And I'm getting
don't use the array syntax
How should I wrte it out?
exactly like I have
So does this mean:
Like this?
CMD "start --bind 0.0.0.0:$PORT"
don't quote anything
Seems the array syntax is needed here
From what I understand docker will always use /bin/sh if not using array
you're kinda right, I forget the proper way to fix this, so go back to the dockerfile you had in the message you opened the thread with and then just specify a PORT service variable as 8000
just specify a PORT service variable as 8000Where/how do I do this? I'm pretty new to railway. Oh as in an env var called PORT?
within your railway service under the variables tab
The $PORT in the docker file just doesn't want to be injected today
error: invalid value '0.0.0.0:$PORT' for '--bind <LISTEN_ADDRESSES>': invalid socket address syntax
^
like
I think I'm just dumb and I haven't been typing rpc
Its now working, but technically, nothing changed?
Its one of those days is it?
Thanks for the help fellas!
youre welcome lol
Okay so I removed the PORT for a sanity check. Adding the PORT variable is the thing that fixed it. But why?
If its needed for railway to know what port you're using, wouldn't it make more sense for that to be in settings?
If its needed for railway to know what port you're usingcorrect, but thats why i first tried to get you to use the auto generated PORT variable first
wouldn't it make more sense for that to be in settings?it is an environment variable after all, a lot of the time its not needed and listening on the auto generated PORT is always preferred
Does the generated port not work with dockerfiles though?
environment variables are not expanded when using the array syntax
Oh, that makes sense
so the actually command ran was the literally string
start --bind 0.0.0.0:$PORT