Docker deploy of anycable timing out

I am trying to deploy anycable-go. My Dockerfile consists solely of

FROM anycable/anycable-go:latest

It boots up fine (see below), but it seems like Render never recognizes that it’s booted. I have tried this both with and without a health check path specified.

Mar 5 07:01:06 PM  I 2021-03-06T03:01:06.491Z context=main Starting AnyCable 1.0.4-c941000 (pid: 1, open file limit: 1048576)
Mar 5 07:01:06 PM  I 2021-03-06T03:01:06.491Z context=main Handle WebSocket connections at http://localhost:8080/cable
Mar 5 07:01:06 PM  I 2021-03-06T03:01:06.491Z context=main Handle health connections at http://localhost:8080/health
Mar 5 07:01:06 PM  I 2021-03-06T03:01:06.493Z context=rpc RPC controller initialized: anycable-rpc:10000 (concurrency: 28, proto_versions: v0,v1)
Mar 5 07:01:06 PM  I 2021-03-06T03:01:06.513Z context=pubsub Subscribed to Redis channel: __anycable__

Here are the deployment docs: AnyCable Docs. Docker build works locally as well. My best guess at why render is unable to detect that it’s booted is that it doesn’t respond to requests to /, only to /health and /cable

I’m also getting something similar on srv-c11fh9rjbvmd4sfm42c0, which is an RPC server:

Mar 5 07:39:38 PM  I, [2021-03-06T03:39:38.529470 #55]  INFO -- : RPC server is starting...
Mar 5 07:39:38 PM  I, [2021-03-06T03:39:38.533412 #55]  INFO -- : RPC server is listening on 127.0.0.1:10000

Since this is a private service (like redis is), it seems especially weird that Render is unable to detect a successful build. Any ideas what’s going on or hacks to fix this?

Any update on this? This is blocking deploying some pretty key upgrades.

I don’t think there’s anything particularly unique about these services.

Hi Kai,

It looks like these services are listening on localhost. Perhaps listening on 0.0.0.0 will fix things.

Ah, that makes sense. I’ll give that a try!

Thanks for the help.

1 Like

Hi kai. Would you mind sharing your solution? How did you set it to 0.0.0.0 and how did you get Rails to connect to it?

I just started looking into AnyCable and while it looks promising, setting it up is proving to be quite daunting.

Hi marc,

I have three services:

  • main rails app
  • anycable-ws
  • anycable-rpc started with bundle exec anycable --rpc-host 0.0.0.0:50051

On anycable-ws I then set the following environment variables, which seemed to do the trick
ANYCABLE_HOST = 0.0.0.0
ANYCABLE_RPC_HOST = anycable-rpc:50051
REDIS_URL = the redis url

Beyond that, I just followed the anycable instructions for configuring the rails app. Performance so far has been excellent, with big memory improvements on the main rails app.

1 Like

Awesome. Thanks so much for sharing this. I’ll give it a try :raised_hands:

Hi Kai,

May I request your help with setting up AnyCable on my end?
I’m clueless as to how you configured your Dockerfile.

Regards,
Chad

Hi Chad,

My dockerfile is simply:

FROM anycable/anycable-go:latest
1 Like

Thanks for getting back to me, Kai. I appreciate the assistance :slight_smile:

I know I’m on the right track now. I have my AnyCable deployed, but I get the following error when trying to connect from the front-end:

grpc connection is not ready

My RPC and web service are part of the same service. I just run 2 commands with Foreman.
And my AnyCable-Go service is deployed from the Docker repo.

I just want to confirm with you. You mentioned you used the environment variable:
ANYCABLE_RPC_HOST = anycable-rpc:50051

Should I replaced anycable-rpc with the HTTPS link to my web server (which also runs the RPC server):
https://example-web.com:50051
Or would it just be without the HTTPS:
example-web.com:50051

Hmm, running both processes on the same render service might cause problems if render only exposes one port per service – you might want to ask them about that. Also, with the RPC server being hosted on a web service rather than a private service, it might not even let you expose port 50051 in the first place (not to mention the security implications of having it exposed to the whole internet). So, my recommendation would definitely be to move your RPC process to a private service.

That said if render does allow exposing that port from a web service in addition to the standard web ports (ie, 80 and 443), you would want to set your ANYCABLE_RPC_HOST to SERVICE_NAME:50051, eg example-web:50051 (notice there’s no .com or https), at least on the main rails app. On the websocket server, since it’s the same location as the rpc server, you could also try localhost:50051 or 127.0.0.1:50051, but I’d try the other first.

Another thing to double-check is to read the logs and make sure the rpc server is actually running as you expect it to.