问题描述
我已经使用Dokku在Digitalocean上托管了Rails应用程序。我的应用程序需要通过Faye运行实时应用程序。我一直在尝试类似Dokku的Shoreman插件的方法,并将 faye:捆绑exec rackup faye.ru -s thin -E production
添加到 Procfile文件中。但是到目前为止,还没有运气,需要有关如何使我的Faye服务器为我的应用程序运行的帮助。
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.
推荐答案
可以使用Faye服务器的几个步骤(例如在端口9292上):
You need to make several steps to have working faye server (e.g. on port 9292):
- 您的Procfile正常
- 在Docker上暴露端口9292。我建议安装
docker-options
插件和下一个dokku docker-options:add timer -p 9292:9292
-
设置您的应用程序nginx.conf。我的位置在这里:
- 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;
}
}
我建议安装 nginx-alt
插件,因为每次部署都会覆盖配置。
I suggest to install nginx-alt
plugin because config is overwritten on every deploy.
这篇关于如何在使用dokku部署的Rails应用程序上启动Faye服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!