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.
cd ~ | |
sudo apt-get update | |
sudo apt-get install unzip curl python-software-properties -y | |
#sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner" | |
sudo add-apt-repository ppa:ferramroberto/java | |
sudo apt-get update | |
sudo apt-get install sun-java6-jre sun-java6-plugin -y | |
wget https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.18.7.tar.gz -O elasticsearch.tar.gz | |
tar -xf elasticsearch.tar.gz |
/home/daul/.rbenv/versions/1.9.3-p392/lib/ruby/1.9.1/psych.rb:203:in `parse': (<unknown>): mapping values are not allowed in this context at line 22 column 11 (Psych::SyntaxError) | |
from /home/daul/.rbenv/versions/1.9.3-p392/lib/ruby/1.9.1/psych.rb:203:in `parse_stream' | |
from /home/daul/.rbenv/versions/1.9.3-p392/lib/ruby/1.9.1/psych.rb:151:in `parse' | |
from /home/daul/.rbenv/versions/1.9.3-p392/lib/ruby/1.9.1/psych.rb:127:in `load' | |
from /home/daul/repang/shared/bundle/ruby/1.9.1/gems/railties-3.2.12/lib/rails/application/configuration.rb:115:in `database_configuration' | |
from /home/daul/repang/shared/bundle/ruby/1.9.1/gems/activerecord-3.2.12/lib/active_record/railtie.rb:78:in `block (2 levels) in <class:Railtie>' | |
from /home/daul/repang/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.12/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval' | |
from /home/daul/repang/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.12/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook' | |
from /home/daul/repang/shared/ |
# SQLite version 3.x | |
# gem install sqlite3 | |
# | |
# Ensure the SQLite 3 gem is defined in your Gemfile | |
# gem 'sqlite3' | |
development: | |
adapter: sqlite3 | |
database: db/development.sqlite3 | |
pool: 5 | |
timeout: 5000 |
daul-ui-MacBook-Air:repang daul$ cap deploy | |
* 2013-06-03 00:56:50 executing `deploy' | |
triggering before callbacks for `deploy' | |
* 2013-06-03 00:56:50 executing `deploy:check_revision' | |
* 2013-06-03 00:56:50 executing `deploy:update' | |
** transaction: start | |
* 2013-06-03 00:56:50 executing `deploy:update_code' | |
updating the cached checkout on all servers | |
executing locally: "git ls-remote [email protected]:onesup/repang.git master" | |
command finished in 7824ms |
class Coupon < ActiveRecord::Base | |
belongs_to :user | |
#published, used, new | |
#쿠폰 사용 약관에 "회원 탈퇴 시 쿠폰또한 삭제됩니다. 라고 명시해야함." | |
def self.valid?(code, user=nil) | |
if self.exists?(:code => code) | |
coupons = self.where(:code => code) | |
coupon = coupons.first |
window.fbAsyncInit = function() { | |
// init the FB JS SDK | |
FB.init({ | |
appId : '<%= FACEBOOK_CONFIG[:app_id] %>', // App ID from the app dashboard | |
channelUrl : '//<%= FACEBOOK_CONFIG[:domain] %>/channel.html', // Channel file for x-domain comms | |
status : true, // check login status | |
cookie : true, // enable cookies to allow the server to access the session | |
xfbml : true // parse XFBML | |
}); | |
FB.getLoginStatus(function(response) { |
$('#behind_tracking').bind('click', function(e) { | |
e.preventDefault(); | |
$.ajax({ | |
url:"http://i85.icast-ad.com/track?ccd=1185&mcd=01040601&pcd=1505", | |
type: "GET", | |
success: function(response) { | |
window.location.href = $('#behind_tracking').attr("href"); | |
}, | |
headers: { | |
'X-Transaction': 'POST Example', |
$.ajax({ | |
url:"http://i85.icast-ad.com/track?ccd=1185&mcd=01040601&pcd=1504", | |
type: "GET", | |
success: function(response) { | |
window.location.href = $('#event_tracking').attr("href"); | |
},error:function(XMLHttpRequest,status,error){ | |
window.location.href = $('#event_tracking').attr("href"); | |
}, | |
headers: { | |
'X-Transaction': 'POST Example', |
require "bundler/capistrano" | |
require "net/sftp" | |
set :rails_env, "production" #added for delayed job | |
set :application, "kfarm" | |
set :user, "onesup" | |
set :deploy_to, "/home/#{user}/#{application}" | |
set :deploy_via, :copy | |
set :use_sudo, false | |
set :scm, "git" |