simplify initial database setup deployment rules

This commit is contained in:
wvengen 2014-01-15 21:39:29 +01:00
parent af3761fcf5
commit 46b36c42bd
2 changed files with 1 additions and 3 deletions

View file

@ -14,8 +14,6 @@ set :user, 'deploy' # ssh deploy user
set :default_stage, 'staging' # default environment, see config/deploy/ set :default_stage, 'staging' # default environment, see config/deploy/
set :keep_releases, 10 set :keep_releases, 10
set :repo_url, 'git://github.com/foodcoops/foodsoft.git' set :repo_url, 'git://github.com/foodcoops/foodsoft.git'
set :unique_app_name, fetch(:application) # for more complex setups, this can be customised
# XXX how to get rails environment in here?
set :deploy_to, "/www/apps/#{fetch :unique_app_name}" set :deploy_to, "/www/apps/#{fetch :unique_app_name}"
# more settings which are probably ok # more settings which are probably ok

View file

@ -22,7 +22,7 @@ namespace :deploy do
task :config => ['deploy:set_rails_env'] do task :config => ['deploy:set_rails_env'] do
require 'securerandom' require 'securerandom'
on roles(:app), in: :groups do on roles(:app), in: :groups do
db_name = fetch(:unique_app_name).gsub(/[^-_a-z0-9]/i, '') db_name = (fetch(:db_user) or fetch(:application))
db_passwd = SecureRandom.urlsafe_base64(24).to_s db_passwd = SecureRandom.urlsafe_base64(24).to_s
db_yaml = { db_yaml = {
fetch(:rails_env).to_s => { fetch(:rails_env).to_s => {