bcalloway-slicehost 0.0.2.6 → 0.0.3.0

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.
Files changed (30) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README +99 -0
  3. data/lib/capistrano/ext/slicehost.rb +7 -0
  4. data/lib/capistrano/ext/slicehost/apache.rb +90 -0
  5. data/lib/capistrano/ext/slicehost/aptitude.rb +94 -0
  6. data/lib/capistrano/ext/slicehost/disk.rb +13 -0
  7. data/lib/capistrano/ext/slicehost/gems.rb +41 -0
  8. data/lib/capistrano/ext/slicehost/git.rb +6 -0
  9. data/lib/capistrano/ext/slicehost/iptables.rb +21 -0
  10. data/lib/capistrano/ext/slicehost/mysql.rb +36 -0
  11. data/lib/capistrano/ext/slicehost/nginx.rb +70 -0
  12. data/lib/capistrano/ext/slicehost/postgresql.rb +37 -0
  13. data/lib/capistrano/ext/slicehost/profile.rb +11 -0
  14. data/lib/capistrano/ext/slicehost/render.rb +6 -0
  15. data/lib/capistrano/ext/slicehost/ruby.rb +59 -0
  16. data/lib/capistrano/ext/slicehost/slice.rb +10 -0
  17. data/lib/capistrano/ext/slicehost/ssh.rb +59 -0
  18. data/lib/capistrano/ext/slicehost/templates/bashrc.erb +93 -0
  19. data/lib/capistrano/ext/slicehost/templates/iptables.erb +42 -0
  20. data/lib/capistrano/ext/slicehost/templates/mydircolors.erb +170 -0
  21. data/lib/capistrano/ext/slicehost/templates/nanorc.erb +260 -0
  22. data/lib/capistrano/ext/slicehost/templates/passenger.conf.erb +2 -0
  23. data/lib/capistrano/ext/slicehost/templates/passenger.load.erb +1 -0
  24. data/lib/capistrano/ext/slicehost/templates/sshd_config.erb +81 -0
  25. data/lib/capistrano/ext/slicehost/templates/vhost.erb +8 -0
  26. data/lib/capistrano/ext/slicehost/templates/vhost_nginx.erb +23 -0
  27. data/lib/capistrano/ext/slicehost/templates/vimrc.erb +4 -0
  28. data/lib/capistrano/ext/slicehost/useradd.rb +68 -0
  29. data/lib/capistrano/ext/slicehost/vim.rb +19 -0
  30. metadata +39 -10
@@ -0,0 +1,260 @@
1
+ ## Sample initialization file for GNU nano.
2
+ ##
3
+ ## Please note that you must have configured nano with --enable-nanorc
4
+ ## for this file to be read! Also note that this file should not be in
5
+ ## DOS or Mac format, and that characters specially interpreted by the
6
+ ## shell should not be escaped here.
7
+ ##
8
+ ## To make sure a value is disabled, use "unset <option>".
9
+ ##
10
+ ## For the options that take parameters, the default value is given.
11
+ ## Other options are unset by default.
12
+ ##
13
+ ## Quotes inside string parameters don't have to be escaped with
14
+ ## backslashes. The last double quote in the string will be treated as
15
+ ## its end. For example, for the "brackets" option, ""')>]}" will match
16
+ ## ", ', ), >, ], and }.
17
+
18
+ ## Use auto-indentation.
19
+ # set autoindent
20
+
21
+ ## Backup files to filename~.
22
+ # set backup
23
+
24
+ ## The directory to put unique backup files in.
25
+ # set backupdir ""
26
+
27
+ ## Do backwards searches by default.
28
+ # set backwards
29
+
30
+ ## Use bold text instead of reverse video text.
31
+ # set boldtext
32
+
33
+ ## The characters treated as closing brackets when justifying
34
+ ## paragraphs. They cannot contain blank characters. Only closing
35
+ ## punctuation, optionally followed by closing brackets, can end
36
+ ## sentences.
37
+ ##
38
+ # set brackets ""')>]}"
39
+
40
+ ## Do case sensitive searches by default.
41
+ # set casesensitive
42
+
43
+ ## Constantly display the cursor position in the statusbar. Note that
44
+ ## this overrides "quickblank".
45
+ # set const
46
+
47
+ ## Use cut to end of line by default.
48
+ # set cut
49
+
50
+ ## Set the line length for wrapping text and justifying paragraphs.
51
+ ## If fill is 0 or less, the line length will be the screen width less
52
+ ## this number.
53
+ ##
54
+ # set fill -8
55
+
56
+ ## Enable ~/.nano_history for saving and reading search/replace strings.
57
+ set historylog
58
+
59
+ ## The opening and closing brackets that can be found by bracket
60
+ ## searches. They cannot contain blank characters. The former set must
61
+ ## come before the latter set, and both must be in the same order.
62
+ ##
63
+ # set matchbrackets "(<[{)>]}"
64
+
65
+ ## Use the blank line below the titlebar as extra editing space.
66
+ # set morespace
67
+
68
+ ## Enable mouse support, if available for your system. When enabled,
69
+ ## mouse clicks can be used to place the cursor, set the mark (with a
70
+ ## double click), and execute shortcuts. The mouse will work in the X
71
+ ## Window System, and on the console when gpm is running.
72
+ ##
73
+ # set mouse
74
+
75
+ ## Allow multiple file buffers (inserting a file will put it into a
76
+ ## separate buffer). You must have configured with --enable-multibuffer
77
+ ## for this to work.
78
+ ##
79
+ # set multibuffer
80
+
81
+ ## Don't convert files from DOS/Mac format.
82
+ # set noconvert
83
+
84
+ ## Don't follow symlinks when writing files.
85
+ # set nofollow
86
+
87
+ ## Don't display the helpful shortcut lists at the bottom of the screen.
88
+ # set nohelp
89
+
90
+ ## Don't add newlines to the ends of files.
91
+ # set nonewlines
92
+
93
+ ## Don't wrap text at all.
94
+ # set nowrap
95
+
96
+ ## Set operating directory. nano will not read or write files outside
97
+ ## this directory and its subdirectories. Also, the current directory
98
+ ## is changed to here, so any files are inserted from this dir. A blank
99
+ ## string means the operating directory feature is turned off.
100
+ ##
101
+ # set operatingdir ""
102
+
103
+ ## Preserve the XON and XOFF keys (^Q and ^S).
104
+ # set preserve
105
+
106
+ ## The characters treated as closing punctuation when justifying
107
+ ## paragraphs. They cannot contain blank characters. Only closing
108
+ ## punctuation, optionally followed by closing brackets, can end
109
+ ## sentences.
110
+ ##
111
+ # set punct "!.?"
112
+
113
+ ## Do quick statusbar blanking. Statusbar messages will disappear after
114
+ ## 1 keystroke instead of 26. Note that "const" overrides this.
115
+ ##
116
+ # set quickblank
117
+
118
+ ## The email-quote string, used to justify email-quoted paragraphs.
119
+ ## This is an extended regular expression if your system supports them,
120
+ ## otherwise a literal string. Default:
121
+ # set quotestr "^([ ]*[#:>\|}])+"
122
+ ## if you have extended regular expression support, otherwise:
123
+ # set quotestr "> "
124
+
125
+ ## Fix Backspace/Delete confusion problem.
126
+ set rebinddelete
127
+
128
+ ## Fix numeric keypad key confusion problem.
129
+ # set rebindkeypad
130
+
131
+ ## Do extended regular expression searches by default.
132
+ # set regexp
133
+
134
+ ## Make the Home key smarter. When Home is pressed anywhere but at the
135
+ ## very beginning of non-whitespace characters on a line, the cursor
136
+ ## will jump to that beginning (either forwards or backwards). If the
137
+ ## cursor is already at that position, it will jump to the true
138
+ ## beginning of the line.
139
+ # set smarthome
140
+
141
+ ## Use smooth scrolling as the default.
142
+ # set smooth
143
+
144
+ ## Use this spelling checker instead of the internal one. This option
145
+ ## does not properly have a default value.
146
+ ##
147
+ # set speller "aspell -x -c"
148
+
149
+ ## Allow nano to be suspended.
150
+ set suspend
151
+
152
+ ## Use this tab size instead of the default; it must be greater than 0.
153
+ # set tabsize 8
154
+
155
+ ## Convert typed tabs to spaces.
156
+ # set tabstospaces
157
+
158
+ ## Save automatically on exit, don't prompt.
159
+ # set tempfile
160
+
161
+ ## Disallow file modification. Why would you want this in an rcfile? ;)
162
+ # set view
163
+
164
+ ## The two single-column characters used to display the first characters
165
+ ## of tabs and spaces. 187 in ISO 8859-1 (0000BB in Unicode) and 183 in
166
+ ## ISO-8859-1 (0000B7 in Unicode) seem to be good values for these.
167
+ # set whitespace " "
168
+
169
+ ## Detect word boundaries more accurately by treating punctuation
170
+ ## characters as parts of words.
171
+ # set wordbounds
172
+
173
+
174
+ ## Color setup
175
+ ##
176
+ ## Format:
177
+ ##
178
+ ## syntax "short description" ["filename regex" ...]
179
+ ##
180
+ ## The "none" syntax is reserved; specifying it on the command line is
181
+ ## the same as not having a syntax at all. The "default" syntax is
182
+ ## special: it takes no filename regexes, and applies to files that
183
+ ## don't match any other syntax's filename regexes.
184
+ ##
185
+ ## color foreground,background "regex" ["regex"...]
186
+ ## or
187
+ ## icolor foreground,background "regex" ["regex"...]
188
+ ##
189
+ ## "color" will do case sensitive matches, while "icolor" will do case
190
+ ## insensitive matches.
191
+ ##
192
+ ## Valid colors: white, black, red, blue, green, yellow, magenta, cyan.
193
+ ## For foreground colors, you may use the prefix "bright" to get a
194
+ ## stronger highlight.
195
+ ##
196
+ ## To use multi-line regexes, use the start="regex" end="regex"
197
+ ## [start="regex" end="regex"...] format.
198
+ ##
199
+ ## If your system supports transparency, not specifying a background
200
+ ## color will use a transparent color. If you don't want this, be sure
201
+ ## to set the background color to black or white.
202
+ ##
203
+ ## If you wish, you may put your syntaxes in separate files. You can
204
+ ## make use of such files (which can only include "syntax", "color", and
205
+ ## "icolor" commands) as follows:
206
+ ##
207
+ ## include "/path/to/syntax_file.nanorc"
208
+ ##
209
+ ## Unless otherwise noted, the name of the syntax file (without the
210
+ ## ".nanorc" extension) should be the same as the "short description"
211
+ ## name inside that file. These names are kept fairly short to make
212
+ ## them easier to remember and faster to type using nano's -Y option.
213
+ ##
214
+ ## All regexes should be extended regular expressions.
215
+
216
+
217
+ ## Nanorc files
218
+ # include "/usr/share/nano/nanorc.nanorc"
219
+
220
+ ## C/C++
221
+ # include "/usr/share/nano/c.nanorc"
222
+
223
+ ## HTML
224
+ # include "/usr/share/nano/html.nanorc"
225
+
226
+ ## TeX
227
+ # include "/usr/share/nano/tex.nanorc"
228
+
229
+ ## Quoted emails (under e.g. mutt)
230
+ # include "/usr/share/nano/mutt.nanorc"
231
+
232
+ ## Patch files
233
+ # include "/usr/share/nano/patch.nanorc"
234
+
235
+ ## Manpages
236
+ # include "/usr/share/nano/man.nanorc"
237
+
238
+ ## Groff
239
+ # include "/usr/share/nano/groff.nanorc"
240
+
241
+ ## Perl
242
+ # include "/usr/share/nano/perl.nanorc"
243
+
244
+ ## Python
245
+ # include "/usr/share/nano/python.nanorc"
246
+
247
+ ## Ruby
248
+ # include "/usr/share/nano/ruby.nanorc"
249
+
250
+ ## Java
251
+ # include "/usr/share/nano/java.nanorc"
252
+
253
+ ## Assembler
254
+ # include "/usr/share/nano/asm.nanorc"
255
+
256
+ ## Bourne shell scripts
257
+ # include "/usr/share/nano/sh.nanorc"
258
+
259
+ ## POV-Ray
260
+ # include "/usr/share/nano/pov.nanorc"
@@ -0,0 +1,2 @@
1
+ PassengerRoot /opt/<%= ruby_enterprise_version %>/lib/ruby/gems/1.8/gems/passenger-<%= passenger_version %>
2
+ PassengerRuby /opt/<%= ruby_enterprise_version %>/bin/ruby
@@ -0,0 +1 @@
1
+ LoadModule passenger_module /opt/<%= ruby_enterprise_version %>/lib/ruby/gems/1.8/gems/passenger-<%= passenger_version %>/ext/apache2/mod_passenger.so
@@ -0,0 +1,81 @@
1
+ # Package generated configuration file
2
+ # See the sshd(8) manpage for details
3
+
4
+ # What ports, IPs and protocols we listen for
5
+ Port <%= ssh_options[:port] %>
6
+ # Use these options to restrict which interfaces/protocols sshd will bind to
7
+ #ListenAddress ::
8
+ #ListenAddress 0.0.0.0
9
+ Protocol 2
10
+ # HostKeys for protocol version 2
11
+ HostKey /etc/ssh/ssh_host_rsa_key
12
+ HostKey /etc/ssh/ssh_host_dsa_key
13
+ #Privilege Separation is turned on for security
14
+ UsePrivilegeSeparation yes
15
+
16
+ # Lifetime and size of ephemeral version 1 server key
17
+ KeyRegenerationInterval 3600
18
+ ServerKeyBits 768
19
+
20
+ # Logging
21
+ SyslogFacility AUTH
22
+ LogLevel INFO
23
+
24
+ # Authentication:
25
+ LoginGraceTime 120
26
+ PermitRootLogin no
27
+ StrictModes yes
28
+
29
+ RSAAuthentication yes
30
+ PubkeyAuthentication yes
31
+ #AuthorizedKeysFile %h/.ssh/authorized_keys
32
+
33
+ # Don't read the user's ~/.rhosts and ~/.shosts files
34
+ IgnoreRhosts yes
35
+ # For this to work you will also need host keys in /etc/ssh_known_hosts
36
+ RhostsRSAAuthentication no
37
+ # similar for protocol version 2
38
+ HostbasedAuthentication no
39
+ # Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
40
+ #IgnoreUserKnownHosts yes
41
+
42
+ # To enable empty passwords, change to yes (NOT RECOMMENDED)
43
+ PermitEmptyPasswords no
44
+
45
+ # Change to yes to enable challenge-response passwords (beware issues with
46
+ # some PAM modules and threads)
47
+ ChallengeResponseAuthentication no
48
+
49
+ # Change to no to disable tunnelled clear text passwords
50
+ PasswordAuthentication no
51
+
52
+ # Kerberos options
53
+ #KerberosAuthentication no
54
+ #KerberosGetAFSToken no
55
+ #KerberosOrLocalPasswd yes
56
+ #KerberosTicketCleanup yes
57
+
58
+ # GSSAPI options
59
+ GSSAPIAuthentication no
60
+ #GSSAPICleanupCredentials yes
61
+
62
+ X11Forwarding no
63
+ X11DisplayOffset 10
64
+ PrintMotd no
65
+ PrintLastLog yes
66
+ KeepAlive yes
67
+ #UseLogin no
68
+
69
+ #MaxStartups 10:30:60
70
+ #Banner /etc/issue.net
71
+
72
+ # Allow client to pass locale environment variables
73
+ AcceptEnv LANG LC_*
74
+
75
+ Subsystem sftp /usr/lib/openssh/sftp-server
76
+
77
+ UsePAM no
78
+
79
+ UseDNS no
80
+
81
+ AllowUsers <%= user %>
@@ -0,0 +1,8 @@
1
+ <VirtualHost *:80>
2
+
3
+ ServerName <%= domain %>
4
+ ServerAlias www.<%= domain %>
5
+
6
+ DocumentRoot <%= current_path %>/public
7
+
8
+ </VirtualHost>
@@ -0,0 +1,23 @@
1
+ server {
2
+ listen 80;
3
+ server_name <%= domain %>;
4
+
5
+ root <%= current_path %>/public;
6
+
7
+ client_max_body_size 10m;
8
+ client_body_buffer_size 128k;
9
+
10
+ access_log <%= nginx_path %>/logs/<%= domain %>.access.log;
11
+ error_log <%= nginx_path %>/logs/<%= domain %>.error.log;
12
+
13
+
14
+ passenger_enabled on;
15
+ rails_env production;
16
+
17
+ # this rewrites all the requests to the maintenance.html
18
+ # page if it exists in the doc root. This is for capistrano's
19
+ # disable web task
20
+ if (-f $document_root/system/maintenance.html) {
21
+ rewrite ^(.*)$ /system/maintenance.html break;
22
+ }
23
+ }
@@ -0,0 +1,4 @@
1
+ set nocompatible
2
+ syntax enable
3
+ set autoindent
4
+ filetype plugin indent on
@@ -0,0 +1,68 @@
1
+ ssh_options = { :keys => [File.expand_path("~/.ssh/id_dsa"),File.expand_path("~/.ssh/id_rsa") ], :port => 22 }
2
+
3
+ namespace :useradd do
4
+
5
+ def ask_with_default(var, default)
6
+ set(var) do
7
+ Capistrano::CLI.ui.ask "#{var}? [#{default}] : "
8
+ end
9
+
10
+ set var, default if eval("#{var.to_s}.empty?")
11
+ end
12
+
13
+ desc <<-DESC
14
+ Check that %sudo entry exists in the /etc/sudoers file. If the entry \
15
+ for the sudo group is not found then %sudo ALL=NOPASSWD: ALL is appended \
16
+ to the file. This makes it easy to create sudo users with this command.
17
+
18
+ NOTE: this tasks requires the role 'gateway_as_root', i.e., root@host.com.
19
+ DESC
20
+ task :check_sudoers, :roles => :gateway_as_root do
21
+ sudo <<-END
22
+ sh -c 'grep -F "^%sudo " /etc/sudoers > /dev/null 2>&1 || test ! -f /etc/sudoers || echo "%sudo ALL=NOPASSWD: ALL" >> /etc/sudoers'
23
+ END
24
+ end
25
+
26
+ desc <<-DESC
27
+ Interactive adduser with login, groups and shell.
28
+
29
+ Creates a login account on the remote host and uploads your local \
30
+ public SSH keys to the server. The keys are placed into the .ssh folder of \
31
+ the newly created account.
32
+
33
+ A final check is done to make sure %sudo entry exists in the \
34
+ /etc/sudoers file. If the entry for the sudo group is not found then %sudo \
35
+ ALL=NOPASSWD: ALL is appended to the file. This makes it easy to create sudo \
36
+ users with this command.
37
+
38
+ NOTE: this tasks requires the role 'gateway_as_root', i.e., root@host.com.
39
+ DESC
40
+ task :setup, :roles => :gateway_as_root do
41
+ ask_with_default(:username, user)
42
+ ask_with_default(:groups, "users,sudo")
43
+ ask_with_default(:login_shell, "/bin/bash")
44
+
45
+ authorized_keys = ssh_options[:keys].collect { |key|
46
+ begin
47
+ File.read("#{key}.pub")
48
+ rescue Errno::ENOENT
49
+ end
50
+ }.join("\n")
51
+
52
+ sudo "useradd -s #{login_shell} -G #{groups} -m #{username}"
53
+
54
+ put(authorized_keys,
55
+ "/tmp/authorized_keys.#{username}.tmp", :mode => 0600 )
56
+ cmds = [
57
+ "mkdir -p ~#{username}/.ssh",
58
+ "mv /tmp/authorized_keys.#{username}.tmp ~#{username}/.ssh/authorized_keys",
59
+ "chown -R #{username}:#{username} ~#{username}/.ssh",
60
+ "chmod 700 ~#{username}/.ssh"
61
+ ]
62
+ cmds.each do |cmd|
63
+ sudo cmd
64
+ end
65
+
66
+ check_sudoers
67
+ end
68
+ end