cloudbees 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/cloudbees +116 -20
- data/lib/cloudbees/version.rb +1 -1
- metadata +4 -4
data/bin/cloudbees
CHANGED
@@ -8,52 +8,148 @@ def has_program?(program)
|
|
8
8
|
end
|
9
9
|
|
10
10
|
|
11
|
+
#if not detected bees on path - ask them to download from URL, install, and set bees home
|
12
|
+
#if no BEES_HOME, then can either search for it (home dir), or ask them to set it
|
13
|
+
|
11
14
|
|
12
15
|
if not has_program?('bees') then
|
13
|
-
abort('Please install the CloudBees SDK
|
16
|
+
abort('No CloudBees detected. Please install the CloudBees SDK:
|
17
|
+
1 download it from: http://cloudbees-downloads.s3.amazonaws.com/sdk/cloudbees-sdk-0.5.0-dist.zip
|
18
|
+
2 unzip to location of your choice
|
19
|
+
3 add the bees or bees.bat command to your path (depending on platform)
|
20
|
+
4 set the BEES_HOME environment variable to point to where you installed the SDK
|
21
|
+
5 there is no step 5.')
|
14
22
|
end
|
15
23
|
|
16
24
|
if not has_program?('warble') then
|
17
25
|
abort('Please install warbler (gem install warbler)')
|
18
26
|
end
|
19
27
|
|
28
|
+
if not ENV['BEES_HOME'] then
|
29
|
+
abort("You have the bees command installed, but the BEES_HOME environment variable is not set, please set it to where the SDK is installed.")
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
@usage = "
|
34
|
+
This provides ruby/rack/rails commands for CloudBees services, deploys your app using jruby and warbler to RUN@cloud.
|
35
|
+
Access your web console at https://run.cloudbees.com - you can find your app ids and db ids etc from there, create databases and more.
|
36
|
+
|
37
|
+
Usage:
|
38
|
+
cloudbees deploy [account_name/application_name]
|
39
|
+
- this will package the app in the current directory,
|
40
|
+
and deploy it with production environment settings.
|
41
|
+
Add on \"a description\" (with quotes) at the end optionally for tagging.
|
42
|
+
cloudbees tail
|
43
|
+
- open a live tail to your app as it is running
|
44
|
+
cloudbees restart
|
45
|
+
- restart the app, if you need to.
|
46
|
+
cloudbees delete
|
47
|
+
- delete the app
|
48
|
+
cloudbees help
|
49
|
+
- show help on the cloudbees SDK and the 'bees' command
|
50
|
+
|
51
|
+
|
52
|
+
"
|
20
53
|
|
21
|
-
usage_message = 'Usage: cloudbees deploy USER/APPNAME ["(optional) description here"]'
|
22
54
|
|
23
|
-
|
24
|
-
|
55
|
+
|
56
|
+
if ARGV.size == 0 then
|
57
|
+
abort(@usage)
|
58
|
+
|
25
59
|
end
|
26
60
|
|
27
|
-
task = ARGV[0]
|
28
61
|
|
29
|
-
|
30
|
-
|
62
|
+
|
63
|
+
@command = ARGV[0]
|
64
|
+
|
65
|
+
if not ["deploy", "tail", "restart", "delete", "help"].include? @command then
|
66
|
+
abort(@usage)
|
31
67
|
end
|
32
68
|
|
69
|
+
def stash_app_id id
|
70
|
+
File.open("cloudbees.appid", 'w') {|f| f.write(id) }
|
71
|
+
end
|
72
|
+
|
73
|
+
def get_app_id
|
74
|
+
if ARGV.size == 1 then
|
75
|
+
if File.exists?('cloudbees.appid') then
|
76
|
+
File.read('cloudbees.appid')
|
77
|
+
else
|
78
|
+
puts "Please enter application id (acount_name/application_name)"
|
79
|
+
app_id = STDIN.gets.chomp
|
80
|
+
stash_app_id app_id
|
81
|
+
app_id
|
82
|
+
end
|
83
|
+
else
|
84
|
+
ARGV[2]
|
85
|
+
end
|
86
|
+
end
|
33
87
|
|
34
|
-
|
88
|
+
def deploy
|
35
89
|
|
90
|
+
app_id = get_app_id
|
36
91
|
|
92
|
+
puts "Packaging the application locally, please wait..."
|
93
|
+
if not system("warble") then
|
94
|
+
abort("Unable to package the application as a war, see errors above")
|
95
|
+
end
|
37
96
|
|
38
|
-
|
97
|
+
wars = Dir.glob("*.war")
|
98
|
+
if wars.size != 1 then
|
99
|
+
abort("Unable to find war to deploy - warbler failure.")
|
100
|
+
end
|
39
101
|
|
40
|
-
|
102
|
+
puts "Now deploying to CloudBees..."
|
103
|
+
if ARGV.size == 3 then
|
104
|
+
`bees app:deploy -a #{app_id} -m "#{ARGV[2]}" #{wars[0]}`
|
105
|
+
else
|
106
|
+
`bees app:deploy -a #{app_id} #{wars[0]}"`
|
107
|
+
end
|
108
|
+
end
|
41
109
|
|
42
|
-
|
43
|
-
|
110
|
+
def tail
|
111
|
+
app_id = get_app_id
|
112
|
+
system("bees app:tail -a #{app_id}")
|
44
113
|
end
|
45
114
|
|
46
|
-
|
115
|
+
def restart
|
116
|
+
app_id = get_app_id
|
117
|
+
system("bees app:restart -a #{app_id}")
|
118
|
+
end
|
47
119
|
|
48
|
-
|
49
|
-
|
120
|
+
def delete
|
121
|
+
puts "Please enter the app id that you want to delete:"
|
122
|
+
app_id = gets
|
123
|
+
system("bees app:delete -a #{app_id}")
|
50
124
|
end
|
51
125
|
|
52
|
-
|
126
|
+
def help
|
127
|
+
puts @usage
|
128
|
+
puts "
|
129
|
+
|
130
|
+
Databases in rails:
|
131
|
+
You can use the CloudBees managed MySQL databases if you wish. You can create these with the bees command or
|
132
|
+
from run.cloudbees.com.
|
133
|
+
Your app will be deployed in production environment, so your database.yml (production) should look like:
|
53
134
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
135
|
+
adapter: jdbc
|
136
|
+
driver: com.cloudbees.jdbc.Driver
|
137
|
+
url: jdbc:cloudbees://BEES_DB_NAME(get from console)
|
138
|
+
username: BEES_DB_USERNAME(get from console)
|
139
|
+
password: BEES_DB_PASSWORD(get from console)
|
140
|
+
|
141
|
+
You can get more details about managed databases on you run.cloudbees.com console.
|
142
|
+
|
143
|
+
Also, you can use the 'bees' command for more low level control:
|
144
|
+
bees help
|
145
|
+
|
146
|
+
Also check out https://cloudbees.zendesk.com/entries/417131-rails for more info.
|
147
|
+
Please go to https://cloudbees.zendesk.com/categories/2200-run-cloud for any questions.
|
148
|
+
|
149
|
+
"
|
58
150
|
end
|
59
151
|
|
152
|
+
|
153
|
+
|
154
|
+
eval(@command)
|
155
|
+
|
data/lib/cloudbees/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudbees
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 5
|
10
|
+
version: 0.1.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Michael Neale
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-02-04 00:00:00 +11:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|