Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue when I try to start a default rails layer instance? #14

Closed
interpegasus opened this issue Apr 16, 2014 · 3 comments
Closed

Issue when I try to start a default rails layer instance? #14

interpegasus opened this issue Apr 16, 2014 · 3 comments

Comments

@interpegasus
Copy link

Hi,

Could you please help me to solve this issue when I try to start the rails layer instance? Thanks in advance.

Error executing action create on resource 'template[/srv/www/espn_testing/shared/config/application.yml]'

Chef::Mixin::Template::TemplateError

undefined method `sort' for nil:NilClass

Resource Declaration:

In /var/lib/aws/opsworks/cache/cookbooks/opsworks_custom_env/definitions/custom_env_template.rb

10: template "#{params[:deploy][:deploy_to]}/shared/config/application.yml" do
11: source "application.yml.erb"
12: owner params[:deploy][:user]
13: group params[:deploy][:group]
14: mode "0660"
15: variables :env => params[:env]
16: notifies :run, resources(:execute => "restart Rails app #{params[:application]} for custom env")
17:
18: only_if do
19: File.exists?("#{params[:deploy][:deploy_to]}/shared/config")
20: end
21: end
22:

Compiled Resource:

Declared in /var/lib/aws/opsworks/cache/cookbooks/opsworks_custom_env/definitions/custom_env_template.rb:10:in `block in from_file'

template("/srv/www/espn_testing/shared/config/application.yml") do
params {:application=>"espn_testing", :deploy=>{"deploy_to"=>"/srv/www/espn_testing", "chef_provider"=>"Timestamped", "keep_releases"=>5, "current_path"=>"/srv/www/espn_testing/current", "document_root"=>"public", "ignore_bundler_groups"=>["test", "development"], "absolute_document_root"=>"/srv/www/espn_testing/current/public/", "rake"=>"/usr/local/bin/rake", "migrate"=>false, "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"=>"development", "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, "symlink_before_migrate"=>{"config/database.yml"=>"config/database.yml", "config/memcached.yml"=>"config/memcached.yml"}, "environment"=>{"RAILS_ENV"=>"development", "RUBYOPT"=>"", "RACK_ENV"=>"development", "HOME"=>"/home/deploy"}, "ssl_support"=>false, "auto_npm_install_on_deploy"=>true, "nodejs"=>{"restart_command"=>"monit restart node_web_app_espn_testing", "stop_command"=>"monit stop node_web_app_espn_testing"}, "application"=>"espn_testing", "deploying_user"=>nil, "domains"=>["espn-testing.mobovivo.com", "espn_testing"], "application_type"=>"rails", "mounted_at"=>nil, "ssl_certificate"=>nil, "ssl_certificate_key"=>nil, "ssl_certificate_ca"=>nil, "restart_command"=>nil, "symlinks"=>{"system"=>"public/system", "pids"=>"tmp/pids", "log"=>"log"}, "database"=>{"host"=>nil, "database"=>"espn_testing", "username"=>"root", "password"=>nil, "reconnect"=>true}, "memcached"=>{"host"=>nil, "port"=>11211}, "auto_bundle_on_deploy"=>true, "scm"=>{"scm_type"=>"git", "repository"=>"git@github.com:mobovivo/espn.git", "revision"=>"master", "ssh_key"=>"-----BEGIN RSA PRIVATE KEY-----\nMIIEpAIBAAKCAQEArTKBrStG6x+VswYTAMgxvFNDF/apZHU2VR/5J+EjJ+B1B+6M\n5Oci8aZLZuYwEo0HN36DNNRiGb0Ouy+7qGHokfZZjEM57sjg23b8PG5aTVGh8u0g\niCLORFVVPyZcIJ4YZWzakqefHCjBhQUG9eM5FytirE6B30Pwt3F3PL0oR+tl7S4J\n43upxEbZkqnRYJCkTZ58bGD4S2NAaF3qlqYnB6x2we2gOUo3z8PwkaLHSVrz9ETT\n0pfi18rbYLjC8tybE4MjdInvn8HzFnYm3wSX79O2+xEVfg/Uss5mxP0Tfbwki/eE\nCl6+pUP3RVpvAXfJlo7vL/2mvkOwRxlREuNw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Wxpsi8V2US+Y\nB78eLQKBgQC6HW9rHQJXZyRqRmQ45gSZbMCnMOSAMhKXXOCD89bC2YPN5EEjrsIG\n1PgQ3HIPd6sImZ2KN3rrRiTa3AefjelEEUNzA8hyr58tS8HhmC89vVFTT0RStutL\nBPwmKJQpGMk/Iu55bkZvWibEoXZil6iPWScRxPNXpye+dLJPTBrHTQ==\n-----END RSA PRIVATE KEY-----", "user"=>nil, "password"=>nil}}, :env=>nil, :name=>nil}
provider Chef::Provider::Template
action "create"
retries 0
retry_delay 2
path "/srv/www/espn_testing/shared/config/application.yml"
backup 5
atomic_update true
source "application.yml.erb"
variables {:env=>nil}
cookbook_name "opsworks_custom_env"
recipe_name "write_config"
mode "0660"
owner "deploy"
group "www-data"
only_if { #code block }
end

Template Context:

on line #4
2: # stack's custom JSON and executing the opsworks_custom_env::configure recipe.
3:
4: <% @env.sort.each do |key, val| %>
5: <%= key.to_s %>: <%= (val && val.to_s.inspect) %>
6: <% end %>

@interpegasus
Copy link
Author

The issue was related with Figaro's setup. It is fixed. Thanks

@sainejob
Copy link

I'm seeing the same issue. Could you elaborate on how you fixed the issue? Thx!

@jwieringa
Copy link

I also had this issue. The resolution for me was to edit the Custom JSON in the OpsWorks Stack to reflect the short name of the OpsWorks App. The env variable was nil because when it did a look up in the Custom JSON, it couldn't find key that matched the short name.

A little tricky because when creating an App via the AWS console the short name is generated automatically. Via the SDK, you can set the short name when creating an app manually.

Make sure these match the short_name of the OpsWorks app:

rrioq

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants