chef: update

This commit is contained in:
Rico Sta. Cruz 2017-10-19 10:55:15 +08:00
parent 4ddec681c9
commit 85ae9d769e
No known key found for this signature in database
GPG Key ID: CAAD38AE2962619A
2 changed files with 81 additions and 44 deletions

71
chef.md
View File

@ -1,40 +1,60 @@
--- ---
title: Chef title: Chef
category: Devops category: Devops
layout: 2017/sheet
--- ---
### Install ### Install
In your server: In your server:
{: .-setup}
$ sudo apt-get install curl ```bash
$ sudo apt-get install curl
```
$ curl -L https://www.opscode.com/chef/install.sh | bash ```bash
Thank you for installing Chef! $ curl -L https://www.opscode.com/chef/install.sh | bash
Thank you for installing Chef!
```
$ chef-solo -v ```bash
... $ chef-solo -v
Chef: 11.4.0 ...
Chef: 11.4.0
```
### Start the cookbook ### Start the cookbook
```bash
wget http://github.com/opscode/chef-repo/tarball/master -O - | tar xzf - --strip-components=1 wget http://github.com/opscode/chef-repo/tarball/master -O - | tar xzf - --strip-components=1
```
### Knife ### Knife
$ knife cookbook site download mysql ```bash
$ knife cookbook site download mysql
```
### Invoking chef-solo ### Invoking chef-solo
$ chef-solo -c solo.rb -j web.json ```bash
$ chef-solo -c solo.rb -j web.json
```
## Examples
### Simple compile-from-source ### Simple compile-from-source
execute "tar --no-same-owner -zxf hi.tar.gz" do ```ruby
execute "tar --no-same-owner -zxf hi.tar.gz" do
cwd "/usr/local/src" cwd "/usr/local/src"
creates "/usr/local/src/node-v#{version}" creates "/usr/local/src/node-v#{version}"
end end
```
bash "compile" do ```ruby
bash "compile" do
cwd "/usr/local/src/node-v#{version}" cwd "/usr/local/src/node-v#{version}"
code %[ code %[
PATH=/usr/local/bin:$PATH PATH=/usr/local/bin:$PATH
@ -42,39 +62,48 @@ In your server:
make make
] ]
creates "/usr/local/src/node-v#{version}/node" creates "/usr/local/src/node-v#{version}/node"
end end
```
### remote file ### remote file
remote_file "/usr/local/src/hi.tar.gz" do ```ruby
remote_file "/usr/local/src/hi.tar.gz" do
source "http://..." source "http://..."
checksum "ab83be..." checksum "ab83be..."
mode 0644 mode 0644
action :create_if_missing action :create_if_missing
end end
```
### ruby_block ### ruby_block
ruby_block "name" do ```ruby
ruby_block "name" do
block { File.read ... } block { File.read ... }
not_if { File.exists?(...) } not_if { File.exists?(...) }
end end
```
### Execute ### Execute
execute "name" do ```ruby
execute "name" do
cwd "..." cwd "..."
environment({ "PATH" => "..." }) environment({ "PATH" => "..." })
command "make install" command "make install"
creates "..." creates "..."
end end
```
### Conditions ### Conditions
```ruby
creates "/usr/local/src/node-v#{version}/node" creates "/usr/local/src/node-v#{version}/node"
not_if { File.exists?('...') } not_if { File.exists?('...') }
```
### References ## Also see
* http://gettingstartedwithchef.com/ * [Getting started with Chef](http://gettingstartedwithchef.com/) _(gettingstartedwithchef.com)_
* https://github.com/mdxp/nodejs-cookbook/blob/master/recipes/install_from_source.rb * [install_from_source.rb recipe](https://github.com/mdxp/nodejs-cookbook/blob/master/recipes/install_from_source.rb) _(github.com)_

View File

@ -19,13 +19,21 @@ intro: |
## Parsley ## Parsley
{: .-three-column} {: .-three-column}
### Installing via NPM
```
npm install --save parsleyjs
```
[parsleyjs](https://www.npmjs.com/package/parsleyjs) is the Parsley form validator. ('parsley' is a different package)
### Enabling ### Enabling
#### via HTML #### via HTML
```html ```html
<form data-parsley-validate> <form data-parsley-validate>
<!-- not preferred --> <!-- not preferred -->
``` ```
#### via JavaScript #### via JavaScript