Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8825341
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T06:51:18+00:00 2026-06-14T06:51:18+00:00

I’ve been playing with chef lately to deploy an application. I’m trying to build

  • 0

I’ve been playing with chef lately to deploy an application.
I’m trying to build on top of the application and application_php cookbooks provided by opscode. But I’m a bit new to chef and I don’t really understand how I’m suppose to do it.

I created a cookbook for my app. And the recipe looks something like this currently:

app = node.run_state[:current_app]

secrets = Chef::EncryptedDataBagItem.load("secrets", "my_app")

application "my_app" do
  path "/var/www/sites/my_app/current"
  owner node['my_app']['owner']
  group node['my_app']['group']
  repository "some repository here"
  if secrets["deploy_key"]
    ruby_block "write_key" do
      block do
        f = ::File.open("#{app['deploy_to']}/id_deploy", "w")
        f.print(secrets["deploy_key"])
        f.close
      end
      not_if do ::File.exists?("#{app['deploy_to']}/id_deploy"); end
    end

    file "#{app['deploy_to']}/id_deploy" do
      owner node['my_app']['owner']
      group node['my_app']['group']
      mode '0600'
    end

    template "#{app['deploy_to']}/deploy-ssh-wrapper" do
      source "deploy-ssh-wrapper.erb"
      owner node['my_app']['owner']
      group node['my_app']['group']
      mode "0755"
      variables app.to_hash
    end
  end
end

Role: my_app.json

{
    "name": "my_app",
    "chef_type": "role",
    "json_class": "Chef::Role",
    "default_attributes": {
    },
    "description": "Install my_app Web Server",
    "run_list": [
        "recipe[apache2]",
        "recipe[php]",
        "recipe[application]",
        "recipe[my_app]"
    ],
    "override_attributes": {
    }
}

But when I run knife bootstrap example.com -r role[my_app] … I get the following error:

================================================================================
Recipe Compile Error
================================================================================

Chef::Exceptions::RecipeNotFound
--------------------------------
could not find recipe my_app for cookbook application

[2012-11-12T15:22:10+00:00] ERROR: Running exception handlers
[2012-11-12T15:22:10+00:00] FATAL: Saving node information to /var/chef/cache/failed-run-data.json
[2012-11-12T15:22:10+00:00] ERROR: Exception handlers complete
[2012-11-12T15:22:10+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2012-11-12T15:22:10+00:00] FATAL: Chef::Exceptions::RecipeNotFound: could not find recipe my_app for cookbook application

Seems like doing something right.
Does anyone know how I should be extending application and application_php cookbooks?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T06:51:19+00:00Added an answer on June 14, 2026 at 6:51 am

    I realized I was doing it all wrong hehe. Seems like most of the tutorials I found online were using the deprecated method of doing things.

    The application stack takes care of everything for you. No need to make the deploy code.

    To make it work you need to remove application for the run list. To make use of application and application_php you need to define the dependency in metadata.rb.

    Then you can just create the recipe like so:

    secrets = Chef::EncryptedDataBagItem.load("secrets", "my_app")
    
    application "my_app" do
      path "/var/www/my_app"
      repository "repository url"
      revision "master"
      deploy_key secrets["deploy_key"]
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a French site that I want to parse, but am running into
I am trying to render a haml file in a javascript response like so:
This could be a duplicate question, but I have no idea what search terms

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.