R
Railwayโ€ข12mo ago
Dmitry

Shared private IP/domain between all services?

Is there a shared private IP that all the containers in a project use? I have a use case where I need to set an IP/address that can be used to broadcast information to other containers/services. But my other services have all different domains (*.railway.internal), which won't work.
118 Replies
Percy
Percyโ€ข12mo ago
Project ID: 196487ef-2f0e-4749-9286-a107d2c9a8a8
Dmitry
DmitryOPโ€ข12mo ago
196487ef-2f0e-4749-9286-a107d2c9a8a8
Brody
Brodyโ€ข12mo ago
all ips are dynamic, both public and private, why wont the internal domains work for you?
Dmitry
DmitryOPโ€ข12mo ago
Just a requirement of Temporal I think? I'm working on splitting the Temporal container (that included the frontend, history, matching, and worker services) all up into their own containers. There's a TEMPORAL_BROADCAST_ADDRESS that you have to set. This is how the services find one another I guess.. to share membership info? I tried setting it to 127.0.0.1 but obviously that won't work ๐Ÿ˜„
Dmitry
DmitryOPโ€ข12mo ago
Oh lemme try ๐Ÿ™‚
Dmitry
DmitryOPโ€ข12mo ago
Hmm nope ๐Ÿ˜ฆ
No description
Brody
Brodyโ€ข12mo ago
btw things like this go in the service variables (or template variables) https://github.com/dihmeetree/railway-temporal/blob/main/nginx/Dockerfile#L5
Dmitry
DmitryOPโ€ข12mo ago
Yeah I know.. I haven't focused on the variables yet Just trying to get it working first ๐Ÿ˜„
Brody
Brodyโ€ข12mo ago
i mean it could matter
Dmitry
DmitryOPโ€ข12mo ago
oh really?
Brody
Brodyโ€ข12mo ago
well its in the wrong place, it does nothing there
Dmitry
DmitryOPโ€ข12mo ago
I have it set as a variable already tho.. in the template I think it's just there as a duplicate ๐Ÿ˜„
Brody
Brodyโ€ข12mo ago
its not on the nginx service at least
Dmitry
DmitryOPโ€ข12mo ago
I'm not using nginx at the moment.. trying to get it working directly first
Brody
Brodyโ€ข12mo ago
i know, but maybe nginx isnt the only service that youve not added this variable to?
Dmitry
DmitryOPโ€ข12mo ago
I just checked when you said it It's there on the other things ๐Ÿ™‚
Brody
Brodyโ€ข12mo ago
it is indeed
No description
Brody
Brodyโ€ข12mo ago
do all the hosts have the same internal domain?
Dmitry
DmitryOPโ€ข12mo ago
How would I find that out? Also one other thing to note In my Nginx container I get the error
2023/12/07 19:23:02 [emerg] 1#1: host not found in upstream "temporal-frontend-service.railway.internal:7237" in /etc/nginx/nginx.conf:14

nginx: [emerg] host not found in upstream "temporal-frontend-service.railway.internal:7237" in /etc/nginx/nginx.conf:14
2023/12/07 19:23:02 [emerg] 1#1: host not found in upstream "temporal-frontend-service.railway.internal:7237" in /etc/nginx/nginx.conf:14

