Skip to content

Commit

Permalink
Link the database config file into the app after deploying.
Browse files Browse the repository at this point in the history
  • Loading branch information
kjvarga committed Nov 6, 2009
1 parent fccdc20 commit 36608a4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 8 additions & 6 deletions config/deploy.rb
Expand Up @@ -83,9 +83,7 @@
task :after_update_code do
run "chmod 755 #{release_path}/public"
run "chmod 755 #{release_path}/public/dispatch.*"
run "if [ -e #{previous_release}/public/sitemap_index.xml.gz ]; then cp #{previous_release}/public/sitemap* #{current_release}/public/; fi"
run "cd #{current_path} && rake app:update_sass RAILS_ENV=production"


# Switch to production environment.
# This uncomments all lines in environment.rb that start with '#prod'
environment_file = "#{release_path}/config/environment.rb"
Expand All @@ -94,6 +92,10 @@
# Delete unpacked native gems. Because we don't have access to the C compiler
# on HostGator, we cannot build the unpacked gems. So we must use the system gem.
delete_local_copy_of_system_gems

run "ln -nfs #{shared_path}/db/database.yml #{current_release}/config/database.yml"
run "if [ -e #{previous_release}/public/sitemap_index.xml.gz ]; then cp #{previous_release}/public/sitemap* #{current_release}/public/; fi"
run "cd #{current_path} && rake app:update_sass RAILS_ENV=#{rails_env}"
end

desc "After setup ensure the shared/db and shared/backups folders exist."
Expand All @@ -107,12 +109,12 @@
task :rotate, :roles => [:app] do
logfiles = capture( "ls -x #{shared_path}/log" ).split

if logfiles.index( 'production.log' ).nil?
if logfiles.index( "#{rails_env}.log" ).nil?
logger.info "production.log was not found, no rotation performed"

else
filename = "production.log.#{timestamp_string}.log.bz2"
logfile = "#{shared_path}/log/production.log"
filename = "#{rails_env}.log.#{timestamp_string}.log.bz2"
logfile = "#{shared_path}/log/#{rails_env}.log"

deploy.restart # stop the server
run "bzip2 #{logfile}" # bzips the production.log and removes it
Expand Down
2 changes: 1 addition & 1 deletion lib/tasks/tz.rake
Expand Up @@ -12,7 +12,7 @@ namespace :tz do
tzpage.save

# Expire the fragment cache for this URL
ActionController::Base.new.expire_fragment( :url => tzpage.url )
ActionController::Base.new.expire_fragment( :url => tzpage.url ) rescue nil

# process the movies
extractAndLoadMovies(tzpage)
Expand Down

0 comments on commit 36608a4

Please sign in to comment.