OpsWorks deploy error - Chef::Exceptions::ChildConvergeError - mysql
I'm trying to deploy first RailsApp 4 using OpsWorks and Mysql, following this tutorial: http://ruby.awsblog.com/post/Tx7FQMT084INCR/Deploying-Ruby-on-Rails-Applications-to-AWS-OpsWorks
I followed all as they mention in the tutorial but when I try to deploy the application I get this error:
[2015-01-20T13:36:41+00:00] INFO: Starting chef-zero on port 8889 with repository at repository at /opt/aws/opsworks/current
One version per cookbook
data_bags at /var/lib/aws/opsworks/data/data_bags
nodes at /var/lib/aws/opsworks/data/nodes
[2015-01-20T13:36:41+00:00] INFO: Forking chef instance to converge...
[2015-01-20T13:36:41+00:00] INFO: *** Chef 11.10.4 ***
[2015-01-20T13:36:41+00:00] INFO: Chef-client pid: 2367
[2015-01-20T13:36:41+00:00] INFO: Setting the run_list to ["opsworks_custom_cookbooks::load", "opsworks_custom_cookbooks::execute"] from JSON
[2015-01-20T13:36:41+00:00] WARN: Run List override has been provided.
[2015-01-20T13:36:41+00:00] WARN: Original Run List: [recipe[opsworks_custom_cookbooks::load], recipe[opsworks_custom_cookbooks::execute]]
[2015-01-20T13:36:41+00:00] WARN: Overridden Run List: [recipe[opsworks_custom_cookbooks::load], recipe[opsworks_custom_cookbooks::execute]]
[2015-01-20T13:36:41+00:00] INFO: Run List is [recipe[opsworks_custom_cookbooks::load], recipe[opsworks_custom_cookbooks::execute]]
[2015-01-20T13:36:41+00:00] INFO: Run List expands to [opsworks_custom_cookbooks::load, opsworks_custom_cookbooks::execute]
[2015-01-20T13:36:41+00:00] INFO: Starting Chef Run for rails-app.localdomain
[2015-01-20T13:36:41+00:00] INFO: Running start handlers
[2015-01-20T13:36:41+00:00] INFO: Start handlers complete.
[2015-01-20T13:36:41+00:00] INFO: HTTP Request Returned 404 Not Found: Object not found: /reports/nodes/rails-app.localdomain/runs
[2015-01-20T13:36:46+00:00] INFO: Loading cookbooks [apache2, dependencies, deploy, gem_support, mod_php5_apache2, mysql, nginx, opsworks_agent_monit, opsworks_aws_flow_ruby, opsworks_berkshelf, opsworks_bundler, opsworks_commons, opsworks_custom_cookbooks, opsworks_initial_setup, opsworks_java, opsworks_nodejs, opsworks_rubygems, packages, passenger_apache2, php, rails, ruby, scm_helper, ssh_users, unicorn]
[2015-01-20T13:36:47+00:00] INFO: Not needed with Chef 11.x (x >= 8) anymore.
[2015-01-20T13:36:47+00:00] INFO: Processing directory[/opt/aws/opsworks/current/site-cookbooks] action delete (opsworks_custom_cookbooks::load line 4)
[2015-01-20T13:36:47+00:00] INFO: Processing ruby_block[merge all cookbooks sources] action run (opsworks_custom_cookbooks::load line 12)
[2015-01-20T13:36:47+00:00] INFO: ruby_block[merge all cookbooks sources] called
[2015-01-20T13:36:47+00:00] WARN: Skipping final node save because override_runlist was given
[2015-01-20T13:36:47+00:00] INFO: Chef Run complete in 5.208526833 seconds
[2015-01-20T13:36:47+00:00] INFO: Running report handlers
[2015-01-20T13:36:47+00:00] INFO: Report handlers complete
---
[2015-01-20T13:36:47+00:00] INFO: Starting chef-zero on port 8889 with repository at repository at /opt/aws/opsworks/current
One version per cookbook
data_bags at /var/lib/aws/opsworks/data/data_bags
nodes at /var/lib/aws/opsworks/data/nodes
[2015-01-20T13:36:47+00:00] INFO: Forking chef instance to converge...
[2015-01-20T13:36:47+00:00] INFO: *** Chef 11.10.4 ***
[2015-01-20T13:36:47+00:00] INFO: Chef-client pid: 2507
[2015-01-20T13:36:48+00:00] INFO: Setting the run_list to ["opsworks_custom_cookbooks::load", "opsworks_custom_cookbooks::execute"] from JSON
[2015-01-20T13:36:48+00:00] WARN: Run List override has been provided.
[2015-01-20T13:36:48+00:00] WARN: Original Run List: [recipe[opsworks_custom_cookbooks::load], recipe[opsworks_custom_cookbooks::execute]]
[2015-01-20T13:36:48+00:00] WARN: Overridden Run List: [recipe[deploy::default], recipe[opsworks_stack_state_sync], recipe[deploy::rails], recipe[test_suite], recipe[opsworks_cleanup]]
[2015-01-20T13:36:48+00:00] INFO: Run List is [recipe[deploy::default], recipe[opsworks_stack_state_sync], recipe[deploy::rails], recipe[test_suite], recipe[opsworks_cleanup]]
[2015-01-20T13:36:48+00:00] INFO: Run List expands to [deploy::default, opsworks_stack_state_sync, deploy::rails, test_suite, opsworks_cleanup]
[2015-01-20T13:36:48+00:00] INFO: Starting Chef Run for rails-app.localdomain
[2015-01-20T13:36:48+00:00] INFO: Running start handlers
[2015-01-20T13:36:48+00:00] INFO: Start handlers complete.
[2015-01-20T13:36:48+00:00] INFO: HTTP Request Returned 404 Not Found: Object not found: /reports/nodes/rails-app.localdomain/runs
[2015-01-20T13:36:53+00:00] INFO: Loading cookbooks [apache2, dependencies, deploy, gem_support, mod_php5_apache2, mysql, nginx, opsworks_agent_monit, opsworks_aws_flow_ruby, opsworks_bundler, opsworks_cleanup, opsworks_commons, opsworks_initial_setup, opsworks_java, opsworks_nodejs, opsworks_rubygems, opsworks_stack_state_sync, packages, passenger_apache2, php, rails, ruby, scm_helper, ssh_users, test_suite, unicorn]
[2015-01-20T13:36:53+00:00] INFO: Removing cookbooks/agent_version/templates/default/TARGET_VERSION.erb from the cache; its cookbook is no longer needed on this client.
[2015-01-20T13:36:53+00:00] INFO: Removing cookbooks/agent_version/recipes/default.rb from the cache; its cookbook is no longer needed on this client.
[2015-01-20T13:36:53+00:00] INFO: Removing cookbooks/agent_version/attributes/default.rb from the cache; its cookbook is no longer needed on this client.
[2015-01-20T13:36:53+00:00] INFO: Removing cookbooks/agent_version/attributes/customize.rb from the cache; its cookbook is no longer needed on this client.
[2015-01-20T13:36:53+00:00] INFO: Removing cookbooks/agent_version/metadata.rb from the cache; its cookbook is no longer needed on this client.
[2015-01-20T13:36:53+00:00] INFO: Removing cookbooks/opsworks_ganglia/recipes/monitor-mysql.rb from the cache; its cookbook is no longer needed on this client.
[2015-01-20T13:36:53+00:00] INFO: Removing cookbooks/opsworks_ganglia/recipes/configure-client.rb from the cache; its cookbook is no longer needed on this client.
[2015-01-20T13:36:53+00:00] INFO: Removing cookbooks/opsworks_ganglia/recipes/monitor-haproxy.rb from the cache; its cookbook is no longer needed on this client.
[2015-01-20T13:36:53+00:00] INFO: Removing cookbooks/opsworks_ganglia/recipes/views.rb from the cache; its cookbook is no longer needed on this client.
[2015-01-20T13:36:53+00:00] INFO: Removing cookbooks/opsworks_ganglia/recipes/monitor-fd-and-sockets.rb from the cache; its cookbook is no longer needed on this client.
[2015-01-20T13:36:53+00:00] INFO: Removing cookbooks/opsworks_ganglia/recipes/server.rb from the cache; its cookbook is no longer needed on this client.
[2015-01-20T13:36:53+00:00] INFO: Removing cookbooks/opsworks_ganglia/recipes/bind-mount-data.rb from the cache; its cookbook is no longer needed on this client.
[2015-01-20T13:36:53+00:00] INFO: Removing cookbooks/opsworks_ganglia/recipes/deploy.rb from the cache; its cookbook is no longer needed on this client.
[2015-01-20T13:36:53+00:00] INFO: Removing cookbooks/opsworks_ganglia/recipes/configure-server.rb from the cache; its cookbook is no longer needed on this client.
[2015-01-20T13:36:53+00:00] INFO: Removing
..... removed some code for stackoverflow body limitation
file[/home/deploy/.ssh/config] action touch (deploy::rails line 16)
[2015-01-20T13:36:54+00:00] INFO: file[/home/deploy/.ssh/config] updated atime and mtime to 2015-01-20 13:36:54 +0000
[2015-01-20T13:36:54+00:00] INFO: Processing execute[echo 'StrictHostKeyChecking no' > /home/deploy/.ssh/config] action run (deploy::rails line 23)
[2015-01-20T13:36:54+00:00] INFO: Processing template[/home/deploy/.ssh/id_dsa] action create (deploy::rails line 27)
[2015-01-20T13:36:54+00:00] INFO: Processing directory[/srv/www/ariadna/shared/cached-copy] action delete (deploy::rails line 48)
[2015-01-20T13:36:54+00:00] INFO: directory[/srv/www/ariadna/shared/cached-copy] deleted /srv/www/ariadna/shared/cached-copy recursively
[2015-01-20T13:36:54+00:00] INFO: Processing ruby_block[change HOME to /home/deploy for source checkout] action run (deploy::rails line 56)
[2015-01-20T13:36:54+00:00] INFO: ruby_block[change HOME to /home/deploy for source checkout] called
[2015-01-20T13:36:54+00:00] INFO: Processing deploy[/srv/www/ariadna] action deploy (deploy::rails line 65)
[2015-01-20T13:36:56+00:00] INFO: deploy[/srv/www/ariadna] cloning repo git#bitbucket.org:viktorpr7/ariadna.git to /srv/www/ariadna/shared/cached-copy
[2015-01-20T13:36:59+00:00] INFO: deploy[/srv/www/ariadna] checked out branch: master onto: deploy reference: 438d556fa34ec3590ba1fecca64fd31241379516
[2015-01-20T13:36:59+00:00] INFO: deploy[/srv/www/ariadna] synchronizing git submodules
[2015-01-20T13:36:59+00:00] INFO: deploy[/srv/www/ariadna] enabling git submodules
[2015-01-20T13:36:59+00:00] INFO: deploy[/srv/www/ariadna] set user to deploy
[2015-01-20T13:36:59+00:00] INFO: deploy[/srv/www/ariadna] set group to www-data
[2015-01-20T13:36:59+00:00] INFO: deploy[/srv/www/ariadna] copied the cached checkout to /srv/www/ariadna/releases/20150120133654
[2015-01-20T13:36:59+00:00] INFO: deploy[/srv/www/ariadna] set user to deploy
[2015-01-20T13:36:59+00:00] INFO: deploy[/srv/www/ariadna] set group to www-data
[2015-01-20T13:36:59+00:00] INFO: deploy[/srv/www/ariadna] running callback before_migrate
[2015-01-20T13:36:59+00:00] INFO: deploy[/srv/www/ariadna] created directories before symlinking: tmp,public,config
[2015-01-20T13:36:59+00:00] INFO: deploy[/srv/www/ariadna] linked shared paths into current release: system => public/system, pids => tmp/pids, log => log
[2015-01-20T13:36:59+00:00] INFO: deploy[/srv/www/ariadna] made pre-migration symlinks
[2015-01-20T13:36:59+00:00] INFO: deploy[/srv/www/ariadna] set user to deploy
[2015-01-20T13:36:59+00:00] INFO: deploy[/srv/www/ariadna] set group to www-data
[2015-01-20T13:36:59+00:00] INFO: Gemfile detected. Running bundle install.
[2015-01-20T13:36:59+00:00] INFO: sudo su - deploy -c 'cd /srv/www/ariadna/releases/20150120133654 && /usr/local/bin/bundle install --path /home/deploy/.bundler/ariadna --without=test development'
[2015-01-20T13:37:00+00:00] INFO:
Using rake (10.4.2)
Using i18n (0.7.0)
Using minitest (4.7.5)
Using multi_json (1.10.1)
Using thread_safe (0.3.4)
Using tzinfo (0.3.42)
Using activesupport (4.0.1)
Using builder (3.1.4)
Using erubis (2.7.0)
Using rack (1.5.2)
Using rack-test (0.6.3)
Using actionpack (4.0.1)
Using mime-types (1.25.1)
Using polyglot (0.3.5)
Using treetop (1.4.15)
Using mail (2.5.4)
Using actionmailer (4.0.1)
Using activemodel (4.0.1)
Using activerecord-deprecated_finders (1.0.3)
Using arel (4.0.2)
Using activerecord (4.0.1)
Using acts_as_tree (2.1.0)
Using addressable (2.3.6)
Using bcrypt (3.1.7)
Using bcrypt-ruby (3.1.5)
Using coffee-script-source (1.8.0)
Using execjs (2.2.2)
Using coffee-script (2.3.0)
Using thor (0.19.1)
Using railties (4.0.1)
Using coffee-rails (4.0.1)
Using orm_adapter (0.5.0)
Using warden (1.2.3)
Using devise (3.2.3)
Using dragonfly (1.0.7)
Using json (1.8.2)
Using rdoc (4.2.0)
Using rest-client (1.6.8)
Using geo_ip (0.5.0)
Using tilt (1.4.1)
Using haml (4.0.5)
Using haml-rails (0.5.3)
Using hike (1.2.3)
Using jbuilder (1.5.3)
Using jquery-rails (3.1.2)
Using kgio (2.9.2)
Using mysql2 (0.3.14)
Using nprogress-rails (0.1.6.5)
Using paranoia (2.0.4)
Using bundler (1.5.3)
Using sprockets (2.12.3)
Using sprockets-rails (2.0.1)
Using rails (4.0.1)
Using raindrops (0.13.0)
Using sass (3.2.19)
Using sass-rails (4.0.5)
Using sdoc (0.4.1)
Using simple_form (3.1.0)
Using stringex (2.5.2)
Using themes_on_rails (0.3.0)
Using turbolinks (2.5.3)
Using uglifier (2.7.0)
Using unicorn (4.8.3)
Your bundle is complete!
Gems in the groups test and development were not installed.
It was installed into /home/deploy/.bundler/ariadna
[2015-01-20T13:37:00+00:00] INFO: Processing template[/srv/www/ariadna/shared/config/database.yml] action create (/var/lib/aws/opsworks/cache.stage2/cookbooks/deploy/definitions/opsworks_deploy.rb line 115)
[2015-01-20T13:37:00+00:00] INFO: deploy[/srv/www/ariadna] queueing checkdeploy hook /srv/www/ariadna/releases/20150120133654/deploy/before_migrate.rb
[2015-01-20T13:37:00+00:00] INFO: Processing template[/srv/www/ariadna/shared/config/database.yml] action create (/var/lib/aws/opsworks/cache.stage2/cookbooks/deploy/definitions/opsworks_deploy.rb line 115)
[2015-01-20T13:37:00+00:00] INFO: deploy[/srv/www/ariadna] made pre-migration symlinks
[2015-01-20T13:37:00+00:00] INFO: deploy[/srv/www/ariadna] set user to deploy
[2015-01-20T13:37:00+00:00] INFO: deploy[/srv/www/ariadna] set group to www-data
[2015-01-20T13:37:00+00:00] INFO: deploy[/srv/www/ariadna] migrating deploy
================================================================================
Error executing action `deploy` on resource 'deploy[/srv/www/ariadna]'
================================================================================
Chef::Exceptions::Exec
----------------------
if [ -f Gemfile ]; then echo 'OpsWorks: Gemfile found - running migration with bundle exec' && /usr/local/bin/bundle exec /usr/local/bin/rake db:migrate; else echo 'OpsWorks: no Gemfile - running plain migrations' && /usr/local/bin/rake db:migrate; fi returned 1, expected 0
Cookbook Trace:
---------------
/var/lib/aws/opsworks/cache.stage2/cookbooks/opsworks_commons/libraries/monkey_patch_deploy_provider.rb:45:in `block in migrate'
/var/lib/aws/opsworks/cache.stage2/cookbooks/opsworks_commons/libraries/monkey_patch_deploy_provider.rb:39:in `migrate'
Resource Declaration:
---------------------
# In /var/lib/aws/opsworks/cache.stage2/cookbooks/deploy/definitions/opsworks_deploy.rb
65: deploy deploy[:deploy_to] do
66: provider Chef::Provider::Deploy.const_get(deploy[:chef_provider])
67: keep_releases deploy[:keep_releases]
68: repository deploy[:scm][:repository]
69: user deploy[:user]
70: group deploy[:group]
71: revision deploy[:scm][:revision]
72: migrate deploy[:migrate]
73: migration_command deploy[:migrate_command]
74: environment deploy[:environment].to_hash
75: purge_before_symlink(deploy[:purge_before_symlink]) unless deploy[:purge_before_symlink].nil?
76: create_dirs_before_symlink(deploy[:create_dirs_before_symlink])
77: symlink_before_migrate(deploy[:symlink_before_migrate])
78: symlinks(deploy[:symlinks]) unless deploy[:symlinks].nil?
79: action deploy[:action]
80:
81: if deploy[:application_type] == 'rails' && node[:opsworks][:instance][:layers].include?('rails-app')
82: restart_command "sleep #{deploy[:sleep_before_restart]} && #{node[:opsworks][:rails_stack][:restart_command]}"
83: end
84:
Compiled Resource:
------------------
# Declared in /var/lib/aws/opsworks/cache.stage2/cookbooks/deploy/definitions/opsworks_deploy.rb:65:in `block in from_file'
deploy("/srv/www/ariadna") do
params {:deploy_data=>{"deploy_to"=>"/srv/www/ariadna", "chef_provider"=>"Timestamped", "keep_releases"=>5, "current_path"=>"/srv/www/ariadna/current", "document_root"=>"public", "ignore_bundler_groups"=>["test", "development"], "absolute_document_root"=>"/srv/www/ariadna/current/public/", "rake"=>"/usr/local/bin/rake", "migrate"=>true, "migrate_command"=>"if [ -f Gemfile ]; then echo 'OpsWorks: Gemfile found - running migration with bundle exec' && /usr/local/bin/bundle exec /usr/local/bin/rake db:migrate; else echo 'OpsWorks: no Gemfile - running plain migrations' && /usr/local/bin/rake db:migrate; fi", "rails_env"=>"production", "action"=>"deploy", "user"=>"deploy", "group"=>"www-data", "shell"=>"/bin/bash", "home"=>"/home/deploy", "sleep_before_restart"=>0, "stack"=>{"needs_reload"=>true}, "enable_submodules"=>true, "shallow_clone"=>false, "delete_cached_copy"=>true, "purge_before_symlink"=>["log", "tmp/pids", "public/system"], "create_dirs_before_symlink"=>["tmp", "public", "config"], "symlink_before_migrate"=>{"config/database.yml"=>"config/database.yml", "config/memcached.yml"=>"config/memcached.yml"}, "symlinks"=>{"system"=>"public/system", "pids"=>"tmp/pids", "log"=>"log"}, "environment"=>{"RAILS_ENV"=>"production", "RUBYOPT"=>"", "RACK_ENV"=>"production", "HOME"=>"/home/deploy"}, "environment_variables"=>{}, "ssl_support"=>false, "auto_npm_install_on_deploy"=>true, "nodejs"=>{"restart_command"=>"monit restart node_web_app_ariadna", "stop_command"=>"monit stop node_web_app_ariadna", "port"=>80}, "application"=>"ariadna", "application_type"=>"rails", "auto_bundle_on_deploy"=>true, "deploying_user"=>"arn:aws:iam::673556511701:root", "domains"=>["ariadna"], "mounted_at"=>nil, "restart_command"=>nil, "ssl_certificate"=>nil, "ssl_certificate_key"=>nil, "ssl_certificate_ca"=>nil, "scm"=>{"scm_type"=>"git", "repository"=>"git#bitbucket.org:viktorpr7/ariadna.git", "revision"=>"master", "ssh_key"=>"...................", "user"=>nil, "password"=>nil}, "database"=>{"host"=>"172.31.23.102", "database"=>"ariadna_production", "port"=>3306, "username"=>"root", "password"=>"13m3i60f6r", "reconnect"=>true, "data_source_provider"=>"stack", "type"=>"mysql", "adapter"=>"mysql2"}, "memcached"=>{"host"=>nil, "port"=>11211}}, :app=>"ariadna", :name=>nil}
provider Chef::Provider::Deploy::Timestamped
action [:deploy]
updated true
updated_by_last_action true
retries 0
retry_delay 2
deploy_to "/srv/www/ariadna"
environment {"RAILS_ENV"=>"production", "RUBYOPT"=>"", "RACK_ENV"=>"production", "HOME"=>"/home/deploy", "LC_ALL"=>"C"}
repository_cache "cached-copy"
purge_before_symlink ["log", "tmp/pids", "public/system"]
create_dirs_before_symlink ["tmp", "public", "config"]
symlink_before_migrate {"config/database.yml"=>"config/database.yml", "config/memcached.yml"=>"config/memcached.yml"}
symlinks {"system"=>"public/system", "pids"=>"tmp/pids", "log"=>"log"}
revision "master"
migrate true
remote "origin"
enable_submodules true
scm_provider Chef::Provider::Git
keep_releases 5
enable_checkout true
checkout_branch "deploy"
cookbook_name "deploy"
recipe_name "rails"
repo "git#bitbucket.org:viktorpr7/ariadna.git"
user "deploy"
group "www-data"
migration_command "if [ -f Gemfile ]; then echo 'OpsWorks: Gemfile found - running migration with bundle exec' && /usr/local/bin/bundle exec /usr/local/bin/rake db:migrate; else echo 'OpsWorks: no Gemfile - running plain migrations' && /usr/local/bin/rake db:migrate; fi"
restart_command "sleep 0 && ../../shared/scripts/unicorn clean-restart"
before_migrate #<Proc:0x007ff79d1c63c0#/var/lib/aws/opsworks/cache.stage2/cookbooks/deploy/definitions/opsworks_deploy.rb:100>
shared_path "/srv/www/ariadna/shared"
destination "/srv/www/ariadna/shared/cached-copy"
current_path "/srv/www/ariadna/current"
end
[2015-01-20T13:37:01+00:00] INFO: Running queued delayed notifications before re-raising exception
[2015-01-20T13:37:01+00:00] ERROR: Running exception handlers
[2015-01-20T13:37:01+00:00] ERROR: Exception handlers complete
[2015-01-20T13:37:01+00:00] FATAL: Stacktrace dumped to /var/lib/aws/opsworks/cache.stage2/chef-stacktrace.out
[2015-01-20T13:37:01+00:00] ERROR: deploy[/srv/www/ariadna] (deploy::rails line 65) had an error: Chef::Exceptions::Exec: if [ -f Gemfile ]; then echo 'OpsWorks: Gemfile found - running migration with bundle exec' && /usr/local/bin/bundle exec /usr/local/bin/rake db:migrate; else echo 'OpsWorks: no Gemfile - running plain migrations' && /usr/local/bin/rake db:migrate; fi returned 1, expected 0
[2015-01-20T13:37:01+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
Someone knows the origin of this error?
Chef::Exceptions::Exec
----------------------
if [ -f Gemfile ]; then echo 'OpsWorks: Gemfile found - running migration with bundle exec' && /usr/local/bin/bundle exec /usr/local/bin/rake db:migrate; else echo 'OpsWorks: no Gemfile - running plain migrations' && /usr/local/bin/rake db:migrate; fi returned 1, expected 0
The error is due to the migration command, so something goes wrong inside it.
I had this exact issue.
In the spirit of treating servers as cattle instead of pets, the best way to go forward is to kill that existing server, and spin a new instance from your layer. It would eliminate any factors outside your Chef Recipes (anything outside shouldn't really be your concern - it should be Amazon's!)
Works for me most of the times. If this doesn't work, then you are 100% sure it is something in your recipes.
Had a similar issue that was caused by environment variables containing certain characters ('\\'). These seem not to be correctly escaped when passed on to bundle exec by the run_command during deploy.
The migration command failed with the following error:
/usr/local/bin/bundle:23:in `load'
/usr/local/bin/bundle:23:in `<main>'
Psych::SyntaxError: (<unknown>): found unknown escape character while parsing a quoted scalar at line 230 column 22
/home/deploy/.bundler/optisure_staging/ruby/2.3.0/gems/config-1.0.0/lib/config/sources/yaml_source.rb:16:in `load'
/home/deploy/.bundler/optisure_staging/ruby/2.3.0/gems/config-1.0.0/lib/config/options.rb:50:in `block in reload!'
/home/deploy/.bundler/optisure_staging/ruby/2.3.0/gems/config-1.0.0/lib/config/options.rb:49:in `each'
The pain in identifying this was to get opsworks/chef to log this information. Ended up editing the monkey_patch_deploy_provider.rb in the cookbooks cache on the machine to set the log level.
Related
npm command not found pm2: command not found
NVM node is installed under Ubuntu19.04 but local pm2 deploy production update will report errors such as pm2: command not found On the remote server root#vultr:/usr/bin# git --version git version 2.20.1 root#vultr:/usr/bin# nvm --version 0.34.0 root#vultr:/usr/bin# node -v v10.15.3 root#vultr:/usr/bin# npm -v 6.4.1 On the local server pm2 deploy production update --> Deploying to production environment --> on host 202.182.98.13 ○ deploying origin/master ○ executing pre-deploy-local ○ hook pre-deploy ○ fast forward master Already on 'master' Your branch is up to date with 'origin/master'. From github.com:zq0904/pm2 Updating d79b633..2fe1d22 Fast-forward README.md | 3 ++- ecosystem.config.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) * branch master -> FETCH_HEAD d79b633..2fe1d22 master -> origin/master ○ executing post-deploy `git pull && npm install && pm2 reload ecosystem.config.js --env production` Already up to date. npm WARN 06-pm2#1.0.0 No repository field. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.9 (node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"}) up to date in 3.997s pm2: command not found post-deploy hook failed Deploy failed 1 I can do it on a remote server whereis npm lh -s /root/.nvm/versions/node/v10.15.3/bin/node /usr/bin/node lh -s /root/.nvm/versions/node/v10.15.3/bin/npm /usr/bin/npm lh -s /root/.nvm/versions/node/v10.15.3/bin/pm2 /usr/bin/pm2 That would solve the problem, But I don't understand why, The server can already output NPM node pm2 and other versions, But why do I have to set up a soft connection? Is there any good solution to this troublesome problem, Thank you very much!
I am not sure what's the route cause of this issue. But, it was happening to me when I created a new user in AWS EC2 ubuntu instance and try to deploy my NodeJS app using pm2 through that new user. I followed this github thread and this particular comment solved my issue. Simply comment the following line in your server's .bashrc file #If not running interactively, don 't do anything case $ - in * i * );; *) return;; esac
heroku mysqltopostgres installation error
I am trying to deploy my php app that uses mysql db to heroku. I followed instructions here - https://devcenter.heroku.com/articles/heroku-mysql The sudo gem install mysqltopostgres-0.3.0.gem command executed without errors: gem build mysqltopostgres.gemspec Successfully built RubyGem Name: mysqltopostgres Version: 0.3.0 File: mysqltopostgres-0.3.0.gem but when I try to execute the mysqltopostgres command, the following errors occur mysqltopostgres /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:34:in 'block in setup': You have already activated test-unit 2.5.5, but your Gemfile requires test-unit 3.2.1. Prepending 'bundle exec' to your command may solve this. (Gem::LoadError) from /usr/lib/ruby/vendor_ruby/bundler/runtime.rb:19:in 'setup' from /usr/lib/ruby/vendor_ruby/bundler.rb:92:in 'setup' from /usr/lib/ruby/vendor_ruby/bundler/setup.rb:8:in '' from /usr/local/lib/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in 'require' from /usr/local/lib/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in 'require' from /var/lib/gems/2.3.0/gems/mysqltopostgres-0.3.0/bin/mysqltopostgres:5:in '' from /usr/local/bin/mysqltopostgres:22:in 'load' from /usr/local/bin/mysqltopostgres:22:in '' I then tried to prepend bundle exec: bundle exec mysqltopostgres /usr/local/lib/site_ruby/2.3.0/rubygems.rb:270:in 'find_spec_for_exe': can't find gem mysqltopostgres (>= 0.a) (Gem::GemNotFoundException) from /usr/local/lib/site_ruby/2.3.0/rubygems.rb:298:in 'activate_bin_path' from /usr/local/bin/mysqltopostgres:22:in '' Has anyone ever come across these errors? And I am new to Heroku, and I was building my app on my local apache and now I want to deploy it to heroku.
chef cookbook install chrome centos7
I am trying to install chrome on my centos 7 desktop using chefdk and local mode. chrome installs fine using yum directly, I am using this as a learning exercise in chef. So far it is failing on a dependency check for apt on both centos 7.2 and macosx 10.11.5. Details for centos only appear below. Base cookbooks, eg yum and apt install fine, so I am missing something here. Thanks for any help. CentOS Linux release 7.2.1511 (Core) Installed: yum-3.4.3-132.el7.centos.0.1.noarch using chefdk.x86_64 0.15.15-1.el7 #/chefdk-0.15.15-1.el7.x86_64 knife cookbook show chrome chrome 1.2.2 When I try to install: sudo sudo chef-client --local-mode --runlist 'recipe[chrome]' 2>&1 | tee /export/cookbooks/install_chrome_from_cookbook.2.log it tries to use apt and fails because of an apt version failure : see log below. What could the problem be? cat /export/cookbooks/install_chrome_from_cookbook.2.log ` [2016-06-28T00:35:35-04:00] WARN: No config file found or specified on command line, using command line options. > [2016-06-28T00:35:35-04:00] INFO: Auto-discovered chef repository at /export > [2016-06-28T00:35:36-04:00] INFO: Started chef-zero at chefzero://localhost:8889 with repository at /export > One version per cookbook > [2016-06-28T00:35:36-04:00] INFO: Forking chef instance to converge... > [2016-06-28T00:35:36-04:00] INFO: *** Chef 12.11.18 *** > [2016-06-28T00:35:36-04:00] INFO: Platform: x86_64-linux > [2016-06-28T00:35:36-04:00] INFO: Chef-client pid: 7293 > [2016-06-28T00:35:38-04:00] INFO: GET /organizations/chef/nodes/nuctv-w.lfz.net > [2016-06-28T00:35:38-04:00] INFO: Setting the run_list to [#<Chef::RunList::RunListItem:0x00000004e13468 #version=nil, #type=:recipe, #name="chrome">] from CLI options > [2016-06-28T00:35:38-04:00] INFO: Run List is [recipe[chrome]] > [2016-06-28T00:35:38-04:00] INFO: Run List expands to [chrome] > [2016-06-28T00:35:38-04:00] INFO: Starting Chef Run for nuctv-w.lfz.net > [2016-06-28T00:35:38-04:00] INFO: Running start handlers > [2016-06-28T00:35:38-04:00] INFO: Start handlers complete. > [2016-06-28T00:35:38-04:00] INFO: POST /organizations/chef/reports/nodes/nuctv-w.lfz.net/runs > --- POST BODY --- > {"action":"start","run_id":"8532d8c8-2e83-45e3-b867-f55f264a93df","start_time":"2016-06-28 00:35:38 -0400"} > --- END POST BODY --- > [2016-06-28T00:35:38-04:00] INFO: HTTP Request Returned 404 Not Found: Object not found: > [2016-06-28T00:35:38-04:00] INFO: POST /organizations/chef/environments/_default/cookbook_versions > --- POST BODY --- > {"run_list":["chrome"]} > --- END POST BODY --- > [2016-06-28T00:35:39-04:00] INFO: #<ChefZero::RestErrorResponse: 412: Could not satisfy version constraints for: apt> > /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-zero-4.6.2/lib/chef_zero/endpoints/environment_cookbook_versions_endpoint.rb:42:in `post' > .... > /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/chef-12.11.18/bin/chef-client:26:in `<top (required)>' > /bin/chef-client:52:in `load' > /bin/chef-client:52:in `<main>' > [2016-06-28T00:35:39-04:00] INFO: HTTP Request Returned 412 Precondition Failed: Could not satisfy version constraints for: apt > ================================================================================ > Error Resolving Cookbooks for Run List: > ================================================================================ > Missing Cookbooks: ------------------ Could not satisfy version constraints for: apt Expanded Run List: ------------------ * chrome Platform: --------- x86_64-linux [2016-06-28T00:35:39-04:00] ERROR: Running exception handlers [2016-06-28T00:35:39-04:00] ERROR: Exception handlers complete [2016-06-28T00:35:39-04:00] FATAL: Stacktrace dumped to /root/.chef/local-mode-cache/cache/chef-stacktrace.out [2016-06-28T00:35:39-04:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report [2016-06-28T00:35:39-04:00] ERROR: 412 "Precondition Failed" [2016-06-28T00:35:40-04:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)`
Chef dependencies are always required, even if they won't be used. If you use the more modern cookbook upload tools like Berkshelf or chef push it will take care of this for you.
Problems deploying in OpsWorks
I created a new Rails application and I have done this: I changed the "sqlite3" gem to "mysql2" and I added "unicorn". I pushed the application to bitbucket I have created the Stack, the Rails Layer and initialise the Instance in OpsWorks, also I have created the App (Ruby on rails type) and linked it to the bitbucket repository. Then when I try to do the first deploy I get the below error: [2015-01-22T00:11:16+00:00] INFO: Starting chef-zero on port 8889 with repository at repository at /opt/aws/opsworks/current One version per cookbook data_bags at /var/lib/aws/opsworks/data/data_bags nodes at /var/lib/aws/opsworks/data/nodes [2015-01-22T00:11:17+00:00] INFO: Forking chef instance to converge... [2015-01-22T00:11:17+00:00] INFO: *** Chef 11.10.4 *** [2015-01-22T00:11:17+00:00] INFO: Chef-client pid: 3826 [2015-01-22T00:11:17+00:00] INFO: Setting the run_list to ["opsworks_custom_cookbooks::load", "opsworks_custom_cookbooks::execute"] from JSON [2015-01-22T00:11:17+00:00] WARN: Run List override has been provided. [2015-01-22T00:11:17+00:00] WARN: Original Run List: [recipe[opsworks_custom_cookbooks::load], recipe[opsworks_custom_cookbooks::execute]] [2015-01-22T00:11:17+00:00] WARN: Overridden Run List: [recipe[opsworks_custom_cookbooks::load], recipe[opsworks_custom_cookbooks::execute]] [2015-01-22T00:11:17+00:00] INFO: Run List is [recipe[opsworks_custom_cookbooks::load], recipe[opsworks_custom_cookbooks::execute]] [2015-01-22T00:11:17+00:00] INFO: Run List expands to [opsworks_custom_cookbooks::load, opsworks_custom_cookbooks::execute] [2015-01-22T00:11:17+00:00] INFO: Starting Chef Run for rails-app1.localdomain [2015-01-22T00:11:17+00:00] INFO: Running start handlers [2015-01-22T00:11:17+00:00] INFO: Start handlers complete. [2015-01-22T00:11:17+00:00] INFO: HTTP Request Returned 404 Not Found: Object not found: /reports/nodes/rails-app1.localdomain/runs [2015-01-22T00:11:22+00:00] INFO: Loading cookbooks [apache2, dependencies, deploy, gem_support, mod_php5_apache2, mysql, nginx, opsworks_agent_monit, opsworks_aws_flow_ruby, opsworks_berkshelf, opsworks_bundler, opsworks_commons, opsworks_custom_cookbooks, opsworks_initial_setup, opsworks_java, opsworks_nodejs, opsworks_rubygems, packages, passenger_apache2, php, rails, ruby, scm_helper, ssh_users, unicorn] [2015-01-22T00:11:23+00:00] INFO: Not needed with Chef 11.x (x >= 8) anymore. [2015-01-22T00:11:23+00:00] INFO: Processing directory[/opt/aws/opsworks/current/site-cookbooks] action delete (opsworks_custom_cookbooks::load line 4) [2015-01-22T00:11:23+00:00] INFO: Processing ruby_block[merge all cookbooks sources] action run (opsworks_custom_cookbooks::load line 12) [2015-01-22T00:11:23+00:00] INFO: ruby_block[merge all cookbooks sources] called [2015-01-22T00:11:23+00:00] WARN: Skipping final node save because override_runlist was given [2015-01-22T00:11:23+00:00] INFO: Chef Run complete in 5.728910816 seconds [2015-01-22T00:11:23+00:00] INFO: Running report handlers [2015-01-22T00:11:23+00:00] INFO: Report handlers complete --- [2015-01-22T00:11:23+00:00] INFO: Starting chef-zero on port 8889 with repository at repository at /opt/aws/opsworks/current One version per cookbook data_bags at /var/lib/aws/opsworks/data/data_bags nodes at /var/lib/aws/opsworks/data/nodes [2015-01-22T00:11:24+00:00] INFO: Forking chef instance to converge... [2015-01-22T00:11:24+00:00] INFO: *** Chef 11.10.4 *** [2015-01-22T00:11:24+00:00] INFO: Chef-client pid: 3971 [2015-01-22T00:11:24+00:00] INFO: Setting the run_list to ["opsworks_custom_cookbooks::load", "opsworks_custom_cookbooks::execute"] from JSON [2015-01-22T00:11:24+00:00] WARN: Run List override has been provided. [2015-01-22T00:11:24+00:00] WARN: Original Run List: [recipe[opsworks_custom_cookbooks::load], recipe[opsworks_custom_cookbooks::execute]] [2015-01-22T00:11:24+00:00] WARN: Overridden Run List: [recipe[deploy::default], recipe[opsworks_stack_state_sync], recipe[deploy::rails], recipe[test_suite], recipe[opsworks_cleanup]] [2015-01-22T00:11:24+00:00] INFO: Run List is [recipe[deploy::default], recipe[opsworks_stack_state_sync], recipe[deploy::rails], recipe[test_suite], recipe[opsworks_cleanup]] [2015-01-22T00:11:24+00:00] INFO: Run List expands to [deploy::default, opsworks_stack_state_sync, deploy::rails, test_suite, opsworks_cleanup] [2015-01-22T00:11:24+00:00] INFO: Starting Chef Run for rails-app1.localdomain [2015-01-22T00:11:24+00:00] INFO: Running start handlers [2015-01-22T00:11:24+00:00] INFO: Start handlers complete. [2015-01-22T00:11:24+00:00] INFO: HTTP Request Returned 404 Not Found: Object not found: /reports/nodes/rails-app1.localdomain/runs [2015-01-22T00:11:29+00:00] INFO: Loading cookbooks [apache2, dependencies, deploy, gem_support, mod_php5_apache2, mysql, nginx, opsworks_agent_monit, opsworks_aws_flow_ruby, opsworks_bundler, opsworks_cleanup, opsworks_commons, opsworks_initial_setup, opsworks_java, opsworks_nodejs, opsworks_rubygems, opsworks_stack_state_sync, packages, passenger_apache2, php, rails, ruby, scm_helper, ssh_users, test_suite, unicorn] ...removed some code for stackoverflow body limitation [2015-01-22T00:11:32+00:00] INFO: file[/home/deploy/.ssh/config] updated atime and mtime to 2015-01-22 00:11:32 +0000 [2015-01-22T00:11:32+00:00] INFO: Processing execute[echo 'StrictHostKeyChecking no' > /home/deploy/.ssh/config] action run (deploy::rails line 23) [2015-01-22T00:11:32+00:00] INFO: execute[echo 'StrictHostKeyChecking no' > /home/deploy/.ssh/config] ran successfully [2015-01-22T00:11:32+00:00] INFO: Processing template[/home/deploy/.ssh/id_dsa] action create (deploy::rails line 27) [2015-01-22T00:11:32+00:00] INFO: template[/home/deploy/.ssh/id_dsa] created file /home/deploy/.ssh/id_dsa [2015-01-22T00:11:32+00:00] INFO: template[/home/deploy/.ssh/id_dsa] updated file contents /home/deploy/.ssh/id_dsa [2015-01-22T00:11:32+00:00] INFO: template[/home/deploy/.ssh/id_dsa] owner changed to 4000 [2015-01-22T00:11:32+00:00] INFO: template[/home/deploy/.ssh/id_dsa] group changed to 497 [2015-01-22T00:11:32+00:00] INFO: template[/home/deploy/.ssh/id_dsa] mode changed to 600 [2015-01-22T00:11:32+00:00] INFO: Processing directory[/srv/www/ariadna/shared/cached-copy] action delete (deploy::rails line 48) [2015-01-22T00:11:32+00:00] INFO: Processing ruby_block[change HOME to /home/deploy for source checkout] action run (deploy::rails line 56) [2015-01-22T00:11:32+00:00] INFO: ruby_block[change HOME to /home/deploy for source checkout] called [2015-01-22T00:11:32+00:00] INFO: Processing deploy[/srv/www/ariadna] action deploy (deploy::rails line 65) [2015-01-22T00:11:34+00:00] INFO: deploy[/srv/www/ariadna] cloning repo git#bitbucket.org:viktorpr7/ariadna-beta.git to /srv/www/ariadna/shared/cached-copy [2015-01-22T00:11:36+00:00] INFO: deploy[/srv/www/ariadna] checked out branch: master onto: deploy reference: 6450219b5689de565864424e4fe48da22700e088 [2015-01-22T00:11:36+00:00] INFO: deploy[/srv/www/ariadna] synchronizing git submodules [2015-01-22T00:11:36+00:00] INFO: deploy[/srv/www/ariadna] enabling git submodules [2015-01-22T00:11:36+00:00] INFO: deploy[/srv/www/ariadna] set user to deploy [2015-01-22T00:11:36+00:00] INFO: deploy[/srv/www/ariadna] set group to nginx [2015-01-22T00:11:36+00:00] INFO: deploy[/srv/www/ariadna] copied the cached checkout to /srv/www/ariadna/releases/20150122001132 [2015-01-22T00:11:36+00:00] INFO: deploy[/srv/www/ariadna] set user to deploy [2015-01-22T00:11:36+00:00] INFO: deploy[/srv/www/ariadna] set group to nginx [2015-01-22T00:11:36+00:00] INFO: deploy[/srv/www/ariadna] running callback before_migrate [2015-01-22T00:11:36+00:00] INFO: deploy[/srv/www/ariadna] created directories before symlinking: tmp,public,config [2015-01-22T00:11:36+00:00] INFO: deploy[/srv/www/ariadna] linked shared paths into current release: system => public/system, pids => tmp/pids, log => log [2015-01-22T00:11:36+00:00] INFO: deploy[/srv/www/ariadna] made pre-migration symlinks [2015-01-22T00:11:36+00:00] INFO: deploy[/srv/www/ariadna] set user to deploy [2015-01-22T00:11:36+00:00] INFO: deploy[/srv/www/ariadna] set group to nginx [2015-01-22T00:11:36+00:00] INFO: Gemfile detected. Running bundle install. [2015-01-22T00:11:36+00:00] INFO: sudo su - deploy -c 'cd /srv/www/ariadna/releases/20150122001132 && /usr/local/bin/bundle install --path /home/deploy/.bundler/ariadna --without=test development' ================================================================================ Error executing action `deploy` on resource 'deploy[/srv/www/ariadna]' ================================================================================ Mixlib::ShellOut::ShellCommandFailed ------------------------------------ Expected process to exit with [0], but received '5' ---- Begin output of sudo su - deploy -c 'cd /srv/www/ariadna/releases/20150122001132 && /usr/local/bin/bundle install --path /home/deploy/.bundler/ariadna --without=test development' 2>&1 ---- STDOUT: Fetching gem metadata from https://rubygems.org/........... Installing rake (10.4.2) Installing i18n (0.7.0) Installing json (1.8.2) Installing minitest (5.5.1) Installing thread_safe (0.3.4) Installing tzinfo (1.2.2) Installing activesupport (4.1.9) Installing builder (3.2.2) Installing erubis (2.7.0) Installing actionview (4.1.9) Installing rack (1.5.2) Installing rack-test (0.6.3) Installing actionpack (4.1.9) Installing mime-types (2.4.3) Installing mail (2.6.3) Installing actionmailer (4.1.9) Installing activemodel (4.1.9) Installing arel (5.0.1.20140414130214) Installing activerecord (4.1.9) Installing coffee-script-source (1.8.0) Installing execjs (2.2.2) Installing coffee-script (2.3.0) Installing thor (0.19.1) Installing railties (4.1.9) Installing coffee-rails (4.0.1) Installing hike (1.2.3) Installing multi_json (1.10.1) Installing jbuilder (2.2.6) Installing jquery-rails (3.1.2) Installing kgio (2.9.2) Gem::Ext::BuildError: ERROR: Failed to build gem native extension. /usr/local/bin/ruby extconf.rb checking for ruby/thread.h... yes checking for rb_thread_call_without_gvl() in ruby/thread.h... yes checking for rb_thread_blocking_region()... yes checking for rb_wait_for_single_fd()... yes checking for rb_hash_dup()... yes checking for rb_intern3()... yes checking for mysql_query() in -lmysqlclient... no checking for main() in -lm... yes checking for mysql_query() in -lmysqlclient... no checking for main() in -lz... yes checking for mysql_query() in -lmysqlclient... no checking for main() in -lsocket... no checking for mysql_query() in -lmysqlclient... no checking for main() in -lnsl... yes checking for mysql_query() in -lmysqlclient... no checking for main() in -lmygcc... no checking for mysql_query() in -lmysqlclient... no *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/usr/local/bin/ruby --with-mysql-dir --without-mysql-dir --with-mysql-include --without-mysql-include=${mysql-dir}/include --with-mysql-lib --without-mysql-lib=${mysql-dir}/lib --with-mysql-config --without-mysql-config --with-mysql-dir --without-mysql-dir --with-mysql-include --without-mysql-include=${mysql-dir}/include --with-mysql-lib --without-mysql-lib=${mysql-dir}/lib --with-mysqlclientlib --without-mysqlclientlib --with-mlib --without-mlib --with-mysqlclientlib --without-mysqlclientlib --with-zlib --without-zlib --with-mysqlclientlib --without-mysqlclientlib --with-socketlib --without-socketlib --with-mysqlclientlib --without-mysqlclientlib --with-nsllib --without-nsllib --with-mysqlclientlib --without-mysqlclientlib --with-mygcclib --without-mygcclib --with-mysqlclientlib --without-mysqlclientlib extconf failed, exit code 1 Gem files will remain installed in /home/deploy/.bundler/ariadna/ruby/2.1.0/gems/mysql2-0.3.16 for inspection. Results logged to /home/deploy/.bundler/ariadna/ruby/2.1.0/extensions/x86_64-linux/2.1.0/mysql2-0.3.16/gem_make.out An error occurred while installing mysql2 (0.3.16), and Bundler cannot continue. Make sure that `gem install mysql2 -v '0.3.16'` succeeds before bundling. STDERR: ---- End output of sudo su - deploy -c 'cd /srv/www/ariadna/releases/20150122001132 && /usr/local/bin/bundle install --path /home/deploy/.bundler/ariadna --without=test development' 2>&1 ---- Ran sudo su - deploy -c 'cd /srv/www/ariadna/releases/20150122001132 && /usr/local/bin/bundle install --path /home/deploy/.bundler/ariadna --without=test development' 2>&1 returned 5 Cookbook Trace: --------------- /var/lib/aws/opsworks/cache.stage2/cookbooks/opsworks_commons/libraries/shellout.rb:8:in `shellout' /var/lib/aws/opsworks/cache.stage2/cookbooks/rails/libraries/rails_configuration.rb:41:in `bundle' /var/lib/aws/opsworks/cache.stage2/cookbooks/deploy/definitions/opsworks_deploy.rb:105:in `block (3 levels) in from_file' Resource Declaration: --------------------- # In /var/lib/aws/opsworks/cache.stage2/cookbooks/deploy/definitions/opsworks_deploy.rb 65: deploy deploy[:deploy_to] do 66: provider Chef::Provider::Deploy.const_get(deploy[:chef_provider]) 67: keep_releases deploy[:keep_releases] 68: repository deploy[:scm][:repository] 69: user deploy[:user] 70: group deploy[:group] 71: revision deploy[:scm][:revision] 72: migrate deploy[:migrate] 73: migration_command deploy[:migrate_command] 74: environment deploy[:environment].to_hash 75: purge_before_symlink(deploy[:purge_before_symlink]) unless deploy[:purge_before_symlink].nil? 76: create_dirs_before_symlink(deploy[:create_dirs_before_symlink]) 77: symlink_before_migrate(deploy[:symlink_before_migrate]) 78: symlinks(deploy[:symlinks]) unless deploy[:symlinks].nil? 79: action deploy[:action] 80: 81: if deploy[:application_type] == 'rails' && node[:opsworks][:instance][:layers].include?('rails-app') 82: restart_command "sleep #{deploy[:sleep_before_restart]} && #{node[:opsworks][:rails_stack][:restart_command]}" 83: end 84: Compiled Resource: ------------------ # Declared in /var/lib/aws/opsworks/cache.stage2/cookbooks/deploy/definitions/opsworks_deploy.rb:65:in `block in from_file' deploy("/srv/www/ariadna") do params {:deploy_data=>{"deploy_to"=>"/srv/www/ariadna", "chef_provider"=>"Timestamped", "keep_releases"=>5, "current_path"=>"/srv/www/ariadna/current", "document_root"=>"public", "ignore_bundler_groups"=>["test", "development"], "absolute_document_root"=>"/srv/www/ariadna/current/public/", "rake"=>"/usr/local/bin/rake", "migrate"=>true, "migrate_command"=>"if [ -f Gemfile ]; then echo 'OpsWorks: Gemfile found - running migration with bundle exec' && /usr/local/bin/bundle exec /usr/local/bin/rake db:migrate; else echo 'OpsWorks: no Gemfile - running plain migrations' && /usr/local/bin/rake db:migrate; fi", "rails_env"=>"production", "action"=>"deploy", "user"=>"deploy", "group"=>"nginx", "shell"=>"/bin/bash", "home"=>"/home/deploy", "sleep_before_restart"=>0, "stack"=>{"needs_reload"=>true}, "enable_submodules"=>true, "shallow_clone"=>false, "delete_cached_copy"=>true, "purge_before_symlink"=>["log", "tmp/pids", "public/system"], "create_dirs_before_symlink"=>["tmp", "public", "config"], "symlink_before_migrate"=>{"config/database.yml"=>"config/database.yml", "config/memcached.yml"=>"config/memcached.yml"}, "symlinks"=>{"system"=>"public/system", "pids"=>"tmp/pids", "log"=>"log"}, "environment"=>{"RAILS_ENV"=>"production", "RUBYOPT"=>"", "RACK_ENV"=>"production", "HOME"=>"/home/deploy"}, "environment_variables"=>{}, "ssl_support"=>false, "auto_npm_install_on_deploy"=>true, "nodejs"=>{"restart_command"=>"monit restart node_web_app_ariadna", "stop_command"=>"monit stop node_web_app_ariadna", "port"=>80}, "application"=>"ariadna", "application_type"=>"rails", "auto_bundle_on_deploy"=>true, "deploying_user"=>"arn:aws:iam::673556511701:root", "domains"=>["ariadna"], "mounted_at"=>nil, "restart_command"=>nil, "ssl_certificate"=>nil, "ssl_certificate_key"=>nil, "ssl_certificate_ca"=>nil, "scm"=>{"scm_type"=>"git", "repository"=>"git#bitbucket.org:viktorpr7/ariadna-beta.git", "revision"=>"master", "ssh_key"=>"-----BEGIN RSA PRIVATE KEY-----\nMIIEpQIBAAKCAQEA56JKs1w7Bvvq4eRElpPcIQCLTIKD6JrnyuKA2RbNrRxTWX8k\n3rtk9MQabphAfc6yN/Upe4bOqakeiGjTNEnrOGM1qKa2YALFSH9ZfuulfMI4+hLd\ns9vsD5mlMi92ZmitwiAlqe0jhXQyO+6OfHIASY0kuThfCZnRMyHiRzUEeacpatSh\nE8Ygy2SIQBrYQ9XuhwMCWMIuT1IbgdUi5B4JLrj74hfFimW5aH1wRBqPkprfHVfg\n8YPGWKU+rLZMO9IA7OtpCUvXQGryyMQsOB5b/w3aCg4GlWmRVtcGONd8kW0vourg\nGJO7VDGZ3Y1m8PEryjncWTQwyv+XKu6+i5tmTQIDAQABAoIBAAbOqC9ZOIreAGsf\nEDz0n3WA1JctBr9hPgqiWXMHzoeV24U3zVeWXkMrODOj2dFYr7ghRlTRA2XNCI6t\ntfdFbNo9YChSre1oZ2/X/kNSnYxrEM2YnFda0TcsJsSwzGP6E5Eu7Kxvwal8XrWQ\nLzPNDeEbesbOt0xK7vD3v/SjxDvm9WqKVbf14eCqN1EYxOSTq4SqWq9+NvogAG09\ny2xyfSK5G5QsbJ41CGLxBSsk1SRyFvgXgHUPI05Gqz4EV8mKhp5nD9n7KYtbOH5I\nD7XvnlTLQNclB2db6+1zp0YWGbHgMoIZScPUI6XE653uXUNg5TuDV+lHnQVouANC\nqS+0BUECgYEA86tf65jH4f1uDN140LjDgmCMgb4IjpyfNDZ7M6iXtvpLJn8w2MRo\nuYOUDqEOWpYY6uYs4tEPgdmO786G3JgxAgzHWCgK9go+IS6BMjIRT77LjtJCHwF0\nZEF5q14zKDycuCcJiI80Oteo2p9xUQ0bZfAiQqgyOdLQF/2++zjMHdkCgYEA81sA\nxSAhW3EscvhJgeoqmdRWKBnw2u8t6YWKOm6TqxlIC3JR85nn622hU0KMkVPNy4S6\nvKgVlNtV6CoA8NnRW0NXEpoj93kQZPEdwrrol8KS5AVOF2B5qD+wMwNl4xafgHuk\nN8DyDA//ZDarNlssnrhBJbRCyehFGzmXYS5+35UCgYEAzk9+0pq0Oqr6P9hRD+Aw\nYTZgIQYGdsEzpuCuJcoMUrfPY1PzxsVdqh03Ab/pyFcn19N1k8HQ8G+FL5Pc6e/O\nJt8s9X5J8ZIwkqWubBKqR6vS7CUoKNpxcuVhH/CNPfc79kvPLZmabmvkot628ho3\n5XKRf4CrrfvJh1aoGks3v9kCgYEArwJkJF+9/X//YlMyse5QYr50k3RMZXaawxTZ\nWrpJEkQlLq4xR4oIYqQ93529b4ogNtumW6RZmOq/9i227X8H86UTCnq1oPR8mMta\nBr/aI8G3V6qFBYTJGPlsYtNvw4dyf7jrWXk12PzsQwqZyIZ7KU4C8/WWDpQulqyt\nNCN29J0CgYEAyUPOorkU1iwlg6pBgBKm5GVq8YGb8INzODrox+u8MJRFHT6BujY1\nQnF3sy84OWW9x79PQmzvYSpjVsD3GtIcvd4mDQ5GdB+XJaldO//3LhQl9yNG/OAd\nodNSsgut3SfHUR5uCb06Q+FJo8CHus/r1vzNpfL9er01RpXhVZOYUoY=\n-----END RSA PRIVATE KEY-----", "user"=>nil, "password"=>nil}, "database"=>{}, "memcached"=>{"host"=>nil, "port"=>11211}}, :app=>"ariadna", :name=>nil} provider Chef::Provider::Deploy::Timestamped action [:deploy] updated true updated_by_last_action true retries 0 retry_delay 2 deploy_to "/srv/www/ariadna" environment {"RAILS_ENV"=>"production", "RUBYOPT"=>"", "RACK_ENV"=>"production", "HOME"=>"/home/deploy"} repository_cache "cached-copy" purge_before_symlink ["log", "tmp/pids", "public/system"] create_dirs_before_symlink ["tmp", "public", "config"] symlink_before_migrate {"config/database.yml"=>"config/database.yml", "config/memcached.yml"=>"config/memcached.yml"} symlinks {"system"=>"public/system", "pids"=>"tmp/pids", "log"=>"log"} revision "master" migrate true remote "origin" enable_submodules true scm_provider Chef::Provider::Git keep_releases 5 enable_checkout true checkout_branch "deploy" cookbook_name "deploy" recipe_name "rails" repo "git#bitbucket.org:viktorpr7/ariadna-beta.git" user "deploy" group "nginx" migration_command "if [ -f Gemfile ]; then echo 'OpsWorks: Gemfile found - running migration with bundle exec' && /usr/local/bin/bundle exec /usr/local/bin/rake db:migrate; else echo 'OpsWorks: no Gemfile - running plain migrations' && /usr/local/bin/rake db:migrate; fi" restart_command "sleep 0 && ../../shared/scripts/unicorn clean-restart" before_migrate #<Proc:0x007f21fcfabcc8#/var/lib/aws/opsworks/cache.stage2/cookbooks/deploy/definitions/opsworks_deploy.rb:100> shared_path "/srv/www/ariadna/shared" destination "/srv/www/ariadna/shared/cached-copy" current_path "/srv/www/ariadna/current" end [2015-01-22T00:12:05+00:00] INFO: Running queued delayed notifications before re-raising exception [2015-01-22T00:12:05+00:00] ERROR: Running exception handlers [2015-01-22T00:12:05+00:00] ERROR: Exception handlers complete [2015-01-22T00:12:05+00:00] FATAL: Stacktrace dumped to /var/lib/aws/opsworks/cache.stage2/chef-stacktrace.out [2015-01-22T00:12:05+00:00] ERROR: deploy[/srv/www/ariadna] (deploy::rails line 65) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '5' ---- Begin output of sudo su - deploy -c 'cd /srv/www/ariadna/releases/20150122001132 && /usr/local/bin/bundle install --path /home/deploy/.bundler/ariadna --without=test development' 2>&1 ---- STDOUT: Fetching gem metadata from https://rubygems.org/........... Installing rake (10.4.2) Installing i18n (0.7.0) Installing json (1.8.2) Installing minitest (5.5.1) Installing thread_safe (0.3.4) Installing tzinfo (1.2.2) Installing activesupport (4.1.9) Installing builder (3.2.2) Installing erubis (2.7.0) Installing actionview (4.1.9) Installing rack (1.5.2) Installing rack-test (0.6.3) Installing actionpack (4.1.9) Installing mime-types (2.4.3) Installing mail (2.6.3) Installing actionmailer (4.1.9) Installing activemodel (4.1.9) Installing arel (5.0.1.20140414130214) Installing activerecord (4.1.9) Installing coffee-script-source (1.8.0) Installing execjs (2.2.2) Installing coffee-script (2.3.0) Installing thor (0.19.1) Installing railties (4.1.9) Installing coffee-rails (4.0.1) Installing hike (1.2.3) Installing multi_json (1.10.1) Installing jbuilder (2.2.6) Installing jquery-rails (3.1.2) Installing kgio (2.9.2) Gem::Ext::BuildError: ERROR: Failed to build gem native extension. /usr/local/bin/ruby extconf.rb checking for ruby/thread.h... yes checking for rb_thread_call_without_gvl() in ruby/thread.h... yes checking for rb_thread_blocking_region()... yes checking for rb_wait_for_single_fd()... yes checking for rb_hash_dup()... yes checking for rb_intern3()... yes checking for mysql_query() in -lmysqlclient... no checking for main() in -lm... yes checking for mysql_query() in -lmysqlclient... no checking for main() in -lz... yes checking for mysql_query() in -lmysqlclient... no checking for main() in -lsocket... no checking for mysql_query() in -lmysqlclient... no checking for main() in -lnsl... yes checking for mysql_query() in -lmysqlclient... no checking for main() in -lmygcc... no checking for mysql_query() in -lmysqlclient... no *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/usr/local/bin/ruby --with-mysql-dir --without-mysql-dir --with-mysql-include --without-mysql-include=${mysql-dir}/include --with-mysql-lib --without-mysql-lib=${mysql-dir}/lib --with-mysql-config --without-mysql-config --with-mysql-dir --without-mysql-dir --with-mysql-include --without-mysql-include=${mysql-dir}/include --with-mysql-lib --without-mysql-lib=${mysql-dir}/lib --with-mysqlclientlib --without-mysqlclientlib --with-mlib --without-mlib --with-mysqlclientlib --without-mysqlclientlib --with-zlib --without-zlib --with-mysqlclientlib --without-mysqlclientlib --with-socketlib --without-socketlib --with-mysqlclientlib --without-mysqlclientlib --with-nsllib --without-nsllib --with-mysqlclientlib --without-mysqlclientlib --with-mygcclib --without-mygcclib --with-mysqlclientlib --without-mysqlclientlib extconf failed, exit code 1 Gem files will remain installed in /home/deploy/.bundler/ariadna/ruby/2.1.0/gems/mysql2-0.3.16 for inspection. Results logged to /home/deploy/.bundler/ariadna/ruby/2.1.0/extensions/x86_64-linux/2.1.0/mysql2-0.3.16/gem_make.out An error occurred while installing mysql2 (0.3.16), and Bundler cannot continue. Make sure that `gem install mysql2 -v '0.3.16'` succeeds before bundling. STDERR: ---- End output of sudo su - deploy -c 'cd /srv/www/ariadna/releases/20150122001132 && /usr/local/bin/bundle install --path /home/deploy/.bundler/ariadna --without=test development' 2>&1 ---- Ran sudo su - deploy -c 'cd /srv/www/ariadna/releases/20150122001132 && /usr/local/bin/bundle install --path /home/deploy/.bundler/ariadna --without=test development' 2>&1 returned 5 [2015-01-22T00:12:05+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1) Updated: I'm using Ubuntu 14.04, I added the libmysqlclient-dev but still the same error when I try deploy, here you can see the Layer configuration: I needed to restart the instance
You'll need to intall the relevent OS packages. Steps: Log into Opsworks Click Layers on the left sidebar. Find and click Recipes within the Rails App Server (or whatever your server is). Click the Edit button. From there towards the bottom you will have to add the packages you need. I think it'll be: mysql-devel mysql Edit The correct package, as you added later in your question, is libmysqlclient-dev. This should fix your issue.
You need to install the mysql client libraries. The exact package name varies based on OS but something like package 'mysql-client-dev'.
redmine installation fail ubuntu 14.04
I got error while installing redmine on ubuntu 14.04. I don't understand why I get this error. Below is are stack I get apt-get install redmine redmine-mysql Reading package lists... Done Building dependency tree Reading state information... Done redmine is already the newest version. redmine-mysql is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded. 1 not fully installed or removed. After this operation, 0 B of additional disk space will be used. Do you want to continue? [Y/n] y Setting up redmine (2.4.2-1) ... dbconfig-common: writing config to /etc/dbconfig-common/redmine/instances/defaul t.conf Creating config file /etc/redmine/default/database.yml.new with new version granting access to database redmine_default for redmine_default#localhost: alrea dy exists. creating database redmine_default: already exists. dbconfig-common: flushing administrative password Replacing config file /etc/redmine/default/session.yml with new version A new secret session key has been generated in /etc/redmine/default/session.yml Populating database for redmine instance "default". This may take a while. rake aborted! Server is running in --secure-auth mode, but 'redmine_default'#'localhost' has a password in the old format; please change the password to the new format /var/lib/gems/1.9.1/gems/mysql2-0.3.16/lib/mysql2/client.rb:70:in `connect' /var/lib/gems/1.9.1/gems/mysql2-0.3.16/lib/mysql2/client.rb:70:in `initialize' Tasks: TOP => db:migrate => environment (See full trace by running task with --trace) Error when running rake db:migrate, check database configuration. dpkg: error processing package redmine (--configure): subprocess installed post-installation script returned error exit status 1 Errors were encountered while processing: redmine E: Sub-process /usr/bin/dpkg returned an error code (1) Errors were encountered while processing: redmine E: Sub-process /usr/bin/dpkg returned an error code (1)` Following is output of command dpkg -l redmine `Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad) ||/ Name Version Architecture Description +++-==============-============-============-================================= iF redmine 2.4.2-1 all flexible project management web a` Rails version install on my machine rails -v Rails 4.1.4 Ruby version install on my machine ruby -v ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux] apache2 version `apache2 -v Server version: Apache/2.4.7 (Ubuntu) Server built: Apr 3 2014 12:20:28` I am new to ubuntu and also linux. Can anyone identify why I get this error ?
The problem is the way the password is being passed to the MySQL server. You can set secure_auth: true in the database.yml file right under where the password is specified to use the appropriate format. Alternatively, you could disable secure auth in the mysql daemon config and restart.