繁体   English   中英

在暴发户上运行红宝石

[英]Run ruby on rails on upstart

我正在关注此链接,以便将红宝石自动启动。

但我不明白它的红宝石代码

#!/usr/bin/env ruby
require File.expand_path("../../config/environment", __FILE__)   #1.what is this path?
STDOUT.sync = true

Stalker::job 'user.fetch_details' do |args|  #2.what is this user?
  begin
    user = User.find(args['id'])    #3.what is this id?
    user.fetch_user_details!
    rescue ActiveRecord::RecordNotFound # too fast
    Rails.logger.warn "Unable to find user ##{args['id']} - suspect too fast, requeuing"
    Stalker.enqueue('user.fetch_details', :id => args['id'])
  end
end
jobs = ARGV.shift.split(',') rescue nil
Stalker.work jobs

和conf文件代码在/ etc / init /中

  description "TweetedLinks Ruby Worker"

  # automatically start
  start on filesystem

  # working directory
  chdir /var/www/TweetedLinks/current #4.should I change this to my own dir?ie home/usr/Trail/test-app

  # command to run, with Bundler support!
  env RAILS_ENV=production
  exec bundle exec ruby script/worker.rb >> log/worker.log  #5.do i need to create this worker.log? and this script folder can be put anywhere?

  respawn

我在home / usr / Trail / test-app下有我的rails应用程序

我在home / usr / script下创建了一个脚本文件夹

我在home / usr / .rvm / wrapper / test-app下生成了我的rvm

如何根据我的情况修改此代码。 和代码注释中的5个问题我也很困惑。

在此先感谢您!已经停留了一个月!

最简单的方法是使用可以将Procfile导出到暴发户的领班宝石,请参阅http://ddollar.github.io/foreman/#UPSTART-EXPORT

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM