From ca7d30543660108bf7601eb34b9dcbc666b29dc0 Mon Sep 17 00:00:00 2001 From: Andrew Hobden Date: Tue, 25 Apr 2017 15:07:16 +0200 Subject: [PATCH 1/2] syncing changes --- config/deploy.rb | 4 ++-- config/deploy/production.rb | 1 + config/deploy/staging.rb | 1 + lib/tasks/planet_reader.rake | 5 ++--- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/config/deploy.rb b/config/deploy.rb index 475b417d1..9f4cda8e0 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -25,7 +25,7 @@ # Default value for :linked_files is [] set :linked_files, %w{ config/database.yml config/open_street_map.yml config/metrics.yml config/librato.yml config/newrelic.yml .env config/secrets.yml} -set :bundle_roles, [:app, :worker] +set :bundle_roles, [:app, :worker, :importer] set :bundle_without, %w{ development test metrics deployment }.join(' ') set :bundle_jobs, 4 set :bundle_binstubs, -> { shared_path.join('bin') } @@ -75,7 +75,7 @@ # We need to link the existing shared `/var/apps/wheelmap/public/system` folder # into the new release. - execute :ln, "-s", "#{deploy_path}/public/system", "#{release_path}/public/" + execute :ln, "-s", "#{deploy_path}/public/system/uploads", "#{release_path}/public/system" # We create this file so the consul health check will pass. We can't use an # existing file since they are all unpredictably named. diff --git a/config/deploy/production.rb b/config/deploy/production.rb index 6c9171c7e..570187c95 100644 --- a/config/deploy/production.rb +++ b/config/deploy/production.rb @@ -30,6 +30,7 @@ server 'app1.node.production', user: 'deploy', roles: %w{app}, port: 22 server 'asset.node.production', user: 'deploy', roles: %w{asset}, port: 22, :no_release => true server 'worker0.node.production', user: 'deploy', roles: %w{worker}, port: 22 +server 'osm-database.node.production', user: 'deploy', roles: %w{importer}, port: 22 # Used for replication. #server 'mysql.node.production', user: 'wheelmap', roles: %w{mysql}, port: 22 # Custom SSH Options diff --git a/config/deploy/staging.rb b/config/deploy/staging.rb index e9dffff6c..e261c705d 100644 --- a/config/deploy/staging.rb +++ b/config/deploy/staging.rb @@ -25,6 +25,7 @@ server 'app1.node.staging', user: 'deploy', roles: %w{app}, port: 22 server 'asset.node.staging', user: 'deploy', roles: %w{asset}, port: 22, :no_release => true server 'worker0.node.staging', user: 'deploy', roles: %w{worker}, port: 22 +server 'osm-database.node.staging', user: 'deploy', roles: %w{importer}, port: 22 # Used for replication. #server 'mysql.node.production', user: 'wheelmap', roles: %w{mysql}, port: 22 # Custom SSH Options diff --git a/lib/tasks/planet_reader.rake b/lib/tasks/planet_reader.rake index 9e49d187a..e274fd7c4 100644 --- a/lib/tasks/planet_reader.rake +++ b/lib/tasks/planet_reader.rake @@ -54,9 +54,8 @@ def get_new_replication_file end def get_new_shape_replication_files - puts 'INFO: Fetching shape changes.' - system "ssh -p 22022 osm@176.9.63.171 \"ruby make_osc.rb -d\" 2> /dev/null >> #{SHAPE_FILE}" - puts "INFO: Downloaded #{File.size(SHAPE_FILE)} bytes" + puts "INFO: Fetching shape changes." + system "#{MAKE_OSC} -d >> #{SHAPE_FILE}" end def merge_replication_files From c5bed486c895d86a40b1f4abecd47a386c60aa7f Mon Sep 17 00:00:00 2001 From: Andrew Hobden Date: Tue, 25 Apr 2017 15:14:00 +0200 Subject: [PATCH 2/2] Use bundle --- lib/tasks/planet_reader.rake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/tasks/planet_reader.rake b/lib/tasks/planet_reader.rake index e274fd7c4..e2fe4ed72 100644 --- a/lib/tasks/planet_reader.rake +++ b/lib/tasks/planet_reader.rake @@ -8,6 +8,7 @@ SHAPE_FILE = "#{VAR_DIR}/shapes.osc".freeze STATE_FILE = "#{WORKING_DIR}/state.txt".freeze BACKUP_FILE = "#{WORKING_DIR}/state.old".freeze DOWNLOAD_LOCK = "#{WORKING_DIR}/download.lock".freeze +MAKE_OSC_DIR = "/var/apps/make_osc/".freeze require 'rake' @@ -55,7 +56,7 @@ end def get_new_shape_replication_files puts "INFO: Fetching shape changes." - system "#{MAKE_OSC} -d >> #{SHAPE_FILE}" + system "BUNDLE_GEMFILE=#{MAKE_OSC_DIR}/Gemfile bundle exec #{MAKE_OSC_DIR}/make_osc.rb -d >> #{SHAPE_FILE}" end def merge_replication_files