node.js環境をchefで構築する

提供: Node.js/JavaScript入門
移動: 案内検索
スポンサーリンク

chef(chef-solo)を利用して、node.js(node)とnpmをインストールします。

読み方

chef
しぇふ

概要

今回、インストールするパッケージは、以下の通りです。

cookbook の作成

knife cookbook create node -o .

レシピの作成

vim node/recipes/default.rb

recipes/default.rb

#
# Cookbook Name:: node
# Recipe:: default
#
# Copyright 2014, YOUR_COMPANY_NAME
#
# All rights reserved - Do Not Redistribute
#
 
package "node" do
        action :install
end
 
package "npm" do
        action :install
end

パッケージのインストール

sudo chef-solo -o node

実行例

$ sudo chef-solo -o node
[2014-09-10T22:02:12+09:00] WARN:
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
SSL validation of HTTPS requests is disabled. HTTPS connections are still
encrypted, but chef is not able to detect forged replies or man in the middle
attacks.
 
To fix this issue add an entry like this to your configuration file:
 
```
  # Verify all HTTPS connections (recommended)
  ssl_verify_mode :verify_peer
 
  # OR, Verify only connections to chef-server
  verify_api_cert true
```
 
To check your SSL configuration, or troubleshoot errors, you can use the
`knife ssl check` command like so:
 
```
  knife ssl check -c /etc/chef/solo.rb
```
 
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 
Starting Chef Client, version 11.14.2
[2014-09-10T22:02:16+09:00] WARN: Run List override has been provided.
[2014-09-10T22:02:16+09:00] WARN: Original Run List: []
[2014-09-10T22:02:16+09:00] WARN: Overridden Run List: [recipe[node]]
Compiling Cookbooks...
Converging 2 resources
Recipe: node::default
  * freebsd_package[node] action install
    - install version 0.10.31 of package node
  * freebsd_package[npm] action install
    - install version 1.4.15 of package npm
 
Running handlers:
Running handlers complete
Chef Client finished, 2/2 resources updated in 13.055802763 seconds

関連項目




スポンサーリンク