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

Select Status

RSS

vagrant-node-simple (9) Versions 0.1.8

A simple cookbook to deploy your NodeJS app on Vagrant Ubuntu

Policyfile
Berkshelf
Knife
cookbook 'vagrant-node-simple', '= 0.1.8', :supermarket
cookbook 'vagrant-node-simple', '= 0.1.8'
knife supermarket install vagrant-node-simple
knife supermarket download vagrant-node-simple
README
Dependencies
Quality 0%

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.

As for OpsWorks, this cookbook require a server.js file at the root of your YOUR_NODE_APP_REPO, with listening on port 80.
Link

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: 80, 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.

Dependent cookbooks

apt >= 0.0.0
git >= 0.0.0

Contingent cookbooks

There are no cookbooks that are contingent upon this one.

Foodcritic Metric
            

0.1.8 failed this metric

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