nginx: [emerg] host not found in upstream "temporal-frontend-service.railway.internal:7237" in /etc/nginx/nginx.conf:14
I think that's the issue I was getting yesterday when I decided to stop using it
Brody
Brodyโ€ข12mo ago
yeah theres a trick to getting nginx to work with internal domains
Dmitry
DmitryOPโ€ข12mo ago
๐Ÿ˜ฎ There's always tricks ๐Ÿ˜‚
Brody
Brodyโ€ข12mo ago
um haha i dont know, youre the one who would know more about this than me
Dmitry
DmitryOPโ€ข12mo ago
Highly debatable ๐Ÿ˜‚
Brody
Brodyโ€ข12mo ago
yeah its called just use caddy (caddy works out of the box but nginx can work too)
Dmitry
DmitryOPโ€ข12mo ago
Oh yeah I tried using Caddy but I couldn't find good documentation about how to do grpc with it
Brody
Brodyโ€ข12mo ago
No description
Dmitry
DmitryOPโ€ข12mo ago
Well.. Caddy isn't even my biggest issue rn tho.. I can't even get stuff to work directly If I can get it working without Caddy then I can look into that after
Brody
Brodyโ€ข12mo ago
so, do you know how to figure this out?
Dmitry
DmitryOPโ€ข12mo ago
I think this is mostly a Temporal blocker though. Because yes.. there is a way to connect to all other nodes (if I had the ability to specific like each node via their internal domain right? *.railway.internal) But this TEMPORAL_BROADCAST_ADDRESS specific field is kinda forcing me to specify either an IP or (maybe domain?) that allows me to share info with all services that share that IP/domain
Brody
Brodyโ€ข12mo ago
does a single service start a bunch of workers? are you using replicas?
Dmitry
DmitryOPโ€ข12mo ago
No each service of Temporal is in it's own service on Railway I haven't done anything with replicas/scaling yet
Brody
Brodyโ€ข12mo ago
theres 4 host:ports here, is a single service running 4 workers?
Dmitry
DmitryOPโ€ข12mo ago
No that's logs from 1 of the services. I believe those are the 4 "IP's" the service is trying to reach out to. Each has it's own port So for example (frontend:port, history:port, matching:port, and worker:port) I think Fly.io has something where you can just alias your entire app.. and it let's you communicate to all your machines? I think? That's why I was asking if Railway had something like that
Brody
Brodyโ€ข12mo ago
can the temporal server only run one service type at a time? i mean the env is plural SERVICES
Dmitry
DmitryOPโ€ข12mo ago
I believe you could run multiple yes
Brody
Brodyโ€ข12mo ago
then do that, that way you will be able to use a single internal domain
Dmitry
DmitryOPโ€ข12mo ago
That's what I had before ๐Ÿ˜„ It worked fine yes, but i'm trying to "productionify" by splitting the services into their own containers
Dmitry
DmitryOPโ€ข12mo ago
So each individual service can be scaled differently if needed Oh ๐Ÿ˜ฎ Would I broadcast on 127.0.0.1 then? If Bind is :: ?
Brody
Brodyโ€ข12mo ago
i get where your coming from, but if temporal doesnโ€™t allow you to specify separate hosts for individual services, i dont think you have many options besides proxy, and thats a meh solution
Dmitry
DmitryOPโ€ข12mo ago
Yeah no thanks to proxy ๐Ÿ˜„
Brody
Brodyโ€ข12mo ago
uh kinda, maybe check out a article on the differences of 127.0.0.1, 0.0.0.0, ::1, ::, etc
Dmitry
DmitryOPโ€ข12mo ago
Well yeah if it doesn't work on Railway it doesn't work.. no big deal Was just trying to get it working
Brody
Brodyโ€ข12mo ago
i really wouldnโ€™t call this a limitation of railway, id say this was a suboptimal design by not allowing you to specify individual addresses for each service type
Dmitry
DmitryOPโ€ข12mo ago
Here's what the Temporal guy said
No description
Brody
Brodyโ€ข12mo ago
thats a compose file isnt it?
Dmitry
DmitryOPโ€ข12mo ago
Yeah
Brody
Brodyโ€ข12mo ago
well thats not too helpfull lol cc @Melissa im 99% sure this is the template they asked to move over?
Melissa
Melissaโ€ข12mo ago
haven't read through everything in here yet, but we do have this other temporal template (https://github.com/railwayapp-templates/temporal), perhaps it could be helpful to reference?
Brody
Brodyโ€ข12mo ago
they originally did fork that template, all due respect that template left a lot to be desired the variables are also setup sub optimally from what i remember
Brody
Brodyโ€ข12mo ago
yeah, lack of reference variables, heres just two examples
No description
Melissa
Melissaโ€ข12mo ago
ahh got it got it
Brody
Brodyโ€ข12mo ago
dmitry has fixed that stuff in their template now though
Dmitry
DmitryOPโ€ข12mo ago
Yeah the original Temporal template was missing ElasticSearch as well, which plays a key role in serving search queries and such on the Temporal UI. I was able to add that and had everything working. The issue at the moment comes down to splitting the Temporal services (from the 1 Temporal service with the frontend, history, matching, and worker) into their own Railway services. Breaking the Temporal services into their own Railway services would let you scale individual Temporal services when it came time to using it in production. For example you may need to scale the Temporal "history" service more than the "frontend" service for example, or etc etc. Which is what I've been trying to figure out.. but hit a snag ๐Ÿ˜„ My template is kinda "under construction" you can say... it doesn't utilize proper Railway variables and such yet in terms of the template. Still trying to get it working functionally.. then I can go back and make everything look pretty ๐Ÿ˜…
ThallesComH
ThallesComHโ€ข12mo ago
really interested in a scalable Temporal template, if there's any demo I can try would be nice :)
Dmitry
DmitryOPโ€ข12mo ago
Yeah i'm working on it ๐Ÿ˜… Will let you know ๐Ÿ‘๐Ÿป
Melissa
Melissaโ€ข12mo ago
really cool, let's get this working then! I am in between a couple of things right now, but I can try to hack on it with y'all in a bit
Dmitry
DmitryOPโ€ข12mo ago
That would be sweet! Appreciate it ๐Ÿ™๐Ÿป
Brody
Brodyโ€ข12mo ago
what service in this template is trying to connect to all these frontend, matching, worker, etc services?
Dmitry
DmitryOPโ€ข12mo ago
Also appreciate your help as well Brody! ๐Ÿ™‚ So each service .. Don't quote me on this.. I believe broadcasts information to the other services. I believe it's over a single specific IP; the TEMPORAL_BROADCAST_ADDRESS variable I was referring to before. And each of the services have a specific different port that they use to communicate to each other with? I'm new to Temporal interworkings to be honest.. it's not like i've been using this forever. I'm trying to learn how it works too ๐Ÿ˜„
Dmitry
DmitryOPโ€ข12mo ago
Here's a Docker compose to get Temporal working locally https://github.com/temporalio/docker-compose/blob/main/docker-compose-multirole.yaml
GitHub
docker-compose/docker-compose-multirole.yaml at main ยท temporalio/d...
Temporal docker-compose files. Contribute to temporalio/docker-compose development by creating an account on GitHub.
Dmitry
DmitryOPโ€ข12mo ago
This docker compose template works great locally ๐Ÿ™‚ It's what i've been using to split stuff up They have 2 frontend services tho.. not sure why. But I believe only 1 is needed. https://docs.temporal.io/assets/images/temporal-cluster-30b133bd4034cd3226bf908ed3810e45.svg (From their Docs) The Temporal Server consists of four independently scalable services: Frontend gateway: for rate limiting, routing, authorizing. History subsystem: maintains data (mutable state, queues, and timers). Matching subsystem: hosts Task Queues for dispatching. Worker Service: for internal background Workflows. For live (production) environments, we recommend that each service runs independently, because each one has different scaling requirements and troubleshooting becomes easier. The History, Matching, and Worker Services can scale horizontally within a Cluster. The Frontend Service scales differently than the others because it has no sharding or partitioning; it is just stateless. Each service is aware of the others, including scaled instances, through a membership protocol via Ringpop.
Dmitry
DmitryOPโ€ข12mo ago
So I removed BIND_ON_IP and TEMPORAL_BROADCAST_ADDRESS and discovery does seem to be working? I'm assuming these IP's are of the containers? But i'm still getting an error from the History service.. which is trying to connect to the Frontend service over port 7233
Error: unable to health check "temporal.api.workflowservice.v1.WorkflowService" service: connection error: desc = "transport: Error while dialing: dial tcp [fd12:ba8b:e7f8::c3:b5c4:fcba]:7233: connect: connection refused"
Error: unable to health check "temporal.api.workflowservice.v1.WorkflowService" service: connection error: desc = "transport: Error while dialing: dial tcp [fd12:ba8b:e7f8::c3:b5c4:fcba]:7233: connect: connection refused"
No description
Dmitry
DmitryOPโ€ข12mo ago
6933 is the Frontend Service, 6934 is the History Service, 6935 is the Matching Service, 6939 is the Worker Service
Brody
Brodyโ€ข12mo ago
those are ipv4 addresses from the eth0 interface, don't think thats going to work
Dmitry
DmitryOPโ€ข12mo ago
oh sadblob
Brody
Brodyโ€ข12mo ago
the private network is ipv6 only on railnet0
Dmitry
DmitryOPโ€ข12mo ago
How do I broadcast like the unique ipv6 address from each container then? ๐Ÿค” I have to like somehow broadcast that
Brody
Brodyโ€ข12mo ago
as for the connection refused while connecting to the frontend, make sure you are connecting to the correct port and that your frontend is binding on [::]
Dmitry
DmitryOPโ€ข12mo ago
I tried setting ENV BIND_ON_IP="[::]" but I was getting an error
Brody
Brodyโ€ข12mo ago
that's just binding, you need to specify the correct address and port to connect to elsewhere
Dmitry
DmitryOPโ€ข12mo ago
The history service is most likely connecting to this ENV TEMPORAL_ADDRESS="temporal-frontend-service.railway.internal:7233" Is that not correct? ๐Ÿค”
Brody
Brodyโ€ข12mo ago
you tell me, what is the internal address of the frontend? and what port is it listening on
Dmitry
DmitryOPโ€ข12mo ago
So there's 4 services. Each one I tried setting ENV BIND_ON_IP="[::]" Each start on their own port. But the frontend port is 7233
Brody
Brodyโ€ข12mo ago
have you been able to confirm the frontend is indeed listening on 7233
Dmitry
DmitryOPโ€ข12mo ago
Yes in the logs it prints Use rpc address 127.0.0.1:7233 for cluster active. err.. that's with the bind on [::] removed ๐Ÿ˜„
Brody
Brodyโ€ข12mo ago
well you definitely don't want it to start on 127.0.0.1
Dmitry
DmitryOPโ€ข12mo ago
You wouldn't be up for a Discord voice call would you by chance? ๐Ÿ˜…
Brody
Brodyโ€ข12mo ago
I wouldn't, sorry
Dmitry
DmitryOPโ€ข12mo ago
Ok no worries ๐Ÿ˜„ So yeah ENV BIND_ON_IP="[::]" doesn't work. Temporal throws an error:
2023/12/07 22:56:21 Loading config files=[config/docker.yaml]

