Permalink
Browse files

add capistrano & session token

  • Loading branch information...
1 parent b1a8042 commit 2d7e3d78767fb70b0b09540f595a7496b8d7c99e @adamcooke adamcooke committed Oct 28, 2013
Showing with 73 additions and 12 deletions.
  1. +2 −0 .gitignore
  2. +44 −0 Capfile
  3. +5 −1 Gemfile
  4. +15 −0 Gemfile.lock
  5. +7 −11 config/initializers/secret_token.rb
View
@@ -16,5 +16,7 @@
/tmp
/config/database.yml
+/config/session_token.yml
+
/docs
View
@@ -0,0 +1,44 @@
+set :application, 'shoppe-website'
+set :repository, 'git://github.com/tryshoppe/website.git'
+set :scm, 'git'
+set :branch, 'master'
+set :deploy_via, :remote_cache
+set :git_enable_submodules, 1
+set :ssh_options, {:forward_agent => true}
+set :rails_env, "production"
+set :use_sudo, false
+set :deploy_to, "/opt/rubyapps/shoppe-website"
+set :user, 'rubyapps'
+set :assets_role, [:app]
+set :config_files, ['database.yml', 'session_token.yml']
+
+load 'deploy'
+load 'deploy/assets'
+require "bundler/capistrano"
+
+before 'deploy:finalize_update', 'deploy:symlink_config'
+
+role :db, "tryshoppe.com", :primary => true
+role :app, "tryshoppe.com"
+
+namespace :deploy do
+ desc 'Symlink configuration files into new application'
+ task :symlink_config, :roles => [:app, :web] do
+ commands = fetch(:config_files, []).map do |file|
+ "ln -s #{shared_path}/config/#{file} #{release_path}/config/#{file}"
+ end.join(' && ')
+ run commands
+ end
+
+ task :start, :roles => :app do
+ end
+
+ task :stop, :roles => :app do
+ end
+
+ task :restart, :roles => :app do
+ run "mkdir -p #{current_path}/tmp && touch #{current_path}/tmp/restart.txt"
+ end
+
+end
+
View
@@ -8,4 +8,8 @@ gem 'jquery-rails'
gem 'haml'
gem 'nifty-utils'
gem 'redcarpet'
-gem 'pygments.rb'
+gem 'pygments.rb'
+
+group :development do
+ gem 'capistrano'
+end
View
@@ -28,6 +28,12 @@ GEM
arel (4.0.1)
atomic (1.1.14)
builder (3.1.4)
+ capistrano (2.15.5)
+ highline
+ net-scp (>= 1.0.0)
+ net-sftp (>= 2.0.0)
+ net-ssh (>= 2.0.14)
+ net-ssh-gateway (>= 1.1.0)
coffee-rails (4.0.1)
coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.0)
@@ -39,6 +45,7 @@ GEM
execjs (2.0.2)
haml (4.0.3)
tilt
+ highline (1.6.19)
hike (1.2.3)
i18n (0.6.5)
jquery-rails (3.0.4)
@@ -52,6 +59,13 @@ GEM
minitest (4.7.5)
multi_json (1.8.2)
mysql2 (0.3.13)
+ net-scp (1.1.2)
+ net-ssh (>= 2.6.5)
+ net-sftp (2.1.2)
+ net-ssh (>= 2.6.5)
+ net-ssh (2.7.0)
+ net-ssh-gateway (1.2.0)
+ net-ssh (>= 2.6.5)
nifty-utils (1.0.0)
polyglot (0.3.3)
posix-spawn (0.3.6)
@@ -107,6 +121,7 @@ PLATFORMS
ruby
DEPENDENCIES
+ capistrano
coffee-rails (~> 4.0.0)
haml
jquery-rails
@@ -1,12 +1,8 @@
-# Be sure to restart your server when you modify this file.
+token_file = Rails.root.join('config', 'session_token.yml')
+unless File.exists?(token_file)
+ File.open(token_file, "w") do |f|
+ f.write SecureRandom.hex(128).to_yaml
+ end
+end
-# Your secret key is used for verifying the integrity of signed cookies.
-# If you change this key, all old signed cookies will become invalid!
-
-# Make sure the secret is at least 30 characters and all random,
-# no regular words or you'll be exposed to dictionary attacks.
-# You can use `rake secret` to generate a secure secret key.
-
-# Make sure your secret_key_base is kept private
-# if you're sharing your code publicly.
-ShoppeWebsite::Application.config.secret_key_base = '4746022f5015f72312c8e3f72f18eb580ce9e1566982eaca9ae39408a3f706ae2863c53379d754402893aee6d5b4ee9b84a5968d54e10d9304903d1d7ad029b9'
+ShoppeWebsite::Application.config.secret_token = YAML.load_file(token_file)

0 comments on commit 2d7e3d7

Please sign in to comment.