chef: update
This commit is contained in:
parent
4ddec681c9
commit
85ae9d769e
115
chef.md
115
chef.md
|
@ -1,80 +1,109 @@
|
|||
---
|
||||
title: Chef
|
||||
category: Devops
|
||||
layout: 2017/sheet
|
||||
---
|
||||
|
||||
### Install
|
||||
|
||||
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
|
||||
Thank you for installing Chef!
|
||||
```bash
|
||||
$ curl -L https://www.opscode.com/chef/install.sh | bash
|
||||
Thank you for installing Chef!
|
||||
```
|
||||
|
||||
$ chef-solo -v
|
||||
...
|
||||
Chef: 11.4.0
|
||||
```bash
|
||||
$ chef-solo -v
|
||||
...
|
||||
Chef: 11.4.0
|
||||
```
|
||||
|
||||
### Start the cookbook
|
||||
|
||||
wget http://github.com/opscode/chef-repo/tarball/master -O - | tar xzf - --strip-components=1
|
||||
```bash
|
||||
wget http://github.com/opscode/chef-repo/tarball/master -O - | tar xzf - --strip-components=1
|
||||
```
|
||||
|
||||
### Knife
|
||||
|
||||
$ knife cookbook site download mysql
|
||||
```bash
|
||||
$ knife cookbook site download mysql
|
||||
```
|
||||
|
||||
### 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
|
||||
|
||||
execute "tar --no-same-owner -zxf hi.tar.gz" do
|
||||
cwd "/usr/local/src"
|
||||
creates "/usr/local/src/node-v#{version}"
|
||||
end
|
||||
```ruby
|
||||
execute "tar --no-same-owner -zxf hi.tar.gz" do
|
||||
cwd "/usr/local/src"
|
||||
creates "/usr/local/src/node-v#{version}"
|
||||
end
|
||||
```
|
||||
|
||||
bash "compile" do
|
||||
cwd "/usr/local/src/node-v#{version}"
|
||||
code %[
|
||||
PATH=/usr/local/bin:$PATH
|
||||
./configure
|
||||
make
|
||||
]
|
||||
creates "/usr/local/src/node-v#{version}/node"
|
||||
end
|
||||
```ruby
|
||||
bash "compile" do
|
||||
cwd "/usr/local/src/node-v#{version}"
|
||||
code %[
|
||||
PATH=/usr/local/bin:$PATH
|
||||
./configure
|
||||
make
|
||||
]
|
||||
creates "/usr/local/src/node-v#{version}/node"
|
||||
end
|
||||
```
|
||||
|
||||
### remote file
|
||||
|
||||
remote_file "/usr/local/src/hi.tar.gz" do
|
||||
source "http://..."
|
||||
checksum "ab83be..."
|
||||
mode 0644
|
||||
action :create_if_missing
|
||||
end
|
||||
```ruby
|
||||
remote_file "/usr/local/src/hi.tar.gz" do
|
||||
source "http://..."
|
||||
checksum "ab83be..."
|
||||
mode 0644
|
||||
action :create_if_missing
|
||||
end
|
||||
```
|
||||
|
||||
### ruby_block
|
||||
|
||||
ruby_block "name" do
|
||||
block { File.read ... }
|
||||
not_if { File.exists?(...) }
|
||||
end
|
||||
```ruby
|
||||
ruby_block "name" do
|
||||
block { File.read ... }
|
||||
not_if { File.exists?(...) }
|
||||
end
|
||||
```
|
||||
|
||||
### Execute
|
||||
|
||||
execute "name" do
|
||||
cwd "..."
|
||||
environment({ "PATH" => "..." })
|
||||
command "make install"
|
||||
creates "..."
|
||||
end
|
||||
```ruby
|
||||
execute "name" do
|
||||
cwd "..."
|
||||
environment({ "PATH" => "..." })
|
||||
command "make install"
|
||||
creates "..."
|
||||
end
|
||||
```
|
||||
|
||||
### Conditions
|
||||
|
||||
creates "/usr/local/src/node-v#{version}/node"
|
||||
not_if { File.exists?('...') }
|
||||
```ruby
|
||||
creates "/usr/local/src/node-v#{version}/node"
|
||||
not_if { File.exists?('...') }
|
||||
```
|
||||
|
||||
### References
|
||||
## Also see
|
||||
|
||||
* http://gettingstartedwithchef.com/
|
||||
* https://github.com/mdxp/nodejs-cookbook/blob/master/recipes/install_from_source.rb
|
||||
* [Getting started with Chef](http://gettingstartedwithchef.com/) _(gettingstartedwithchef.com)_
|
||||
* [install_from_source.rb recipe](https://github.com/mdxp/nodejs-cookbook/blob/master/recipes/install_from_source.rb) _(github.com)_
|
||||
|
|
10
parsley.md
10
parsley.md
|
@ -19,13 +19,21 @@ intro: |
|
|||
## Parsley
|
||||
{: .-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
|
||||
|
||||
#### via HTML
|
||||
|
||||
```html
|
||||
<form data-parsley-validate>
|
||||
<!-- not preferred -->
|
||||
<!-- ✗ not preferred -->
|
||||
```
|
||||
|
||||
#### via JavaScript
|
||||
|
|
Loading…
Reference in New Issue