This script enables you to launch your Rails application in production environment (port:80) with Nginx and Unicorn.
Please make sure that your Gemfile in your rails application includes unicorn.
| #!/bin/sh | |
| set -u | |
| set -e | |
| # Example init script, this can be used with nginx, too, | |
| # since nginx and unicorn accept the same signals | |
| # Feel free to change any of the following variables for your app: | |
| APP_ROOT=/home/deploy/public_html/rm/current | |
| PID=$APP_ROOT/tmp/pids/unicorn.pid | |
| ENV=production |
| # Copyright (c) 2010 Tech-Angels | |
| # | |
| # Permission is hereby granted, free of charge, to any person | |
| # obtaining a copy of this software and associated documentation | |
| # files (the "Software"), to deal in the Software without | |
| # restriction, including without limitation the rights to use, | |
| # copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| # copies of the Software, and to permit persons to whom the | |
| # Software is furnished to do so, subject to the following | |
| # conditions: |
| # note - you may need to split into a before-deploy (stop) and after-deploy (start) depending on your setup | |
| desc "Hot-reload God configuration for the Resque worker" | |
| deploy.task :reload_god_config do | |
| sudo "god stop resque" | |
| sudo "god load #{File.join deploy_to, 'current', 'config', 'resque.god'}" | |
| sudo "god start resque" | |
| end | |
| after 'deploy:update_code', 'deploy:update_shared_symlinks' |
| set mailserver smtp.gmail.com port 587 username "[email protected]" password "password" using tlsv1 with timeout 30 seconds |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <plist version="1.0"> | |
| <dict> | |
| <key>Label</key> | |
| <string>com.github.mxcl.homebrew.daemontools</string> | |
| <key>ProgramArguments</key> | |
| <array> | |
| <string>/usr/local/bin/svscanboot</string> | |
| </array> |
| // This program is free software. It comes without any warranty, to | |
| // the extent permitted by applicable law. You can redistribute it | |
| // and/or modify it under the terms of the Do What The Fuck You Want | |
| // To Public License, Version 2, as published by Sam Hocevar. See | |
| // http://sam.zoy.org/wtfpl/COPYING for more details. | |
| var sys = require('sys') | |
| , opts = require('opts') | |
| , ws = require('websocket-server') | |
| , redis = require('redis') |
| ❷ > QUEUE=* rake resque:work --trace | |
| ** Invoke resque:work (first_time) | |
| ** Invoke resque:preload (first_time) | |
| ** Invoke resque:setup (first_time) | |
| ** Execute resque:setup | |
| ** Execute resque:preload | |
| rake aborted! | |
| No such file to load -- devise/confirmations_controller | |
| /Users/stefan/.rvm/gems/ruby-1.9.2-p290@my-rails-project/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:306:in `rescue in depend_on' | |
| /Users/stefan/.rvm/gems/ruby-1.9.2-p290@my-rails-project/gems/activesupport-3.1.1/lib/active_support/dependencies.rb:301:in `depend_on' |
| #! /usr/bin/env ruby | |
| # encoding: UTF-8 | |
| require 'uri' | |
| require 'json' | |
| require 'open-uri' | |
| require 'openssl' | |
| require 'nokogiri' | |
| def get_documents_info() |