Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues deploying to Heroku #133

Closed
vicramon opened this issue Jun 27, 2020 · 3 comments
Closed

Issues deploying to Heroku #133

vicramon opened this issue Jun 27, 2020 · 3 comments

Comments

@vicramon
Copy link

Tell us about your environment

Ruby version: 2.6.6

Rails version: 6.0.3.2

anycable gem version: 1.0.0.rc2

anycable-rails gem version: pulling from master branch, gem 'anycable-rails', github: "anycable/anycable-rails"

grpc gem version: 1.28.0

What did you do?

Setup our Rails app for anycable by following all the instructions here: https://docs.anycable.io/v1/#/deployment/heroku.

Procfile:

web: bundle exec anycable --server-command="anycable-go" || bundle exec puma -C config/puma.rb

config/cable.yml

# Make it possible to switch adapters by passing the ACTION_CABLE_ADAPTER env variable.
# For example, you can use it fallback to the standard Action Cable in staging/review
# environments (by setting `ACTION_CABLE_ADAPTER=redis`).
development:
  adapter: <%= ENV.fetch("ACTION_CABLE_ADAPTER", "any_cable") %>

test:
  adapter: test

staging:
  adapter: <%= ENV.fetch("ACTION_CABLE_ADAPTER", "any_cable") %>

production:
  adapter: <%= ENV.fetch("ACTION_CABLE_ADAPTER", "any_cable") %>

config/anycable.yml

# This file contains per-environment settings for AnyCable.
#
# Since AnyCable config is based on anyway_config (https://github.com/palkan/anyway_config), all AnyCable settings
# can be set or overridden through the corresponding environment variables.
# E.g., `rpc_host` is overridden by ANYCABLE_RPC_HOST, `debug` by ANYCABLE_DEBUG etc.
#
# Note that AnyCable recognizes REDIS_URL env variable for Redis pub/sub adapter. If you want to
# use another Redis instance for AnyCable, provide ANYCABLE_REDIS_URL variable.
#
# Read more about AnyCable configuration here: https://docs.anycable.io/v1/#/ruby/configuration
#
default: &default
  # Turn on/off access logs ("Started..." and "Finished...")
  access_logs_disabled: false
  # Persist "dirty" session between RPC calls (might be required for apps using stimulus_reflex <3.0)
  # persistent_session_enabled: true
  # This is the host and the port to run AnyCable RPC server on.
  # You must configure your WebSocket server to connect to it, e.g.:
  #   $ anycable-go --rpc-host="<rpc hostname>:50051"
  rpc_host: "127.0.0.1:50051"
  # Whether to enable gRPC level logging or not
  log_grpc: false
  # Use Redis to broadcast messages to AnyCable server
  broadcast_adapter: redis
  # Use the same channel name for WebSocket server, e.g.:
  #   $ anycable-go --redis-channel="__anycable__"
  redis_channel: "__anycable__"

development:
  <<: *default
  redis_url: "redis://localhost:6379/1"

staging:
  <<: *default

production:
  <<: *default

What did you expect to happen?

That anycable-go and the rpc server would start :)

What actually happened?

It starts up:

