Hot deploy Ruby just like PHP: FTP upload file and valid immediately

我的梦境 提交于 2019-12-10 11:13:04

问题


Is it possible to hot deploy Ruby just like PHP? Normally I used FTP to upload the PHP file, then it will be available automatically. Can Ruby hot deploy its file like this?

Your comment welcome.


回答1:


Are you talking about a ruby on rails application ?

If so, when deploying a rails application in production mode, the all application gets loaded in memory. So changing the files won't affect the running application.

For hot restarting a rails application you will need to use solution such as:

  • Unicorn
  • Puma
  • Passenger

For a first time, Puma is the easiest way.

However if you are looking for a zero-downtime, either Unicorn or Passenger enterprise are what you are looking for.

EDIT

Unicorn

  • Free
  • Complex configuration
  • zero-downtime when hot restarting. when hot-restarting unicorn, it keeps the old threads working until the new ones are fully functionnal. So if the new ones fail to start, nothing happens. The old ones just keep going.

Puma

  • Free
  • Simple configuration
  • hot restart but no zero-downtime. When hot-restarting puma, it shuts down the old threads and starts the new ones. Puma keeps the sockets open, so the client are not disconnected, but are waiting to get a response while the new threads restart. However if the new threads fail to start, Puma can't restart the old ones. So connections are lost and the server is down.

Passenger

Free edition

  • Free
  • The configuration is easier than unicorn
  • hot-restart, but no zero-downtime. Like Puma.

Enterprise edition

  • $29/mo
  • The configuration is easier than unicorn
  • zero-downtime when hot restarting. Like Unicorn.


来源:https://stackoverflow.com/questions/23456026/hot-deploy-ruby-just-like-php-ftp-upload-file-and-valid-immediately

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!