Skip to content

Commit

Permalink
Add bin/anycable-go
Browse files Browse the repository at this point in the history
  • Loading branch information
palkan committed Apr 3, 2024
1 parent 5aeeb2d commit 711e54c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ yarn-debug.log*

/app/assets/builds/*
!/app/assets/builds/.keep

bin/dist
2 changes: 1 addition & 1 deletion Procfile.dev
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
server: bundle exec rails s -p 3000
css: yarn build:css --watch
js: yarn build --watch
ws: anycable-go --port=8080 --broadcast_adapter=http
ws: bin/anycable-go --port=8080 --broadcast_adapter=http --presets=broker --rpc_host=http://localhost:3000/_anycable
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ bin/setup

## Running

You can start Rails server by running:
Since you need to run multiple processes (Rails, AnyCable-Go), we recommend using a process manager, e.g., [Hivemind](https://github.com/DarthSim/hivemind):

```sh
bundle exec rails s
hivemind Procfile.dev
```

Then go to [http://localhost:3000/](http://localhost:3000/) and see the application in action.
Expand Down
19 changes: 19 additions & 0 deletions bin/anycable-go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

cd $(dirname $0)/..

version="1.5.0"

if [ ! -f ./bin/dist/anycable-go ]; then
echo "AnyCable-go is not installed, downloading..."
./bin/rails g anycable:download --version=$version --bin-path=./bin/dist
fi

curVersion=$(./bin/dist/anycable-go -v)

if [[ "$curVersion" != "$version"* ]]; then
echo "AnyCable-go version is not $version, downloading a new one..."
./bin/rails g anycable:download --version=$version --bin-path=./bin/dist
fi

./bin/dist/anycable-go $@

0 comments on commit 711e54c

Please sign in to comment.