Engineyard Deployment: How to detect in deploy hooks that its the first attempt to execute ‘rake db:seed’

Well from help command of Engineyard ruby gem

ey help deploy

we can see that we can send data as key:value pair like

ey deploy -e my_app_staging --config=key:value

now in any deploy hook, if for seeding deploy/after_migrate.rb hook would be the best

# in deploy/after_migrate.rb
on_app_servers do
  # Sometimes the order seems off so try
  $stderr.puts "-" * 80
  $stderr.puts "Checking for option passed from EY client"
  if config[:initial] == 'true'
    $stderr.puts "Seeding the data"
    run "cd #{config.release_path}"
    run "bundle exec rake db:seed"
  else
    $stderr.puts "Skipping the Seeding process"
  end
  $stderr.puts "-" * 80
  $stderr.flush
end

Now if you execute the following command

ey deploy -e my_app_staging --config=initial:true

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s