Skip to content

Commit

Permalink
Reconfigure AnyCable to use HTTP adapter and locally installed anycab…
Browse files Browse the repository at this point in the history
…le-go
  • Loading branch information
palkan committed Jun 25, 2020
1 parent 5977a73 commit d0b2bf5
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/system_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ jobs:
- name: Run RSpec
run: |
bundle exec rails db:prepare
bundle exec rails g anycable:download --bin-path=./bin
sudo bundle exec rails g anycable:download --bin-path=./bin
bundle exec rails webpacker:compile
./bin/anycable-go --host "0.0.0.0" &
export CABLE_URL="ws://$(hostname):8080/cable"
sudo cp ./bin/anycable-go /usr/local/bin/
bundle exec rspec --tag type:system
4 changes: 4 additions & 0 deletions Procfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
server: bundle exec rails s
assets: bundle exec bin/webpack-dev-server
anycable: bundle exec anycable
ws: anycable-go --port=8080 --broadcast_adapter=http
9 changes: 7 additions & 2 deletions config/anycable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,19 @@ default: &default
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 HTTP adapter for a quick start (since redis gem is not present in the project)
broadcast_adapter: http
# Use the same channel name for WebSocket server, e.g.:
# $ anycable-go --redis-channel="__anycable__"
redis_channel: "__anycable__"

development:
<<: *default

test:
<<: *default

production:
<<: *default
# Use Redis in production
broadcast_adapter: redis
2 changes: 1 addition & 1 deletion config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

# Specify AnyCable WebSocket server URL to use by JS client
config.after_initialize do
config.action_cable.url = ActionCable.server.config.url = ENV.fetch("CABLE_URL", "ws://localhost:8080/cable")
config.action_cable.url = ActionCable.server.config.url = ENV.fetch("CABLE_URL", "ws://127.0.0.1:8080/cable")
end

config.action_cable.mount_path = nil
Expand Down
2 changes: 1 addition & 1 deletion spec/system/support/anycable_setup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
require "anycable/cli"

cli = AnyCable::CLI.new(embedded: true)
cli.run
cli.run(["--server-command", "anycable-go --broadcast_adapter=http"])

config.after(:suite) do
cli&.shutdown
Expand Down

0 comments on commit d0b2bf5

Please sign in to comment.