ruby-on-railsrubywebsocketcapistranofaye

How to start FAYE (capistrano deploy) in EC2


I have an app in an Amazon EC2 server. The app uses FAYE to work with websocket. When I run the command in the EC2 console:

RAILS_ENV=production rackup private_pub.ru -o 0.0.0.0 -s thin -p 9292 -E production

The app works fine. But it is started manually.

I need to put this to start in the capistrano deploy.

My setup:

OS: Linux Ubuntu 14.04.2 LTS
Ruby -v: 2.2.2p95
Rails -v: 4.2.1
Capistrano lock: 3.5.0

Thanks!


Solution

    1. Connect in your EC2 server via SSH and navigate to your rails root folder
    2. Execute this command tmux new -s faye
    3. Execute this command RAILS_ENV=production rackup private_pub.ru -o 0.0.0.0 -s thin -p 9292 -E production
    4. Type Ctrl+b and next type d

    It will start a faye process in your server.

    To see the process that are running in port 9292, execute the command:

    lsof -i :9292
    

    More info

    1. About tmux. You must to install tmux in your server.
    2. How to enable port 9292 to faye in EC2. See in cache