Build & Config

Deploying and managing Faye


Faye is a publish-subscribe messaging system that provides messaging services. At Cloud 66, we recommend running Faye as a background process on your application behind a Thin rack server.


We will use four files containing the following commands to accomplish this setup. In addition to these, be sure to open the port on which your Faye server is running to the relevant servers.

1. The Deploy Hooks file


Deploy hooks allow you to take action at various points during a build and/or deployment on Cloud 66. This one will run the bash script that we will create in the next step before Rails is installed on your server.

      - source: /.cloud66/files/
        destination: ~/
        target: rails
        execute: true
        sudo: true
        apply_during: build_only
        run_on: all_servers

If you are adding Faye to an existing application, you should temporarily change the deploy hook apply_during: build_only to apply_during: all. Failing to do this would not apply the changes to your existing application - but once you have got it running for the first time you can change it back as you don't need to run the script on every deploy.

2. The installer bash script


This bash script ensures that Thin and Faye are installed on your server during deployment.

sudo gem install thin --no-ri --no-rdoc
sudo gem install faye --no-ri --no-rdoc

3. The Procfile


Here we are creating a background process for Faye so that we can control and monitor it from the Cloud 66 dashboard.

$ faye: thin -R $STACK_PATH/faye/ start

4. The Faye config file


These are settings specific to your Faye setup, which will vary depending on your requirements. You will need to insert the port that your Faye setup is running on in the last line.

require 'faye'
faye_server = => '/your_faye_mount', :timeout => 45)


Should you need to do any troubleshooting, you can find your Faye logs in $STACK_PATH/log/user_faye_1.log on your server.

Connecting to Docker image repositories