-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New Fly.io and Action Cable architecture, including AnyCable
- Loading branch information
1 parent
2d0a209
commit 33ad3f0
Showing
17 changed files
with
172 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
|
||
cd $(dirname $0)/.. | ||
|
||
# It's recommended to use the exact version of AnyCable here | ||
version="latest" | ||
|
||
if [ ! -f ./bin/dist/anycable-go ]; then | ||
echo "AnyCable server is not installed, downloading..." | ||
./bin/rails g anycable:download --version=$version --bin-path=./bin/dist | ||
fi | ||
|
||
curVersion=$(./bin/dist/anycable-go -v) | ||
|
||
if [[ "$version" != "latest" ]]; then | ||
if [[ "$curVersion" != "$version"* ]]; then | ||
echo "AnyCable server version is not $version, downloading a new one..." | ||
./bin/rails g anycable:download --version=$version --bin-path=./bin/dist | ||
fi | ||
fi | ||
|
||
./bin/dist/anycable-go $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
bundle exec puma -p 28080 cable/config.ru --pidfile tmp/pids/cable.pid $* | ||
bundle exec puma -p 8080 cable/config.ru --pidfile tmp/pids/cable.pid $* |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# 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/ruby/configuration | ||
# | ||
default: &default | ||
# Turn on/off access logs ("Started..." and "Finished...") | ||
access_logs_disabled: false | ||
# Whether to enable gRPC level logging or not | ||
log_grpc: false | ||
# Use Redis to broadcast messages to AnyCable server | ||
broadcast_adapter: redis | ||
# You can use REDIS_URL env var to configure Redis URL. | ||
# Localhost is used by default. | ||
# redis_url: "redis://localhost:6379/1" | ||
# Use the same channel name for WebSocket server, e.g.: | ||
# $ anycable-go --redis_channel="__anycable__" | ||
# redis_channel: "__anycable__" | ||
|
||
development: | ||
<<: *default | ||
# WebSocket endpoint of your AnyCable server for clients to connect to | ||
# Make sure you have the `action_cable_meta_tag` in your HTML layout | ||
# to propogate this value to the client app | ||
websocket_url: "ws://localhost:8080/cable" | ||
|
||
test: | ||
<<: *default | ||
|
||
production: | ||
<<: *default | ||
websocket_url: ~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,10 @@ | ||
development: | ||
adapter: redis | ||
url: <%= ENV.fetch("REDIS_URL") { "redis://127.0.0.1:6379/1" } %> | ||
adapter: <%= ENV.fetch("ACTION_CABLE_ADAPTER", "any_cable") %> | ||
url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %> | ||
channel_prefix: flyweight_development | ||
|
||
test: | ||
adapter: test | ||
|
||
production: | ||
adapter: redis | ||
url: <%= ENV.fetch("REDIS_URL") { "redis://127.0.0.1:6379/1" } %> | ||
channel_prefix: flyweight_production | ||
adapter: any_cable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.