0
votes

Hi I'm using AWS OpsWorks to deploy a Ruby on Rails application which uses a MySQL database. I've properly booted an app server and a database server, but visiting the app server's IP address yeilds the following error:

The page you were looking for doesn't exist.

You may have mistyped the address or the page may have moved.

The logs say:

cat /var/log/httpd/error.log

App 4689 stdout: 
App 4689 stderr: /usr/local/lib/ruby/gems/2.2.0/gems/bundler-1.5.3/lib/bundler/spec_set.rb:92:in `block in materialize'
App 4689 stderr: : 
App 4689 stderr: Could not find rake-10.4.2 in any of the sources
App 4689 stderr:  (
App 4689 stderr: Bundler::GemNotFound
App 4689 stderr: )
App 4689 stderr:    from /usr/local/lib/ruby/gems/2.2.0/gems/bundler-1.5.3/lib/bundler/spec_set.rb:85:in `map!'
App 4689 stderr:    from /usr/local/lib/ruby/gems/2.2.0/gems/bundler-1.5.3/lib/bundler/spec_set.rb:85:in `materialize'
App 4689 stderr:    from /usr/local/lib/ruby/gems/2.2.0/gems/bundler-1.5.3/lib/bundler/definition.rb:133:in `specs'
App 4689 stderr:    from /usr/local/lib/ruby/gems/2.2.0/gems/bundler-1.5.3/lib/bundler/definition.rb:178:in `specs_for'
App 4689 stderr:    from /usr/local/lib/ruby/gems/2.2.0/gems/bundler-1.5.3/lib/bundler/definition.rb:167:in `requested_specs'
App 4689 stderr:    from /usr/local/lib/ruby/gems/2.2.0/gems/bundler-1.5.3/lib/bundler/environment.rb:18:in `requested_specs'
App 4689 stderr:    from /usr/local/lib/ruby/gems/2.2.0/gems/bundler-1.5.3/lib/bundler/runtime.rb:13:in `setup'
App 4689 stderr:    from /usr/local/lib/ruby/gems/2.2.0/gems/bundler-1.5.3/lib/bundler.rb:119:in `setup'
App 4689 stderr:    from /usr/local/lib/ruby/gems/2.2.0/gems/bundler-1.5.3/lib/bundler/setup.rb:17:in `<top (required)>'
App 4689 stderr:    from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'
App 4689 stderr:    from /usr/share/ruby/vendor_ruby/2.0/rubygems/core_ext/kernel_require.rb:55:in `require'

I've read this is an installation or path or permissions error, and have seen other solutions which use rbenv to uninstall/re-install rake, but OpsWorks doesn't use rbenv.

Please advise.

1

1 Answers

0
votes

It seems like OpsWork/Agent installation was broken. Rake/Bundler gems are installed by default. As we don’t know instance/stack etc. In general it seems Setup phase was not successful.

Ex in an OpsWorks instance:

[root@rails-app2 ~]# su - deploy Last login: Thu Jun 18 00:39:20 UTC 2015

[deploy@rails-app2 ~]$ which rake /usr/local/bin/rake

[deploy@rails-app2 ~]$ which bundler /usr/local/bin/bundler

[deploy@rails-app2 ~]$ which bundle /usr/local/bin/bundle

[deploy@rails-app2 ~]$ gem list

* LOCAL GEMS *

bigdecimal (1.2.4)
bundler (1.5.3)
io-console (0.4.3)
json (1.8.1)
kgio (2.9.3)
minitest (4.7.5)
psych (2.0.5)
rack (1.6.2)
raindrops (0.13.0)
rake (10.1.0)
rdoc (4.1.0)
test-unit (2.1.8.0)
unicorn (4.7.0)
[deploy@rails-app2 ~]$ logout

[root@rails-app2 ~]# opsworks-agent-cli instance

AWS OpsWorks Instance Agent State Report:

Last activity was a "configure" on 2016-01-12 18:01:12 UTC Agent Status: The AWS OpsWorks agent is running as PID 23871 Agent Version: 3431-20151222151215, up to date OpsWorks Stack: MyWebApps OpsWorks Layers: rails-app OpsWorks Instance: rails-app2 EC2 Instance ID: i-bxxxx06b EC2 Instance Type: c3.large Architecture: x86_64 Total Memory: 3.84 Gb CPU: 2x Intel(R) Xeon(R) CPU E5-2680 v2 @ 2.80GHz

Location:

EC2 Region: ap-southeast-2 EC2 Availability Zone: ap-southeast-2a

Networking:

Public IP: 54.x.x.232 Private IP: 10.x.x.73

[root@rails-app2 ~]#

  • I'd suggest creating new instance.

  • Also, usually with Rails there is problem migrating db. So one can manually login into the instance and manually do what OpsWorks does and see if there is problem connecting to the DB or other DB/App related issues.

Ex: su deploy -c "bundle exec rake RAILS_ENV=production db:migrate"

HTH!