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
I'm trying to install the production stack on my azure cloud (VM) but I'm getting the following Error:
TASK: [edxlocal | install mysql 56 and dependencies] **************************
failed: [localhost] => (item=software-properties-common,mysql-server) => {"failed": true, "item": "software-properties-common,mysql-server"}
stderr: E: Unable to correct problems, you have held broken packages.
stdout: Reading package lists...
Building dependency tree...
Reading state information...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
mysql-server : Depends: mysql-server-5.6 but it is not going to be installed
msg: '/usr/bin/apt-get -y -o "Dpkg::Options::=--force-confdef" -o "Dpkg::Options::=--force-confold" --force-yes install 'mysql-server'' failed: E: Unable to correct problems, you have held broken packages.
FATAL: all hosts have already failed -- aborting
PLAY RECAP ********************************************************************
to retry, use: --limit #/root/edx_sandbox.retry
localhost : ok=43 changed=6 unreachable=0 failed=1
Any Help will be appreciated
do "sudo su -" before installing, and It will be installed success
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.
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.