sunzi 0.4.1 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +14 -14
- data/Rakefile +8 -0
- data/bin/sunzi +2 -2
- data/lib/sunzi/version.rb +1 -1
- data/lib/sunzi.rb +8 -10
- data/lib/templates/create/remote/recipes/ssh_key.sh +1 -1
- data/sunzi.gemspec +1 -0
- data/test/test_cli.rb +1 -1
- metadata +17 -6
data/README.md
CHANGED
@@ -11,7 +11,7 @@ Sunzi assumes that modern Linux distributions have (mostly) sane defaults and gr
|
|
11
11
|
|
12
12
|
Its design goals are:
|
13
13
|
|
14
|
-
* **It's just shell script.** No clunky Ruby DSL involved.
|
14
|
+
* **It's just shell script.** No clunky Ruby DSL involved. Most of the information about server configuration on the web is written in shell commands. Just copy-paste them, rather than translate it into an arbitrary DSL. Also, Bash is the greatest common denominator on minimum Linux installs.
|
15
15
|
* **Focus on diff from default.** No big-bang overwriting. Append or replace the smallest possible piece of data in a config file. Loads of custom configurations make it difficult to understand what you are really doing.
|
16
16
|
* **Always use the root user.** Think twice before blindly assuming you need a regular user - it doesn't add any security benefit for server provisioning, it just adds extra verbosity for nothing. However, it doesn't mean that you shouldn't create regular users with Sunzi - feel free to write your own recipes.
|
17
17
|
* **Minimum dependencies.** No configuration server required. You don't even need a Ruby runtime on the remote server.
|
@@ -22,44 +22,44 @@ Quickstart
|
|
22
22
|
Install:
|
23
23
|
|
24
24
|
```bash
|
25
|
-
gem install sunzi
|
25
|
+
$ gem install sunzi
|
26
26
|
```
|
27
27
|
|
28
28
|
Go to your project directory, then:
|
29
29
|
|
30
30
|
```bash
|
31
|
-
sunzi create
|
31
|
+
$ sunzi create
|
32
32
|
```
|
33
33
|
|
34
|
-
It generates a `sunzi` folder along with subdirectories and templates. Inside `sunzi`, there's `sunzi.yml`, which defines dynamic attributes to be used from
|
34
|
+
It generates a `sunzi` folder along with subdirectories and templates. Inside `sunzi`, there's `sunzi.yml`, which defines your own dynamic attributes to be used from scripts. Also there's the `remote` folder, which will be transferred to the remote server, that contains recipes and dynamic variables compiled from `sunzi.yml`.
|
35
35
|
|
36
36
|
Go into the `sunzi` directory, then run `sunzi deploy`:
|
37
37
|
|
38
38
|
```bash
|
39
|
-
cd sunzi
|
40
|
-
sunzi deploy example.com
|
39
|
+
$ cd sunzi
|
40
|
+
$ sunzi deploy example.com
|
41
41
|
```
|
42
42
|
|
43
43
|
Now, what it actually does is:
|
44
44
|
|
45
|
-
1. Compile sunzi.yml to generate attributes and retrieve remote recipes
|
45
|
+
1. Compile `sunzi.yml` to generate attributes and retrieve remote recipes
|
46
46
|
1. SSH to `example.com` and login as `root`
|
47
47
|
1. Transfer the content of the `remote` directory to the remote server and extract in `$HOME/sunzi`
|
48
48
|
1. Run `install.sh` on the remote server
|
49
49
|
|
50
50
|
As you can see, all you need to do is edit `install.sh` and add some shell commands. That's it.
|
51
51
|
|
52
|
-
A Sunzi project with no recipes is totally fine, so that you can start small, go big
|
52
|
+
A Sunzi project with no recipes is totally fine, so that you can start small, go big as you get along.
|
53
53
|
|
54
54
|
Commands
|
55
55
|
--------
|
56
56
|
|
57
57
|
```bash
|
58
|
-
sunzi
|
59
|
-
sunzi create
|
60
|
-
sunzi deploy
|
61
|
-
sunzi setup
|
62
|
-
sunzi teardown
|
58
|
+
$ sunzi # Show command help
|
59
|
+
$ sunzi create # Create a new Sunzi project
|
60
|
+
$ sunzi deploy [user@host:port] # Deploy Sunzi project
|
61
|
+
$ sunzi setup [linode|ec2] # Setup a new VM on the Cloud services
|
62
|
+
$ sunzi teardown [linode|ec2] [name] # Teardown an existing VM on the Cloud services
|
63
63
|
```
|
64
64
|
|
65
65
|
Directory structure
|
@@ -170,5 +170,5 @@ and now run `vagrant up`, it will change the root password to `vagrant`.
|
|
170
170
|
Also keep in mind that you need to specify the port number 2222.
|
171
171
|
|
172
172
|
```bash
|
173
|
-
sunzi deploy localhost:2222
|
173
|
+
$ sunzi deploy localhost:2222
|
174
174
|
```
|
data/Rakefile
CHANGED
data/bin/sunzi
CHANGED
data/lib/sunzi/version.rb
CHANGED
data/lib/sunzi.rb
CHANGED
@@ -1,19 +1,17 @@
|
|
1
|
-
LIB_PATH = File.join(File.dirname(__FILE__), 'sunzi')
|
2
|
-
|
3
1
|
require 'thor'
|
4
2
|
require 'rainbow'
|
5
3
|
require 'yaml'
|
6
4
|
|
7
5
|
module Sunzi
|
8
|
-
autoload :Cli,
|
9
|
-
autoload :Dependency,
|
10
|
-
autoload :Logger,
|
11
|
-
autoload :Utility,
|
12
|
-
autoload :Version,
|
6
|
+
autoload :Cli, 'sunzi/cli'
|
7
|
+
autoload :Dependency, 'sunzi/dependency'
|
8
|
+
autoload :Logger, 'sunzi/logger'
|
9
|
+
autoload :Utility, 'sunzi/utility'
|
10
|
+
autoload :Version, 'sunzi/version'
|
13
11
|
|
14
12
|
module Cloud
|
15
|
-
autoload :Base,
|
16
|
-
autoload :Linode,
|
17
|
-
autoload :EC2,
|
13
|
+
autoload :Base, 'sunzi/cloud/base'
|
14
|
+
autoload :Linode, 'sunzi/cloud/linode'
|
15
|
+
autoload :EC2, 'sunzi/cloud/ec2'
|
18
16
|
end
|
19
17
|
end
|
@@ -13,7 +13,7 @@ else
|
|
13
13
|
else
|
14
14
|
echo "The public key file is not found! Try the following command:"
|
15
15
|
echo "cp ~/.ssh/$1 remote"
|
16
|
-
echo "If the file name found in ~/.ssh is different from \"$1\", edit
|
16
|
+
echo "If the file name found in ~/.ssh is different from \"$1\", edit sunzi.yml as appropriate."
|
17
17
|
exit 1
|
18
18
|
fi
|
19
19
|
fi
|
data/sunzi.gemspec
CHANGED
data/test/test_cli.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sunzi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-03-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
16
|
-
requirement: &
|
16
|
+
requirement: &2152827160 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2152827160
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rainbow
|
27
|
-
requirement: &
|
27
|
+
requirement: &2152825860 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,18 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2152825860
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rake
|
38
|
+
requirement: &2152824980 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *2152824980
|
36
47
|
description: Server provisioning utility for minimalists
|
37
48
|
email:
|
38
49
|
- kenn.ejima@gmail.com
|