簡體   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