Skip to content

Instantly share code, notes, and snippets.

@dingzj
Last active May 3, 2017 08:04
Show Gist options
  • Save dingzj/6633062 to your computer and use it in GitHub Desktop.
Save dingzj/6633062 to your computer and use it in GitHub Desktop.
content of deploy variable when using custom hook in AWS OpsWorks
before_restart.rb
node[:deploy].each do |application, deploy_item|
run "echo '#{deploy_item.to_json}' >> /tmp/logs.log"
end
## Note only current_path is availabe, no shared_path or release_path
{"home"=>"/home/deploy",
"application_type"=>"rails",
"mounted_at"=>nil,
"migrate_command"=>
"if [ -f Gemfile ]; then echo OpsWorks: Gemfile found - running migration with bundle exec && /usr/local/bin/bundle exec
"domains"=>["mydomain.com", "mydomain"],
"ssl_certificate_key"=>"of course certifcate key is here",
"deploying_user"=>"arn:aws:iam::aws-id-numbers-xxxxxxx:user/myname",
"deploy_to"=>"/srv/www/myapp",
"current_path"=>"/srv/www/myapp/current",
"document_root"=>"public",
"rake"=>"/usr/local/bin/rake",
"group"=>"www-data",
"shell"=>"/bin/bash",
"delete_cached_copy"=>true,
"environment"=>
{"HOME"=>"/home/deploy", "RAILS_ENV"=>"production", "RACK_ENV"=>"production", "RUBYOPT"=>""},
"ssl_support"=>false,
"auto_npm_install_on_deploy"=>true,
"absolute_document_root"=>"/srv/www/myapp/current/public/",
"enable_submodules"=>true,
"symlink_before_migrate"=>
{"config/memcached.yml"=>"config/memcached.yml",
"config/database.yml"=>"config/database.yml"}, #2 default yml files to be symlinked
"nodejs"=>
{"restart_command"=>"monit restart node_web_app_myapp",
"stop_command"=>"monit stop node_web_app_myapp"},
"scm"=> {"revision"=>"issue-xx", "password"=>nil, "user"=>nil,
"repository"=>"git@github.com:mydomain/myapp.git",
"scm_type"=>"git",
"ssh_key"=>"my ssh key rsa keys"},
"ignore_bundler_groups"=>["test", "development"],
"user"=>"deploy",
"ssl_certificate_ca"=>nil,
"auto_bundle_on_deploy"=>true,
"rails_env"=>"production",
"database"=>
{"password"=>nil,
"reconnect"=>true,
"username"=>"root",
"database"=>"db",
"adapter"=>"mysql2",
"host"=>nil},
"ssl_certificate"=>nil,
"restart_command"=>nil,
"symlinks"=>{"system"=>"public/system", "log"=>"log", "pids"=>"tmp/pids"},
"migrate"=>false,
"memcached"=>{"port"=>11211, "host"=>nil},
"shallow_clone"=>false,
"application"=>"singleops",
"action"=>"deploy",
"sleep_before_restart"=>0,
"stack"=>{"needs_reload"=>true}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment