Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allows for OD2 to be deployed to staging.
- Loading branch information
Trey Terrell
committed
Jun 23, 2015
1 parent
d20aaae
commit 3b7f86e
Showing
14 changed files
with
211 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,3 +32,5 @@ rspec | |
config/settings.local.yml | ||
config/settings/*.local.yml | ||
config/environments/*.local.yml | ||
/config/god.conf | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
load 'deploy' | ||
# Uncomment if you are using Rails' asset pipeline | ||
load 'deploy/assets' | ||
load 'config/deploy' # remove this line to skip loading any of the default tasks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
require 'yaml' | ||
config = YAML.load_file('config/settings.local.yml')["deployment"] || {} | ||
|
||
require 'bundler/capistrano' | ||
|
||
set :stages, config['stages'] || [] | ||
set :default_stage, config['default_stage'] || (config['stages'] || []).first | ||
require 'capistrano/ext/multistage' | ||
|
||
set :application, 'OregonDigital2' | ||
set :repository, config['repository'] | ||
set :user, config['user'] | ||
set :default_environment, config['default_environment'] || {} | ||
default_run_options[:pty] = true | ||
set :scm, :git | ||
set :branch, config['branch'] | ||
set :deploy_via, :remote_cache | ||
set :use_sudo, false | ||
set :keep_releases, 5 | ||
set :shared_children, shared_children + %w{pids sockets tmp public/uploads jetty} | ||
set :ssh_options, {:forward_agent => true} | ||
|
||
# if you want to clean up old releases on each deploy uncomment this: | ||
after 'deploy:restart', 'deploy:cleanup' | ||
|
||
after 'deploy:finalize_update', 'deploy:symlink_config' | ||
after 'deploy:update_code', 'deploy:migrate' | ||
after 'deploy:restart', 'deploy:cleanup' | ||
|
||
|
||
namespace :deploy do | ||
desc "Symlinks required configuration files" | ||
task :symlink_config, :roles => :app do | ||
%w{settings.local.yml god.conf}.each do |config_file| | ||
run "ln -nfs #{deploy_to}/shared/config/#{config_file} #{release_path}/config/#{config_file}" | ||
end | ||
end | ||
desc "Uploads local config files" | ||
task :upload_config, :roles => :app do | ||
%w{settings.local.yml god.conf}.each do |config_file| | ||
top.run "mkdir -p #{deploy_to}/shared/config" | ||
top.upload "config/#{config_file}", "#{deploy_to}/shared/config/#{config_file}", :via => :scp | ||
end | ||
end | ||
end | ||
namespace :rails do | ||
desc "Opens up a rails console" | ||
task :console, :roles => :app do | ||
hostname = find_servers_for_task(current_task).first | ||
exec "ssh -l #{user} #{hostname} -t 'source ~/.bash_profile && cd #{deploy_to}/current && export RBENV_VERSION=#{config[rails_env.to_s]['default_environment']['RBENV_VERSION']} && RAILS_ENV=#{rails_env} bundle exec rails c'" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
config = YAML.load_file('config/settings.local.yml')["deployment"]["staging"] || {} | ||
|
||
set :user, config['user'] | ||
# Set RBEnv Stuff | ||
set :default_environment, config['default_environment'] || {} | ||
# Servers | ||
role :web, config['hosts']['web'] # Your HTTP server, Apache/etc | ||
role :app, config['hosts']['app'] # This may be the same as your `Web` server | ||
role :db, config['hosts']['db'], :primary => true # This is where Rails migrations will run | ||
# Git Config | ||
set :branch, config['branch'] | ||
# God Settings | ||
set(:god_app_path) {"#{current_path}/#{config['god']['app_path']}"} | ||
set :god_sites_path, config['god']['sites_path'] | ||
set :deploy_to, config['deploy_to'] | ||
set :rails_env, :staging | ||
# Deploy Commands | ||
# Override deploy to inform god to do the restarts. | ||
namespace :deploy do | ||
task :start do | ||
god.start | ||
end | ||
task :stop do | ||
god.stop | ||
end | ||
task :restart do | ||
god.restart | ||
end | ||
end | ||
|
||
namespace :god do | ||
desc "Reload god config" | ||
task :reload, :roles => :app, :except => {:no_release => true} do | ||
run "ln -nfs #{god_app_path} #{god_sites_path}/#{application}.conf" | ||
sudo "/etc/init.d/god restart" | ||
end | ||
|
||
task :restart, :roles => :app, :except => {:no_release => true} do | ||
run "touch #{shared_path}/tmp/restart.txt" | ||
end | ||
|
||
task :start, :roles => :app do | ||
sudo "/etc/init.d/god startapp #{application}" | ||
end | ||
|
||
task :stop, :roles => :app do | ||
sudo "/etc/init.d/god stopapp #{application}" | ||
end | ||
task :status, :roles => :app do | ||
sudo "/etc/init.d/god status #{applictaion}" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
require_relative 'production' | ||
|
||
Rails.application.configure do | ||
config.action_mailer.default_url_options = { host: 'od2-dev.library.oregonstate.edu' } | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
development: | ||
user: fedoraAdmin | ||
password: fedoraAdmin | ||
url: http://127.0.0.1:8983/fedora/rest | ||
base_path: /dev | ||
test: | ||
user: fedoraAdmin | ||
password: fedoraAdmin | ||
url: http://localhost:8983/fedora/rest | ||
base_path: /test | ||
production: | ||
user: <%= ENV["OD2_FEDORA_USERNAME"] || "fedoraAdmin" %> | ||
password: <%= ENV["OD2_FEDORA_PASSWORD"] || "fedoraAdmin" %> | ||
url: <%= ENV["OD2_FEDORA_URL"] || "http://127.0.0.1:8983/fedora/rest" %> | ||
base_path: /prod | ||
staging: | ||
user: <%= ENV["OD2_FEDORA_USERNAME"] || "fedoraAdmin" %> | ||
password: <%= ENV["OD2_FEDORA_PASSWORD"] || "fedoraAdmin" %> | ||
url: <%= ENV["OD2_FEDORA_URL"] || "http://127.0.0.1:8983/fedora/rest" %> | ||
base_path: <%= ENV["OD2_FEDORA_BASE_PATH"] || "/staging" %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
default: | ||
startup_wait: 90 | ||
jetty_port: 8983 | ||
java_opts: | ||
- "-XX:MaxPermSize=128m" | ||
- "-Xmx256m" | ||
- "-Dmarmotta.home=<%= File.expand_path(MARMOTTA_HOME) %>" | ||
test: | ||
jetty_port: 8983 | ||
startup_wait: 60 | ||
- "-Xmx512m" | ||
- "-XX:MaxPermSize=128m" | ||
staging: | ||
startup_wait: 90 | ||
jetty_port: <%= ENV["OD2_JETTY_PORT"] || "8983" %> | ||
java_opts: | ||
- "-XX:MaxPermSize=256m" | ||
- "-Xmx512m" | ||
- "-XX:MaxPermSize=128m" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
marmotta: | ||
url: <%= ENV["OD2_MARMOTTA_URL"] || "http://localhost:8983/marmotta" %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# This is a sample config file that points to a solr server for each environment | ||
development: | ||
url: http://localhost:8983/solr/development | ||
test: | ||
url: <%= "http://127.0.0.1:#{ENV['TEST_JETTY_PORT'] || 8983}/solr/test" %> | ||
production: | ||
url: <%= ENV["OD2_SOLR_URL"] %> | ||
staging: | ||
url: <%= ENV["OD2_SOLR_URL"] %> |