2020-06-27T19:40:48.132054+00:00 app[web.1]: I, [2020-06-27T19:40:48.131944 #3]  INFO -- : Starting AnyCable gRPC server (pid: 3, workers_num: 30)
2020-06-27T19:40:48.132728+00:00 app[web.1]: I, [2020-06-27T19:40:48.132059 #3]  INFO -- : AnyCable version: 1.0.0.rc2 (proto_version: v1)
2020-06-27T19:40:48.132730+00:00 app[web.1]: I, [2020-06-27T19:40:48.132159 #3]  INFO -- : gRPC version: 1.28.0
2020-06-27T19:40:48.132730+00:00 app[web.1]: I, [2020-06-27T19:40:48.132221 #3]  INFO -- : Serving Rails application from ./config/environment.rb
2020-06-27T19:40:48.134425+00:00 app[web.1]: I, [2020-06-27T19:40:48.134359 #3]  INFO -- : Broadcasting Redis channel: __anycable__
2020-06-27T19:40:48.134500+00:00 app[web.1]: I, [2020-06-27T19:40:48.134440 #3]  INFO -- : RPC server is starting...
2020-06-27T19:40:48.162779+00:00 app[web.1]: I, [2020-06-27T19:40:48.162676 #3]  INFO -- : RPC server is listening on 127.0.0.1:50051
2020-06-27T19:40:48.164507+00:00 app[web.1]: I, [2020-06-27T19:40:48.164431 #3]  INFO -- : Started command: anycable-go --port=50721 (pid: 53)
2020-06-27T19:40:48.168250+00:00 app[web.1]: I 2020-06-27T19:40:48.168Z context=main Starting AnyCable 1.0.0-33085f2 (pid: 53, open file limit: 1048576)
2020-06-27T19:40:48.168376+00:00 app[web.1]: I 2020-06-27T19:40:48.168Z context=main Handle WebSocket connections at http://localhost:50721/cable
2020-06-27T19:40:48.168403+00:00 app[web.1]: I 2020-06-27T19:40:48.168Z context=main Handle health connections at http://localhost:50721/health
2020-06-27T19:40:48.168963+00:00 app[web.1]: I 2020-06-27T19:40:48.168Z context=rpc RPC controller initialized: localhost:50051 (concurrency: 28, proto_versions: v0,v1)
2020-06-27T19:40:48.267500+00:00 app[web.1]: I 2020-06-27T19:40:48.267Z context=pubsub Subscribed to Redis channel: __anycable__

But then crashes:

2020-06-27T19:48:42.473945+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2020-06-27T19:48:42.488271+00:00 heroku[web.1]: Stopping process with SIGKILL
2020-06-27T19:48:42.556198+00:00 heroku[web.1]: Process exited with status 137
2020-06-27T19:48:42.596784+00:00 heroku[web.1]: State changed from starting to crashed
2020-06-27T19:48:43.321679+00:00 heroku[logplex]: Error L10 (output buffer overflow): drain 'd.f4e811b4-12d7-473d-b0f7-a281e765058e' dropped 1 messages since 2020-06-27T19:48:13.373664+00:00.

Other context:

I was able to run heroku run bash and then manually run: bundle exec anycable --server-command="anycable-go".

When I do that, it starts up just fine and doesn't show any error messages:

I, [2020-06-27T19:54:53.228486 #7]  INFO -- : Starting AnyCable gRPC server (pid: 7, workers_num: 30)
I, [2020-06-27T19:54:53.228899 #7]  INFO -- : AnyCable version: 1.0.0.rc2 (proto_version: v1)
I, [2020-06-27T19:54:53.229157 #7]  INFO -- : gRPC version: 1.28.0
I, [2020-06-27T19:54:53.229395 #7]  INFO -- : Serving Rails application from ./config/environment.rb
I, [2020-06-27T19:54:53.232597 #7]  INFO -- : Broadcasting Redis channel: __anycable__
I, [2020-06-27T19:54:53.234653 #7]  INFO -- : RPC server is starting...
I, [2020-06-27T19:54:53.411407 #7]  INFO -- : RPC server is listening on 127.0.0.1:50051
I, [2020-06-27T19:54:53.427060 #7]  INFO -- : Started command: anycable-go (pid: 56)
  INFO 2020-06-27T19:54:53.455Z context=main Starting AnyCable 1.0.0-33085f2 (pid: 56, open file limit: 10000)
  INFO 2020-06-27T19:54:53.455Z context=main Handle WebSocket connections at http://localhost:20530/cable
  INFO 2020-06-27T19:54:53.478Z context=main Handle health connections at http://localhost:20530/health
  INFO 2020-06-27T19:54:53.464Z context=rpc RPC controller initialized: localhost:50051 (concurrency: 28, proto_versions: v0,v1)
  INFO 2020-06-27T19:54:53.549Z context=pubsub Subscribed to Redis channel: __anycable__

@palkan Do you have any ideas on what might be going on? Any pointers would be greatly appreciated.

@palkan
Copy link
Member

palkan commented Jun 29, 2020

I think, that could be related to the default anycable-go host change: https://docs.anycable.io/v1/#/upgrade-notes/0_6_0_to_1_0_0?id=default-host-changed

Could you please try to change server command to --server-command="anycable-go --host=0.0.0.0" and check whether this fixes the problem?

@palkan palkan added the awaiting response Awaiting response from the reporter label Jun 29, 2020
@palkan
Copy link
Member

palkan commented Jun 29, 2020

Reproduced this on Heroku. Adding ANYCABLE_HOST=0.0.0.0 to the RPC app settings should resolve the issue. Updated the documentation.

P.S. Here is a new demo app for v1.0 configured to run on Heroku: anycable/anycable_rails_demo#4

@vicramon
Copy link
Author

vicramon commented Jul 2, 2020

This did the trick, thanks for the help!

@vicramon vicramon closed this as completed Jul 2, 2020
@palkan palkan removed the awaiting response Awaiting response from the reporter label Jul 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants