incline 0.2.36 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +13 -13
- data/lib/incline/cli/prepare.rb +43 -43
- data/lib/incline/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9fe35793ff06a9491ed613497c6ea246a78e6b14
|
4
|
+
data.tar.gz: a1ce07e68a4d87dbd1908af7f73ec51686d8e922
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 928ded9613ba970170df22b18bf4032ddbc48a3e7effecb68152fc6555b49628bdcf5dfb9f611f9ab99f2bdb9b0276f80e0c38b859aa435efc2a11e3cadfc3ab
|
7
|
+
data.tar.gz: 1520c21edb79a2c187661847d3f0835d4a8e06cdca671962a92bec2b97b7150ea90e837d0e5f2afdf2d5c20e8f5d705eb7bc79352cf34898b1d4521ac00c8cf1
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
incline (0.
|
4
|
+
incline (0.3.0)
|
5
5
|
ansi (~> 1.5.0)
|
6
6
|
bcrypt
|
7
7
|
bootstrap-sass
|
@@ -13,7 +13,7 @@ PATH
|
|
13
13
|
rails (~> 4.2.8)
|
14
14
|
redcarpet (~> 3.4.0)
|
15
15
|
sass-rails (~> 5.0.6)
|
16
|
-
shells (~> 0.1
|
16
|
+
shells (~> 0.2.1)
|
17
17
|
spawnling (~> 2.1.6)
|
18
18
|
uglifier
|
19
19
|
|
@@ -58,14 +58,14 @@ GEM
|
|
58
58
|
tzinfo (~> 1.1)
|
59
59
|
ansi (1.5.0)
|
60
60
|
arel (6.0.4)
|
61
|
-
autoprefixer-rails (7.2.
|
61
|
+
autoprefixer-rails (7.2.5)
|
62
62
|
execjs
|
63
63
|
bcrypt (3.1.11)
|
64
64
|
bootstrap-sass (3.3.7)
|
65
65
|
autoprefixer-rails (>= 5.2.1)
|
66
66
|
sass (>= 3.3.4)
|
67
67
|
builder (3.2.3)
|
68
|
-
byebug (
|
68
|
+
byebug (10.0.0)
|
69
69
|
coffee-rails (4.2.2)
|
70
70
|
coffee-script (>= 2.2.0)
|
71
71
|
railties (>= 4.0.0)
|
@@ -86,7 +86,7 @@ GEM
|
|
86
86
|
ffi (1.9.18)
|
87
87
|
globalid (0.4.1)
|
88
88
|
activesupport (>= 4.2.0)
|
89
|
-
i18n (0.9.
|
89
|
+
i18n (0.9.3)
|
90
90
|
concurrent-ruby (~> 1.0)
|
91
91
|
jbuilder (2.7.0)
|
92
92
|
activesupport (>= 4.2.0)
|
@@ -102,10 +102,10 @@ GEM
|
|
102
102
|
mini_mime (>= 0.1.1)
|
103
103
|
mini_mime (1.0.0)
|
104
104
|
mini_portile2 (2.3.0)
|
105
|
-
minitest (5.
|
106
|
-
multi_json (1.
|
105
|
+
minitest (5.11.3)
|
106
|
+
multi_json (1.13.1)
|
107
107
|
net-ssh (4.1.0)
|
108
|
-
nokogiri (1.8.
|
108
|
+
nokogiri (1.8.2)
|
109
109
|
mini_portile2 (~> 2.3.0)
|
110
110
|
rack (1.6.8)
|
111
111
|
rack-test (0.6.3)
|
@@ -141,7 +141,7 @@ GEM
|
|
141
141
|
redcarpet (3.4.0)
|
142
142
|
rubyserial (0.4.0)
|
143
143
|
ffi (~> 1.9, >= 1.9.3)
|
144
|
-
sass (3.5.
|
144
|
+
sass (3.5.5)
|
145
145
|
sass-listen (~> 4.0.0)
|
146
146
|
sass-listen (4.0.0)
|
147
147
|
rb-fsevent (~> 0.9, >= 0.9.4)
|
@@ -152,7 +152,7 @@ GEM
|
|
152
152
|
sprockets (>= 2.8, < 4.0)
|
153
153
|
sprockets-rails (>= 2.0, < 4.0)
|
154
154
|
tilt (>= 1.1, < 3)
|
155
|
-
shells (0.1
|
155
|
+
shells (0.2.1)
|
156
156
|
net-ssh (~> 4.1.0)
|
157
157
|
rubyserial (~> 0.4.0)
|
158
158
|
spawnling (2.1.6)
|
@@ -169,9 +169,9 @@ GEM
|
|
169
169
|
tilt (2.0.8)
|
170
170
|
tiny_tds (1.3.0)
|
171
171
|
mini_portile2 (~> 2.0)
|
172
|
-
tzinfo (1.2.
|
172
|
+
tzinfo (1.2.5)
|
173
173
|
thread_safe (~> 0.1)
|
174
|
-
uglifier (4.
|
174
|
+
uglifier (4.1.5)
|
175
175
|
execjs (>= 0.3.0, < 3)
|
176
176
|
web-console (3.3.0)
|
177
177
|
activemodel (>= 4.2)
|
@@ -191,4 +191,4 @@ DEPENDENCIES
|
|
191
191
|
web-console (~> 3.3.0)
|
192
192
|
|
193
193
|
BUNDLED WITH
|
194
|
-
1.16.
|
194
|
+
1.16.1
|
data/lib/incline/cli/prepare.rb
CHANGED
@@ -24,7 +24,7 @@ module Incline
|
|
24
24
|
##
|
25
25
|
# Defines the 'prepare' command for the CLI.
|
26
26
|
class Prepare
|
27
|
-
|
27
|
+
|
28
28
|
##
|
29
29
|
# Creates a new 'prepare' command for the CLI.
|
30
30
|
def initialize(host_name_or_ip, ssh_user, *options)
|
@@ -37,19 +37,19 @@ module Incline
|
|
37
37
|
rails_version: '4.2.9'
|
38
38
|
}
|
39
39
|
@options[:host] = host_name_or_ip.to_s.strip
|
40
|
-
|
40
|
+
|
41
41
|
raise UsageError.new("The 'host_name_or_ip' parameter is required.", 'prepare') if @options[:host] == ''
|
42
|
-
|
42
|
+
|
43
43
|
if @options[:host] =~ /\A(?:\[[0-9a-f:]+\]|[a-z0-9]+(?:\.[a-z0-9]+)*):(?:\d+)\z/i
|
44
44
|
h,_,p = @options[:host].rpartition(':')
|
45
45
|
@options[:host] = h
|
46
46
|
@options[:port] = p.to_i
|
47
47
|
end
|
48
|
-
|
48
|
+
|
49
49
|
@options[:admin_user] = ssh_user.to_s.strip
|
50
|
-
|
50
|
+
|
51
51
|
raise UsageError.new("The 'ssh_user' parameter is required.", 'prepare') if @options[:admin_user] == ''
|
52
|
-
|
52
|
+
|
53
53
|
while options.any?
|
54
54
|
flag = options.delete_at(0)
|
55
55
|
case flag
|
@@ -67,7 +67,7 @@ module Incline
|
|
67
67
|
when '--rails-version'
|
68
68
|
@options[:rails_version] = options.delete_at(0).to_s.strip
|
69
69
|
raise UsageError.new("The '--rails-version' parameter must be at least 4.2.", 'prepare') if @options[:rails_version].to_f < 4.2
|
70
|
-
|
70
|
+
|
71
71
|
# These options can be used to customize the self-signed certificate created initially.
|
72
72
|
when '--ssl-country'
|
73
73
|
@options[:ssl_country] = options.delete_at(0).to_s.strip
|
@@ -77,12 +77,12 @@ module Incline
|
|
77
77
|
@options[:ssl_location] = options.delete_at(0).to_s.strip
|
78
78
|
when '--ssl-org'
|
79
79
|
@options[:ssl_org] = options.delete_at(0).to_s.strip
|
80
|
-
|
80
|
+
|
81
81
|
else
|
82
82
|
raise UsageError.new("The '#{flag}' parameter is not recognized.", 'prepare')
|
83
83
|
end
|
84
84
|
end
|
85
|
-
|
85
|
+
|
86
86
|
@options[:port] = 22 unless (1..65535).include?(@options[:port])
|
87
87
|
if @options[:admin_password].to_s.strip == ''
|
88
88
|
print 'Please enter the sudo password: '
|
@@ -92,14 +92,14 @@ module Incline
|
|
92
92
|
puts 'WARNING: Sudo password is blank and script may fail because of this.'
|
93
93
|
end
|
94
94
|
end
|
95
|
-
|
95
|
+
|
96
96
|
@options[:ssl_country] = 'US' if @options[:ssl_country].to_s == ''
|
97
97
|
@options[:ssl_state] = 'Pennsylvania' if @options[:ssl_state].to_s == ''
|
98
98
|
@options[:ssl_location] = 'Pittsburgh' if @options[:ssl_location].to_s == ''
|
99
99
|
@options[:ssl_org] = 'WEB' if @options[:ssl_org].to_s == ''
|
100
|
-
|
100
|
+
|
101
101
|
end
|
102
|
-
|
102
|
+
|
103
103
|
##
|
104
104
|
# Prepares an Ubuntu server with NGINX and Passenger to run Rails applications.
|
105
105
|
#
|
@@ -107,16 +107,16 @@ module Incline
|
|
107
107
|
# Set 'ssh_user' to the user name you want to access the host as.
|
108
108
|
# This user must be able to run 'sudo' commands and must not be 'root'.
|
109
109
|
#
|
110
|
-
# You can provide a port value either appended to the host name or as a
|
110
|
+
# You can provide a port value either appended to the host name or as a
|
111
111
|
# separate argument using the '--port' option.
|
112
112
|
# e.g. ssh.example.com:22 or --port 22
|
113
113
|
#
|
114
|
-
# If you are configured with key authentication to the host then you don't
|
115
|
-
# need to provide an SSH password to connect. However, this password is
|
114
|
+
# If you are configured with key authentication to the host then you don't
|
115
|
+
# need to provide an SSH password to connect. However, this password is
|
116
116
|
# also used to run sudo commands. You can specify a password on the command
|
117
117
|
# line by using the '--ssh-password' option. If you do not, then the script
|
118
118
|
# will prompt you for a "sudo" password to use. You can leave this blank,
|
119
|
-
# but the script will warn you that it may lead to failure. Obviously, if
|
119
|
+
# but the script will warn you that it may lead to failure. Obviously, if
|
120
120
|
# you are configured with NOPASSWD in the sudoers file, then you can safely
|
121
121
|
# leave the password blank.
|
122
122
|
#
|
@@ -128,7 +128,7 @@ module Incline
|
|
128
128
|
# e.g. --deploy_user bob
|
129
129
|
#
|
130
130
|
# The script will install 'rbenv' under the deploy user's account and then
|
131
|
-
# install Ruby followed by Rails. The default Ruby version installed is
|
131
|
+
# install Ruby followed by Rails. The default Ruby version installed is
|
132
132
|
# 2.3.4 and the Rails version installed is 4.2.9. To change these versions
|
133
133
|
# use the '--ruby-version' and '--rails-version' options. The Ruby version
|
134
134
|
# must be at least 2.3 and the rails version must be at least 4.2.
|
@@ -136,15 +136,15 @@ module Incline
|
|
136
136
|
def run
|
137
137
|
# reset the host info.
|
138
138
|
@host_info = nil
|
139
|
-
|
139
|
+
|
140
140
|
admin_shell do |admin|
|
141
141
|
# test the connection and sudo capabilities.
|
142
142
|
admin.sudo_stat_exec 'Testing connection', 'ls -al /root'
|
143
|
-
|
143
|
+
|
144
144
|
# retrieve the host info now that we are connected.
|
145
145
|
@host_info = admin.host_info
|
146
146
|
raise CliError, "Host OS (#{host_id}) is not supported." unless [ :ubuntu ].include?(host_id)
|
147
|
-
|
147
|
+
|
148
148
|
# update the system and configure SSH.
|
149
149
|
update_system admin
|
150
150
|
ssh_copy_id(admin) unless @options[:admin_password] == ''
|
@@ -152,48 +152,48 @@ module Incline
|
|
152
152
|
end
|
153
153
|
# end the session and reconnect to take advantage of the SSH reset done at the end of config_ssh
|
154
154
|
admin_shell do |admin|
|
155
|
-
# install ruby prerequisites and mariadb.
|
155
|
+
# install ruby prerequisites and mariadb.
|
156
156
|
install_prereqs admin
|
157
157
|
install_db admin
|
158
|
-
|
158
|
+
|
159
159
|
# add the deploy user.
|
160
160
|
add_deploy_user admin
|
161
|
-
|
161
|
+
|
162
162
|
# log in as deploy user
|
163
163
|
deploy_shell do |deploy|
|
164
164
|
# enable key auth.
|
165
165
|
ssh_copy_id deploy
|
166
|
-
|
166
|
+
|
167
167
|
# install rbenv.
|
168
168
|
install_rbenv deploy
|
169
169
|
end
|
170
|
-
|
170
|
+
|
171
171
|
# log out and then back in to load rbenv
|
172
172
|
deploy_shell do |deploy|
|
173
173
|
# install ruby & rails
|
174
174
|
install_ruby deploy
|
175
175
|
install_rails deploy
|
176
|
-
|
176
|
+
|
177
177
|
# one more fun little addition, we'll add the flytrap app to catch path attacks.
|
178
178
|
install_flytrap deploy
|
179
179
|
end
|
180
180
|
# done with the deploy user, so log out of that session.
|
181
|
-
|
181
|
+
|
182
182
|
# install Phusion Passenger to the host and then configure it.
|
183
183
|
install_passenger admin
|
184
184
|
config_passenger admin
|
185
|
-
|
185
|
+
|
186
186
|
# create a few helper utilities to test and reload the configuration.
|
187
187
|
create_nginx_utils admin
|
188
|
-
|
188
|
+
|
189
189
|
# then restart nginx.
|
190
190
|
restart_nginx admin
|
191
|
-
|
191
|
+
|
192
192
|
puts 'Testing nginx server...'
|
193
193
|
admin.exec_ignore_code 'curl http://localhost/this-is-a-test'
|
194
194
|
admin.exec "curl #{flytrap_path}"
|
195
195
|
end
|
196
|
-
|
196
|
+
|
197
197
|
puts ''
|
198
198
|
puts ANSI.ansi(:bold, :white) { 'Host preparation completed.' }
|
199
199
|
puts ''
|
@@ -206,25 +206,25 @@ module Incline
|
|
206
206
|
puts 'Server Test Path'
|
207
207
|
puts ('-' * 70)
|
208
208
|
puts ANSI.ansi(:bold) { flytrap_path }
|
209
|
-
|
209
|
+
|
210
210
|
logfile.flush
|
211
211
|
logfile.close
|
212
212
|
@logfile = nil
|
213
213
|
|
214
214
|
end
|
215
|
-
|
216
|
-
|
215
|
+
|
216
|
+
|
217
217
|
private
|
218
|
-
|
218
|
+
|
219
219
|
def host_info
|
220
220
|
@host_info ||= {}
|
221
221
|
end
|
222
|
-
|
222
|
+
|
223
223
|
def host_id
|
224
224
|
host_info['ID'] ||= :unknown
|
225
225
|
end
|
226
|
-
|
227
|
-
|
226
|
+
|
227
|
+
|
228
228
|
def logfile
|
229
229
|
@logfile ||=
|
230
230
|
begin
|
@@ -234,9 +234,9 @@ module Incline
|
|
234
234
|
end
|
235
235
|
|
236
236
|
end
|
237
|
-
|
237
|
+
|
238
238
|
def admin_shell
|
239
|
-
Shells::
|
239
|
+
Shells::SshBashShell.new(
|
240
240
|
host: @options[:host],
|
241
241
|
port: @options[:port],
|
242
242
|
user: @options[:admin_user],
|
@@ -249,9 +249,9 @@ module Incline
|
|
249
249
|
yield sh
|
250
250
|
end
|
251
251
|
end
|
252
|
-
|
252
|
+
|
253
253
|
def deploy_shell
|
254
|
-
Shells::
|
254
|
+
Shells::SshBashShell.new(
|
255
255
|
host: @options[:host],
|
256
256
|
port: @options[:port],
|
257
257
|
user: @options[:deploy_user],
|
@@ -264,7 +264,7 @@ module Incline
|
|
264
264
|
yield sh
|
265
265
|
end
|
266
266
|
end
|
267
|
-
|
267
|
+
|
268
268
|
end
|
269
269
|
end
|
270
270
|
end
|
data/lib/incline/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: incline
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Beau Barker
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-02-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -156,14 +156,14 @@ dependencies:
|
|
156
156
|
requirements:
|
157
157
|
- - "~>"
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version: 0.1
|
159
|
+
version: 0.2.1
|
160
160
|
type: :runtime
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
164
|
- - "~>"
|
165
165
|
- !ruby/object:Gem::Version
|
166
|
-
version: 0.1
|
166
|
+
version: 0.2.1
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: ansi
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
@@ -610,7 +610,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
610
610
|
version: '0'
|
611
611
|
requirements: []
|
612
612
|
rubyforge_project:
|
613
|
-
rubygems_version: 2.6.
|
613
|
+
rubygems_version: 2.6.14
|
614
614
|
signing_key:
|
615
615
|
specification_version: 4
|
616
616
|
summary: A gem designed to get off to an even quicker start with Rails.
|