small_wonder 0.1 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +6 -2
- data/lib/small_wonder/deploy.rb +7 -9
- metadata +3 -2
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Small Wonder is a deployment tool.
|
4
4
|
|
5
|
-
Specifically it's a lightweight wrapper for Salticid, which is a tool that will run a bunch of commands on a bunch of machines for you. Kinda like capistrano. To a large extent Small Wonder is a means for using Salticid and Chef together to deploy applications. Salticid "roles" and "tasks" are Ruby code and can use the Chef Ruby APIs to search and access anything Chef Client or Knife can (by consuming your knife config). Small Wonder has a notion of an application object as well, this object contains data like the name, version, status and even the databag config data for an application. Name, version and status are saved back to the Chef node so you can use application specific details in your recipes, searches and etc.
|
5
|
+
Specifically it's a lightweight wrapper for Salticid [https://github.com/aphyr/salticid], which is a tool that will run a bunch of commands on a bunch of machines for you. Kinda like capistrano. To a large extent Small Wonder is a means for using Salticid and Chef together to deploy applications. Salticid "roles" and "tasks" are Ruby code and can use the Chef Ruby APIs to search and access anything Chef Client or Knife can (by consuming your knife config). Small Wonder has a notion of an application object as well, this object contains data like the name, version, status and even the databag config data for an application. Name, version and status are saved back to the Chef node so you can use application specific details in your recipes, searches and etc. This application object is available for use in your deployment code as well.
|
6
6
|
|
7
7
|
### License
|
8
8
|
|
@@ -10,6 +10,10 @@ Apache License Version 2.0
|
|
10
10
|
|
11
11
|
### Usage
|
12
12
|
|
13
|
+
#### Install
|
14
|
+
|
15
|
+
$ gem install small_wonder
|
16
|
+
|
13
17
|
#### Configure
|
14
18
|
|
15
19
|
$ mkdir ~/.small_wonder
|
@@ -77,4 +81,4 @@ Small wonder supports some basic erb templating just like Chef. All erb files in
|
|
77
81
|
|
78
82
|
Files and directories with 'VERSION' in the name will be convered to have the actual appclication.version variable in place of 'VERSION'.
|
79
83
|
|
80
|
-
The examples directory has some examples.
|
84
|
+
The examples directory has some examples.
|
data/lib/small_wonder/deploy.rb
CHANGED
@@ -40,6 +40,8 @@ module SmallWonder
|
|
40
40
|
if input
|
41
41
|
SmallWonder::Log.info("Commencing deployment.")
|
42
42
|
|
43
|
+
sudo_password = ::HighLine.ask("Your sudo password please: ") { |q| q.echo = false }
|
44
|
+
|
43
45
|
nodes.each do |node|
|
44
46
|
if SmallWonder::Config.version
|
45
47
|
SmallWonder::Log.info("Got version #{SmallWonder::Config.version} from a command line option, using it as the current version for #{SmallWonder::Config.app}.")
|
@@ -49,7 +51,7 @@ module SmallWonder
|
|
49
51
|
application = SmallWonder::Application.new(node, application_name)
|
50
52
|
end
|
51
53
|
|
52
|
-
deploy_application(application)
|
54
|
+
deploy_application(application, sudo_password)
|
53
55
|
end
|
54
56
|
end
|
55
57
|
else
|
@@ -57,8 +59,8 @@ module SmallWonder
|
|
57
59
|
end
|
58
60
|
end
|
59
61
|
|
60
|
-
def self.deploy_application(application)
|
61
|
-
run_salticid_task(application)
|
62
|
+
def self.deploy_application(application, sudo_password)
|
63
|
+
run_salticid_task(application, sudo_password)
|
62
64
|
|
63
65
|
if SmallWonder::Config.write_node_file
|
64
66
|
SmallWonder::Utils.write_node_data_file(application.node_name)
|
@@ -67,7 +69,7 @@ module SmallWonder
|
|
67
69
|
|
68
70
|
## deploy step
|
69
71
|
# Creates a new salticid host for node, and calls <app>.deploy on it.
|
70
|
-
def self.run_salticid_task(application)
|
72
|
+
def self.run_salticid_task(application, sudo_password)
|
71
73
|
host = SmallWonder.salticid.host application.node_name
|
72
74
|
host.on_log do |message|
|
73
75
|
begin
|
@@ -81,15 +83,11 @@ module SmallWonder
|
|
81
83
|
end
|
82
84
|
|
83
85
|
host.application = application
|
84
|
-
|
85
86
|
host.user SmallWonder::Config.ssh_user
|
86
|
-
|
87
|
-
host.password = @sudo_password
|
87
|
+
host.password = sudo_password
|
88
88
|
|
89
89
|
# sub hyphens for underscores to work around having hyphens in method names
|
90
|
-
|
91
90
|
host.role application.application_name.gsub("-", "_")
|
92
|
-
|
93
91
|
host.send(application.application_name.gsub("-", "_")).deploy
|
94
92
|
|
95
93
|
# set the application status to final since the deploy is done
|
metadata
CHANGED