I've hosted my rails application on Digitalocean using Dokku. There's this need for my application to run real-time applications through Faye. I've been trying several ways like the shoreman plugin for Dokku and adding faye: bundle exec rackup faye.ru -s thin -E production
to "Procfile" file. But no luck till now, need help on how I can get this Faye server running for my app.
You need to make several steps to have working faye server (e.g. on port 9292):
- Your Procfile is OK
- Expose port 9292 on Docker. I recommend install
docker-options
plugin and nextdokku docker-options:add timer "-p 9292:9292"
Setup your app nginx.conf. Mine is here:
upstream app { server 127.0.0.1:49154; } server { listen [::]:80; listen 80; server_name app.dokku.mine; location / { proxy_pass http://app; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $http_host; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-Port $server_port; proxy_set_header X-Request-Start $msec; } location /faye { proxy_redirect off; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_http_version 1.1; proxy_buffering off; proxy_cache_bypass $http_pragma $http_authorization; proxy_no_cache $http_pragma $http_authorization; proxy_pass http://localhost:9292; } }
I suggest to install nginx-alt
plugin because config is overwritten on every deploy.
来源:https://stackoverflow.com/questions/25135190/how-to-start-faye-server-on-a-rails-app-deployed-using-dokku