Skip to content

Commit

Permalink
New setup for staging server
Browse files Browse the repository at this point in the history
  • Loading branch information
Marc Altmann committed Nov 3, 2016
1 parent 5cbfc6e commit 90cac67
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 7 deletions.
2 changes: 1 addition & 1 deletion config/chewy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ development:
production:
host: '10.0.2.180:9201'
staging:
host: 'localhost:9200'
host: '10.0.2.181:9200'
2 changes: 0 additions & 2 deletions config/deploy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
# Default branch is :master
# ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }

set :deploy_to, '/var/www/fairnopoly'

# Default value for :scm is :git
set :scm, :git

Expand Down
1 change: 1 addition & 0 deletions config/deploy/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# See the COPYRIGHT file for details.

set :stage, :production
set :deploy_to, '/var/www/fairnopoly'

server '78.109.61.168', user: 'deploy', roles: %w{web app db sidekiq}
server '78.109.61.169', user: 'deploy', roles: %w{web app sidekiq console}
Expand Down
3 changes: 2 additions & 1 deletion config/deploy/staging.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
# See the COPYRIGHT file for details.

set :stage, :staging
set :deploy_to, '/var/www/fairnopoly-stage'

server '78.109.61.137', user: 'deploy', roles: %w{web app db sidekiq console}
server '78.109.61.168', user: 'deploy', roles: %w{web app db sidekiq console}

set :branch, ENV['BRANCH_NAME'] || 'develop'
20 changes: 17 additions & 3 deletions config/initializers/sidekiq.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,31 @@
rescue LoadError, NoMethodError
end

# Try out database storage in Redis for staging
# http://www.mikeperham.com/2015/09/24/storing-data-with-redis/
redis_staging = { url: 'redis://10.0.2.181:6380/4' }
redis_production = { url: 'redis://10.0.2.181:6379', namespace: 'fairnopoly' }

Sidekiq.configure_server do |config|
config.redis = { url: 'redis://10.0.2.181:6379', namespace: 'fairnopoly' } if Rails.env.production?
if Rails.env.staging?
config.redis = redis_staging
elsif Rails.env.production?
config.redis = redis_production
end

begin
config.reliable_fetch!
rescue NoMethodError
end
end

if Rails.env.production?
if Rails.env.staging?
Sidekiq.configure_client do |config|
config.redis = redis_staging
end
elsif Rails.env.production?
Sidekiq.configure_client do |config|
config.redis = { url: 'redis://10.0.2.181:6379', namespace: 'fairnopoly' }
config.redis = redis_production
end
end

Expand Down

0 comments on commit 90cac67

Please sign in to comment.