听说 nginx 比 apache 效率高,puma 比较省资源,mina 部署比较自动化,有无 rubyist 可以给我介绍一下三者在一起的教程? 谢谢!
我的项目没有用这个 gem, 我自己写的 puma 的 mina task:
# Puma
# ==============================================================================
namespace :puma do
set :puma_pid, "#{app_path}/tmp/pids/puma.pid"
set :start_puma, %{
cd #{app_path}
bundle exec puma --config #{app_path}/config/puma.rb --environment #{rails_env}
}
# Start task
# ------------------------------------------------------------------------------
desc "Start Puma"
task :start => :environment do
queue 'echo "-----> Start Puma"'
queue! start_puma
end
# Stop task
# ------------------------------------------------------------------------------
desc "Stop Puma"
task :stop do
queue 'echo "-----> Stop Puma"'
queue! %{
test -s "#{puma_pid}" && kill -QUIT `cat "#{puma_pid}"` && echo "Stop Ok" && exit 0
echo >&2 "Not running"
}
end
# Restart task
# ------------------------------------------------------------------------------
desc "Restart Puma using 'upgrade'"
task :restart => :environment do
invoke 'puma:stop'
invoke 'puma:start'
end
end
God is an easy to configure, easy to extend monitoring framework written in Ruby.
我是把它当开机自启动服务用,写 linux init.d service 难度太高,不写万一服务器被重启了,还得手动一个一个的启动服务
god 安装到系统路径 启动流程
PATH=$PATH:/usr/local/bin god -c /etc/god/god.god
从而实现开机启动 godGod.load "/etc/god/conf.d/*.god"
,这样就可以把/etc/god/conf.d/目录下的所有 god 文件定义的服务全部开机自启动我使用 puma.sh 启动的时候报错了,报错信息如下 releases/4/vendor/bundle/ruby/2.2.0/gems/puma-2.15.3/lib/puma/cli.rb:195:in `chdir': No such file or directory @ dir_chdir - /