diff --git a/config/config.yml b/config/config.yml index 9c05a0d6..2f84da09 100644 --- a/config/config.yml +++ b/config/config.yml @@ -13,6 +13,10 @@ test: production: <<: *defaults + all_collection_manifest_url: <%= ENV["POMEGRANATE_COLLECTIONS_URL"] %> + events: + server: <%= ENV["POMEGRANATE_RABBITMQ_URL"] %> + exchange: <%= ENV["POMEGRANATE_RABBITMQ_EXCHANGE"] %> staging: <<: *defaults diff --git a/config/database.yml b/config/database.yml index 48a042a2..69809038 100644 --- a/config/database.yml +++ b/config/database.yml @@ -24,6 +24,9 @@ production: &production <<: *default adapter: postgresql database: <%= ENV["POMEGRANATE_DB"] %> + host: <%= ENV["POMEGRANATE_DB_HOST"] %> + username: <%= ENV["POMEGRANATE_DB_USERNAME"] %> + password: <%= ENV["POMEGRANATE_DB_PASSWORD"] %> staging: <<: *production diff --git a/config/deploy.rb b/config/deploy.rb index a2fe5d4f..d303b889 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -1,11 +1,8 @@ -# config valid only for current version of Capistrano -lock '3.4.0' - set :application, 'pomegranate' set :repo_url, 'https://github.com/pulibrary/pomegranate.git' # Default branch is :master -# ask :branch, `git rev-parse --abbrev-ref HEAD`.chomp +set :branch, ENV['BRANCH'] || 'master' # Default deploy_to directory is /var/www/my_app_name # set :deploy_to, '/var/www/my_app_name' @@ -48,20 +45,20 @@ namespace :sneakers do task :restart do - on roles(:app) do + on roles(:worker) do execute :sudo, :initctl, :restart, "pom-sneakers" end end end namespace :sidekiq do task :quiet do - on roles(:app) do + on roles(:worker) do # Horrible hack to get PID without having to use terrible PID files puts capture("kill -USR1 $(sudo initctl status pom-workers | grep /running | awk '{print $NF}') || :") end end task :restart do - on roles(:app) do + on roles(:worker) do execute :sudo, :initctl, :restart, "pom-workers" end end diff --git a/config/deploy/production.rb b/config/deploy/production.rb new file mode 100644 index 00000000..0d02d930 --- /dev/null +++ b/config/deploy/production.rb @@ -0,0 +1,57 @@ +# server-based syntax +# ====================== +# Defines a single server with a list of roles and multiple properties. +# You can define all roles on a single server, or split them: + +# server 'example.com', user: 'deploy', roles: %w{app db web}, my_property: :my_value +# server 'example.com', user: 'deploy', roles: %w{app web}, other_property: :other_value +# server 'db.example.com', user: 'deploy', roles: %w{db} +server 'lib-pom1', user: 'deploy', roles: %w(app db web worker) +set :deploy_to, '/opt/rails_app' + +# role-based syntax +# ================== + +# Defines a role with one or multiple servers. The primary server in each +# group is considered to be the first unless any hosts have the primary +# property set. Specify the username and a domain or IP for the server. +# Don't use `:all`, it's a meta role. + +# role :app, %w{deploy@example.com}, my_property: :my_value +# role :web, %w{user1@primary.com user2@additional.com}, other_property: :other_value +# role :db, %w{deploy@example.com} + +# Configuration +# ============= +# You can set any configuration variable like in config/deploy.rb +# These variables are then only loaded and set in this stage. +# For available Capistrano configuration variables see the documentation page. +# http://capistranorb.com/documentation/getting-started/configuration/ +# Feel free to add new variables to customise your setup. + +# Custom SSH Options +# ================== +# You may pass any option but keep in mind that net/ssh understands a +# limited set of options, consult the Net::SSH documentation. +# http://net-ssh.github.io/net-ssh/classes/Net/SSH.html#method-c-start +# +# Global options +# -------------- +# set :ssh_options, { +# keys: %w(/home/rlisowski/.ssh/id_rsa), +# forward_agent: false, +# auth_methods: %w(password) +# } +# +# The server-based syntax can be used to override options: +# ------------------------------------ +# server 'example.com', +# user: 'user_name', +# roles: %w{web app}, +# ssh_options: { +# user: 'user_name', # overrides user setting above +# keys: %w(/home/user_name/.ssh/id_rsa), +# forward_agent: false, +# auth_methods: %w(publickey password) +# # password: 'please use keys' +# } diff --git a/config/deploy/staging.rb b/config/deploy/staging.rb index b1df8981..2564755c 100644 --- a/config/deploy/staging.rb +++ b/config/deploy/staging.rb @@ -6,7 +6,7 @@ # server 'example.com', user: 'deploy', roles: %w{app db web}, my_property: :my_value # server 'example.com', user: 'deploy', roles: %w{app web}, other_property: :other_value # server 'db.example.com', user: 'deploy', roles: %w{db} -server 'pom-dev', user: 'deploy', roles: %w(app db web) +server 'pom-dev', user: 'deploy', roles: %w(app db web worker) # role-based syntax # ==================