Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms

RSS

vagrant-node-simple (9) Versions 0.1.6

A simple cookbook to deploy your NodeJS app on Vagrant Ubuntu

Berkshelf/Librarian
Policyfile
Knife
cookbook 'vagrant-node-simple', '= 0.1.6'
cookbook 'vagrant-node-simple', '= 0.1.6', :supermarket
knife cookbook site install vagrant-node-simple
knife cookbook site download vagrant-node-simple
README
Dependencies
Quality

Simple Chef Cookbook for NodeJS on Ubuntu 14.04 for Vagrant [complementary to OpsWorks NodeJS cookbook]

This recipe enables to deploy of a NodeJS app in your Vagrant box. It is complementary to Opsworks NodeJS cookebook for Opsworks deployment : recipes vagrant-node-simple::deploy,vagrant-node-simple::install,vagrant-node-simple:start are equivalent to opsworks_nodejs:default, deploy:nodejs, and parametrization of an Opsworks app is the same as the parametrization of the environment's JSON.

Usage :

Create your Chef repository with a Berksfile, a Vagrantfile and environments and roles directories :

  1. In the Berksfile
cookbook 'ark'
cookbook 'git'
cookbook 'apt', git: 'git://github.com/opscode-cookbooks/apt.git'
cookbook 'vagrant-node-simple', git: 'git://github.com/christopher5106/vagrant-node-simple.git'
  1. In environments/development.rb :
{
  "name": "development",
  "description": "The master development branch",
  "cookbook_versions": {},
  "json_class": "Chef::Environment",
  "chef_type": "environment",
  "default_attributes": {},
  "override_attributes":
  {
    "environment":"development",
    "nodejs":{
      "name":"YOUR_APP_NAME",
      "repo":"git@bitbucket.org:YOUR_ORG/YOUR_NODE_APP_REPO.git",
      "revision":"HEAD"
    }
  }
}
  1. In roles/nodejs_role.rb :
name "my node app"
description "The base role"
run_list "recipe[git]","recipe[apt]","recipe[ark]","recipe[vagrant-node-simple::deploy]","recipe[vagrant-node-simple::install]","recipe[vagrant-node-simple:start]"
  1. In the Vagrantfile
    VAGRANTFILE_API_VERSION = "2"

    Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
      config.vm.box = "ubuntu/trusty64"
      config.vm.network "forwarded_port", guest: 3000, host: 3000
      config.berkshelf.enabled = true;
      config.vm.provision :chef_solo do |chef|
        chef.cookbooks_path = "./"
        chef.roles_path = "roles"
        chef.environments_path = "environments"
        chef.environment = "development"
        chef.add_role("nodejs_role")
      end
    end
  1. Add your node app repository deploy key deploy.pem to your repository and give it the right permissions (chmod 600 ./deploy.pem).

  2. Commit your Chef repository.

You can Launch your instance with vagrant up command.

In Opsworks,

  • create a stack with your Chef repository, Chef and Berkshelf enabled (no need for a custom JSON, everything will be in the app settings.)

  • create a NodeJS layer (you can also create a custom layer and add the recipe "opsworks_nodejs" to the setup step, the recipe "opsworks_nodejs::configure" to the configure step, and the recipe to "deploy::nodejs" to the deploy step).

  • create an app with the link to your YOUR_NODE_APP_REPO.

Launch your instance in Opsworks. Opsworks will deploy the code corresponding to the Branch/Revision specified in the app configuration, to the HEAD if not specified.

You can configure a hook in Github so that committed code will be automatically deployed in Opsworks.

Note : for your NodeJS app to work with Opsworks cookbook, you need a server.js file at the root of your YOUR_NODE_APP_REPO. Link

Dependent cookbooks

git >= 0.0.0
apt >= 0.0.0

Contingent cookbooks

There are no cookbooks that are contingent upon this one.

Foodcritic Metric
            

0.1.6 failed this metric

FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/499889caa8ec94e010a8f543/vagrant-node-simple/attributes/default.rb:1
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/499889caa8ec94e010a8f543/vagrant-node-simple/attributes/default.rb:2
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/499889caa8ec94e010a8f543/vagrant-node-simple/attributes/default.rb:3
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/499889caa8ec94e010a8f543/vagrant-node-simple/recipes/deploy.rb:24
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/499889caa8ec94e010a8f543/vagrant-node-simple/recipes/deploy.rb:29
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/499889caa8ec94e010a8f543/vagrant-node-simple/recipes/deploy.rb:30
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/499889caa8ec94e010a8f543/vagrant-node-simple/recipes/deploy.rb:31
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/499889caa8ec94e010a8f543/vagrant-node-simple/recipes/start.rb:3
FC001: Use strings in preference to symbols to access node attributes: /tmp/cook/499889caa8ec94e010a8f543/vagrant-node-simple/recipes/start.rb:13
FC019: Access node attributes in a consistent manner: /tmp/cook/499889caa8ec94e010a8f543/vagrant-node-simple/attributes/default.rb:1
FC019: Access node attributes in a consistent manner: /tmp/cook/499889caa8ec94e010a8f543/vagrant-node-simple/attributes/default.rb:2
FC019: Access node attributes in a consistent manner: /tmp/cook/499889caa8ec94e010a8f543/vagrant-node-simple/attributes/default.rb:3