Ada*_*dam 4 ruby ubuntu ruby-on-rails puma digital-ocean
我正在尝试手动启动我的Ruby on Rails应用程序,但遇到了问题.
当运行'sudo start puma-manager'或'sudo start puma app =/home //'时,我收到以下错误:'无法连接到Upstart:无法连接到socket/com/ubuntu/upstart:连接被拒绝".
我正在阅读本教程:https://www.digitalocean.com/community/tutorials/how-to-deploy-a-rails-app-with-puma-and-nginx-on-ubuntu-14-04,在Ubuntu 16.04上(没有其他惊喜,除了使用16.04我已经按照本教程的最后细节).是否有一个很好的方法让新手上班?
我刚才读到16.04没有新贵.真的吗?我发现很难相信美洲狮没有一个好的解决方法.这似乎太常见了.
谢谢你的帮助!
Ser*_*lez 10
我有同样的问题,有一段时间这是我没有升级到Ubuntu 16的原因,但我们必须继续这种变化.Systemd可能很吓人,但是一旦你开始有设置服务脚本的经验,它可能比Upstart更容易.
在/ etc/systemd/system /中创建一个名为puma.service的文件,类似于这个:
[Unit]
Description=Puma HTTP Server
After=network.target
[Service]
Type=simple
# Preferably configure a non-privileged user
User=appuser
# Specify the path to your puma application root
WorkingDirectory=/home/deploy/appname
# Helpful for debugging socket activation, etc.
Environment=PUMA_DEBUG=1
# Setting secret_key_base for rails production environment. We can set other Environment variables the same way, for example PRODUCTION_DATABASE_PASSWORD
Environment=SECRET_KEY_BASE=b7fbccc14d4018631dd739e8777a3bef95ee8b3c9d8d51f14f1e63e613b17b92d2f4e726ccbd0d388555991c9e90d3924b8aa0f89e43eff800774ba29
# The command to start Puma, use 'which puma' to get puma's bin path, specify your config/puma.rb file
ExecStart=/usr/local/bin/puma -C /home/deploy/appname/config/puma.rb
Restart=always
[Install]
WantedBy=multi-user.target
Run Code Online (Sandbox Code Playgroud)运行这些命令以启动systemd服务.
systemctl daemon-reload
systemctl enable puma.service
systemctl start puma.service
Run Code Online (Sandbox Code Playgroud)如果您完成了本指南的其他步骤,您的服务将会正常运行:https: //www.digitalocean.com/community/tutorials/how-to-deploy-a-rails-app-with-puma-and-nginx -酮的ubuntu-14-04
请记住,您可以使用以下命令检查服务的状态:
systemctl status puma.service
systemctl status nginx
Run Code Online (Sandbox Code Playgroud)
你可以使用'tail -f'调试这些日志文件:
/home/deploy/appname/shared/log/puma.stderr.log
/home/deploy/appname/log/production.log
/var/log/nginx/error.log
Run Code Online (Sandbox Code Playgroud)
那是对的。您应该在 Ubuntu 16.04 LTS 中使用 SystemD。以下是相关的 Puma 文档和提供的示例服务单元文件:
[Unit]
Description=Puma HTTP Server
After=network.target
# Uncomment for socket activation (see below)
# Requires=puma.socket
[Service]
# Foreground process (do not use --daemon in ExecStart or config.rb)
Type=simple
# Preferably configure a non-privileged user
# User=
# Specify the path to your puma application root
# WorkingDirectory=
# Helpful for debugging socket activation, etc.
# Environment=PUMA_DEBUG=1
# The command to start Puma
# Here we are using a binstub generated via:
# `bundle binstubs puma --path ./sbin`
# in the WorkingDirectory (replace <WD> below)
# You can alternatively use `bundle exec --keep-file-descriptors puma`
# ExecStart=<WD>/sbin/puma -b tcp://0.0.0.0:9292 -b ssl://0.0.0.0:9293?key=key.pem&cert=cert.pem
# Alternatively with a config file (in WorkingDirectory) and
# comparable `bind` directives
# ExecStart=<WD>/sbin/puma -C config.rb
Restart=always
[Install]
WantedBy=multi-user.target
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
3440 次 |
最近记录: |