Unable to load configuration: config file corrupted: yaml: line 127: did not find expected node content.
2023/12/07 22:56:21 Loading config files=[config/docker.yaml]

Unable to load configuration: config file corrupted: yaml: line 127: did not find expected node content.
Brody
Brodyโ€ข12mo ago
try without the square brackets I do wanna mention this now for when you get this working, all these ENVs in the dockerfile should be transferred to service variables though you probably already know that
Dmitry
DmitryOPโ€ข12mo ago
Yep! Like I said.. just trying to get it working first ๐Ÿ™‚ It doesn't like ENV BIND_ON_IP="::" either:
2023/12/07 23:00:45 Loading config files=[config/docker.yaml]

Unable to load configuration: config file corrupted: yaml: line 128: mapping values are not allowed in this context.
2023/12/07 23:00:45 Loading config files=[config/docker.yaml]

Unable to load configuration: config file corrupted: yaml: line 128: mapping values are not allowed in this context.
Brody
Brodyโ€ข12mo ago
but you're doing stuff with environment variables right now, why is it mentioning a yaml file?
Dmitry
DmitryOPโ€ข12mo ago
I don't know ๐Ÿ˜ญ
Dmitry
DmitryOPโ€ข12mo ago
GitHub
Improve ipv6 support (#4766) ยท temporalio/temporal@e62c22f
Temporal works with ipv6, but there are some clarifications in documentation and additional settings that could make support cleaner. Specifically: * specify pprof host to override localhost def...
Dmitry
DmitryOPโ€ข12mo ago
This will be included in the next release ๐Ÿ˜„
Dmitry
DmitryOPโ€ข12mo ago
GitHub
[temporalio/auto-setup] bindOnIP does not work with ipv6 ยท Issue #3...
Reopening #3612 Expected Behavior I can bind to ipv6 address. Actual Behavior '[2a05:d014:6e0:c883:1d45::11]:7233' you can see in the log. This address is using correctly for listening but ...
Brody
Brodyโ€ข12mo ago
oof
Brody
Brodyโ€ข12mo ago
No description
Dmitry
DmitryOPโ€ข12mo ago
wut
Brody
Brodyโ€ข12mo ago
youre on 1.22.2
Dmitry
DmitryOPโ€ข12mo ago
kekw
Brody
Brodyโ€ข12mo ago
though that issue is from spet/oct, next release could have already happened a few releases ago depending on how often they do releases
Dmitry
DmitryOPโ€ข12mo ago
hmm lemme try with the latest release it's not on dockerhub yet ๐Ÿ’€ Hmm actually idk if they even merged that PR into a release? ๐Ÿค” I don't see it in a release #4766
Brody
Brodyโ€ข12mo ago
i dont either
Dmitry
DmitryOPโ€ข12mo ago
Apparently the changes will be in 1.23.0
No description
Brody
Brodyโ€ข12mo ago
thats good haha
Dmitry
DmitryOPโ€ข12mo ago
Brody, when I run this command in my Docker buildstep.. it returns blank..
CONTAINER_IPV6_ADDR="$(ip -6 addr show scope global | grep 'inet6' | head -n 1 | awk '{print $2}' | cut -d/ -f1)" && echo $CONTAINER_IPV6_ADDR
CONTAINER_IPV6_ADDR="$(ip -6 addr show scope global | grep 'inet6' | head -n 1 | awk '{print $2}' | cut -d/ -f1)" && echo $CONTAINER_IPV6_ADDR
Is there a way I can get the specific Railway instance's private IP?
Brody
Brodyโ€ข12mo ago
the private network is not available at build
Dmitry
DmitryOPโ€ข12mo ago
oh ๐Ÿ’€ oh ye that makes sense duh crap nvm kekw come it's not exposed as a official environment variable ๐Ÿค”
Brody
Brodyโ€ข12mo ago
what? the ipv6 address?
Dmitry
DmitryOPโ€ข12mo ago
yeah
Brody
Brodyโ€ข12mo ago
because you should use the domain lol
Dmitry
DmitryOPโ€ข12mo ago
I don't think BIND_ON_IP will accept the domain ๐Ÿค” but I can try "::" wasn't working (not sure why) so I was gonna try to see if I could get the direct private ipv6 IP of the instance instead Having SSH access to the instances would make my life so much easier
Brody
Brodyโ€ข12mo ago
:: is the correct way, the app not accepting that is not fault of railways at the surface a lot of people think having ssh access to the container will instantly solve a lot of problems, and it could, and there are valid usecases for it, but I'm my experience it would bring far more issues (thus help threads) from misuse or improper use, so I strongly believe that the containers should stay without ssh access.
Dmitry
DmitryOPโ€ข12mo ago
Yeah you're totally right ๐Ÿ˜„ I've got 3 IP's here.. which one would I bind to, if I want them to all talk to eachother?
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN qlen 1000

inet6 ::1/128 scope host

valid_lft forever preferred_lft forever

2: railnet0@if226746: <BROADCAST,MULTICAST,UP,LOWER_UP,M-DOWN> mtu 1360 state UP qlen 1000

inet6 fd12:2d68:9bda::9b:b767:afe8/64 scope global tentative

valid_lft forever preferred_lft forever

inet6 fe80::c49a:7bff:febc:827d/64 scope link tentative

valid_lft forever preferred_lft forever

226744: eth0@if226745: <BROADCAST,MULTICAST,UP,LOWER_UP,M-DOWN> mtu 1500 state UP

inet6 fe80::42:acff:fe11:22/64 scope link tentative

valid_lft forever preferred_lft forever
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN qlen 1000

inet6 ::1/128 scope host

valid_lft forever preferred_lft forever

2: railnet0@if226746: <BROADCAST,MULTICAST,UP,LOWER_UP,M-DOWN> mtu 1360 state UP qlen 1000

inet6 fd12:2d68:9bda::9b:b767:afe8/64 scope global tentative

valid_lft forever preferred_lft forever

inet6 fe80::c49a:7bff:febc:827d/64 scope link tentative

valid_lft forever preferred_lft forever

226744: eth0@if226745: <BROADCAST,MULTICAST,UP,LOWER_UP,M-DOWN> mtu 1500 state UP

inet6 fe80::42:acff:fe11:22/64 scope link tentative

valid_lft forever preferred_lft forever
The railnet ipv6 address it the one that all instances can talk on or? ๐Ÿค”
Brody
Brodyโ€ข12mo ago
railnet0 is the interface for the wireguard tunnel, but again you want to bind these apps to :: and not their own ip addresses, i strongly believe you are chasing the wrong goose here. if they dont support binding to :: or [::] then it just wont work, even if you worked out a way to give them their own ip addresses to bind to.
Dmitry
DmitryOPโ€ข12mo ago
Yeah so I found out how they build their docker images https://github.com/temporalio/docker-builds
GitHub
GitHub - temporalio/docker-builds: Temporal service Docker images b...
Temporal service Docker images build. Contribute to temporalio/docker-builds development by creating an account on GitHub.
Dmitry
DmitryOPโ€ข12mo ago
i'm able to build the 2 images I need and fix any issues in the code potentially
Brody
Brodyโ€ข12mo ago
just wait for them to release the version with ipv6 support lol
Dmitry
DmitryOPโ€ข12mo ago
Well I have the code from the main branch (with the ipv6 "fix") It's still not working with "::"
Brody
Brodyโ€ข12mo ago
do you get a different error?
Dmitry
DmitryOPโ€ข12mo ago
No same error
Unable to load configuration: config file corrupted: yaml: line 128: mapping values are not allowed in this context.
Unable to load configuration: config file corrupted: yaml: line 128: mapping values are not allowed in this context.
It doesn't like :: or even [::] for that matter
Brody
Brodyโ€ข12mo ago
then its also possible 0.0.0.0 will bind to ipv6 too
ThallesComH
ThallesComHโ€ข12mo ago
long shot, but maybe yaml is treating :: as a property declaration? is it surrounded by quotes?
Melissa
Melissaโ€ข10mo ago
i have had this on my list to come back to forever!! were y'all able to get this working, or blocked by ipv6?
Want results from more Discord servers?
Add your server