teknobingo-recipes 0.1.39
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.
- checksums.yaml +15 -0
- data/.gitignore +3 -0
- data/Gemfile +4 -0
- data/LICENSE +1 -0
- data/README.rdoc +18 -0
- data/Rakefile +2 -0
- data/lib/teknobingo_recipes.rb +1 -0
- data/lib/teknobingo_recipes/helpers.rb +67 -0
- data/lib/teknobingo_recipes/recipes/apache.rb +62 -0
- data/lib/teknobingo_recipes/recipes/base.rb +16 -0
- data/lib/teknobingo_recipes/recipes/check.rb +13 -0
- data/lib/teknobingo_recipes/recipes/logrotate.rb +9 -0
- data/lib/teknobingo_recipes/recipes/memcached.rb +24 -0
- data/lib/teknobingo_recipes/recipes/mogilefs.rb +146 -0
- data/lib/teknobingo_recipes/recipes/nfs.rb +99 -0
- data/lib/teknobingo_recipes/recipes/nginx.rb +75 -0
- data/lib/teknobingo_recipes/recipes/nodejs.rb +15 -0
- data/lib/teknobingo_recipes/recipes/passenger.rb +68 -0
- data/lib/teknobingo_recipes/recipes/postgresql.rb +44 -0
- data/lib/teknobingo_recipes/recipes/profile.rb +43 -0
- data/lib/teknobingo_recipes/recipes/rainbows.rb +83 -0
- data/lib/teknobingo_recipes/recipes/rbenv.rb +40 -0
- data/lib/teknobingo_recipes/recipes/redis.rb +31 -0
- data/lib/teknobingo_recipes/version.rb +3 -0
- data/teknobingo-recipes.gemspec +27 -0
- data/templates/bash/lesslog.sh +1 -0
- data/templates/bash/profile +1 -0
- data/templates/bash/prompt.sh +13 -0
- data/templates/bash/railsc.sh +1 -0
- data/templates/bash/taillog.sh +1 -0
- data/templates/init.d/nginx +362 -0
- data/templates/logrotate.erb +14 -0
- data/templates/memcached.erb +16 -0
- data/templates/mogilefsd_conf.erb +7 -0
- data/templates/mogstored_conf.erb +3 -0
- data/templates/nginx.conf.erb +23 -0
- data/templates/passenger_mod.erb +3 -0
- data/templates/postgresql.yml.erb +8 -0
- data/templates/redis_conf.erb +419 -0
- data/templates/vhosts/http_site.erb +7 -0
- metadata +98 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
for f in ~/.bash/*.sh; do source $f; done
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<%
|
|
2
|
+
color = case rails_env
|
|
3
|
+
when 'production'
|
|
4
|
+
31 # red
|
|
5
|
+
when 'experimental'
|
|
6
|
+
32 # green
|
|
7
|
+
when 'stage'
|
|
8
|
+
35 # purple
|
|
9
|
+
else
|
|
10
|
+
36 # cyan
|
|
11
|
+
end
|
|
12
|
+
%>
|
|
13
|
+
PS1=<%= "\"\\[\\033[1;34m\\]\\u@\\[\\033[1;#{color}m\\]\\H\\[\\033[1;34m\\]:\\w$\\[\\033[0m\\] \"" %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
alias railsc=<%= "'cd ~/sites/#{application}/current; bundle exec rails c'" %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
alias taillog=<%= "'tail -f -n0 ~/sites/#{application}/shared/log/*'" %>
|
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
#! /bin/sh
|
|
2
|
+
### BEGIN INIT INFO
|
|
3
|
+
# Provides: nginx
|
|
4
|
+
# Required-Start: $remote_fs $syslog
|
|
5
|
+
# Required-Stop: $remote_fs $syslog
|
|
6
|
+
# Default-Start: 2 3 4 5
|
|
7
|
+
# Default-Stop: 0 1 6
|
|
8
|
+
# Short-Description: nginx init.d dash script for Ubuntu or other *nix.
|
|
9
|
+
# Description: nginx init.d dash script for Ubuntu or other *nix.
|
|
10
|
+
### END INIT INFO
|
|
11
|
+
#------------------------------------------------------------------------------
|
|
12
|
+
# nginx - this Debian Almquist shell (dash) script, starts and stops the nginx
|
|
13
|
+
# daemon for Ubuntu and other *nix releases.
|
|
14
|
+
#
|
|
15
|
+
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
|
|
16
|
+
# proxy and IMAP/POP3 proxy server. This \
|
|
17
|
+
# script will manage the initiation of the \
|
|
18
|
+
# server and it's process state.
|
|
19
|
+
#
|
|
20
|
+
# processname: nginx
|
|
21
|
+
# config: /opt/nginx/conf/nginx.conf
|
|
22
|
+
# pidfile: /opt/nginx/logs/nginx.pid
|
|
23
|
+
# Provides: nginx
|
|
24
|
+
#
|
|
25
|
+
# Author: Jason Giedymin
|
|
26
|
+
# <jason.giedymin AT gmail.com>.
|
|
27
|
+
#
|
|
28
|
+
# Version: 3.0 22-APR-2013 jason.giedymin AT gmail.com
|
|
29
|
+
# Notes: nginx init.d dash script for Ubuntu.
|
|
30
|
+
# Tested with: Ubuntu 12.10, nginx-1.3.16
|
|
31
|
+
#
|
|
32
|
+
# This script's project home is:
|
|
33
|
+
# http://github.com/JasonGiedymin/nginx-init-ubuntu
|
|
34
|
+
#
|
|
35
|
+
#------------------------------------------------------------------------------
|
|
36
|
+
# MIT X11 License
|
|
37
|
+
#------------------------------------------------------------------------------
|
|
38
|
+
#
|
|
39
|
+
# Copyright (c) 2008-2013 Jason Giedymin, http://jasongiedymin.com
|
|
40
|
+
#
|
|
41
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
|
42
|
+
# a copy of this software and associated documentation files (the
|
|
43
|
+
# "Software"), to deal in the Software without restriction, including
|
|
44
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
|
45
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
|
46
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
|
47
|
+
# the following conditions:
|
|
48
|
+
#
|
|
49
|
+
# The above copyright notice and this permission notice shall be
|
|
50
|
+
# included in all copies or substantial portions of the Software.
|
|
51
|
+
#
|
|
52
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
53
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
54
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
55
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
56
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
57
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
58
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
59
|
+
#------------------------------------------------------------------------------
|
|
60
|
+
|
|
61
|
+
#------------------------------------------------------------------------------
|
|
62
|
+
# Functions
|
|
63
|
+
#------------------------------------------------------------------------------
|
|
64
|
+
. /lib/lsb/init-functions
|
|
65
|
+
|
|
66
|
+
#------------------------------------------------------------------------------
|
|
67
|
+
# Consts
|
|
68
|
+
#------------------------------------------------------------------------------
|
|
69
|
+
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
|
70
|
+
DAEMON=/opt/nginx/sbin/nginx
|
|
71
|
+
|
|
72
|
+
PS="nginx"
|
|
73
|
+
PIDNAME="nginx" #lets you do $PS-slave
|
|
74
|
+
PIDFILE=$PIDNAME.pid #pid file
|
|
75
|
+
PIDSPATH=/opt/nginx/logs #default pid location, you should change it
|
|
76
|
+
|
|
77
|
+
DESCRIPTION="Nginx Server..."
|
|
78
|
+
|
|
79
|
+
RUNAS=root #user to run as
|
|
80
|
+
|
|
81
|
+
SCRIPT_OK=0 #ala error codes
|
|
82
|
+
SCRIPT_ERROR=1 #ala error codes
|
|
83
|
+
TRUE=1 #boolean
|
|
84
|
+
FALSE=0 #boolean
|
|
85
|
+
|
|
86
|
+
lockfile=/var/lock/subsys/nginx
|
|
87
|
+
NGINX_CONF_FILE="/opt/nginx/conf/nginx.conf"
|
|
88
|
+
|
|
89
|
+
#------------------------------------------------------------------------------
|
|
90
|
+
# Simple Tests
|
|
91
|
+
#------------------------------------------------------------------------------
|
|
92
|
+
|
|
93
|
+
#test if nginx is a file and executable
|
|
94
|
+
test -x $DAEMON || exit 0
|
|
95
|
+
|
|
96
|
+
# Include nginx defaults if available
|
|
97
|
+
if [ -f /etc/default/nginx ] ; then
|
|
98
|
+
. /etc/default/nginx
|
|
99
|
+
fi
|
|
100
|
+
|
|
101
|
+
#set exit condition
|
|
102
|
+
#set -e
|
|
103
|
+
|
|
104
|
+
#------------------------------------------------------------------------------
|
|
105
|
+
# Functions
|
|
106
|
+
#------------------------------------------------------------------------------
|
|
107
|
+
|
|
108
|
+
setFilePerms(){
|
|
109
|
+
if [ -f $PIDSPATH/$PIDFILE ]; then
|
|
110
|
+
chmod 400 $PIDSPATH/$PIDFILE
|
|
111
|
+
fi
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
configtest() {
|
|
115
|
+
$DAEMON -t -c $NGINX_CONF_FILE
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
getPSCount() {
|
|
119
|
+
return `pgrep -f $PS | wc -l`
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
isRunning() {
|
|
123
|
+
if [ $1 ]; then
|
|
124
|
+
pidof_daemon $1
|
|
125
|
+
PID=$?
|
|
126
|
+
|
|
127
|
+
if [ $PID -gt 0 ]; then
|
|
128
|
+
return 1
|
|
129
|
+
else
|
|
130
|
+
return 0
|
|
131
|
+
fi
|
|
132
|
+
else
|
|
133
|
+
pidof_daemon
|
|
134
|
+
PID=$?
|
|
135
|
+
|
|
136
|
+
if [ $PID -gt 0 ]; then
|
|
137
|
+
return 1
|
|
138
|
+
else
|
|
139
|
+
return 0
|
|
140
|
+
fi
|
|
141
|
+
fi
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
#courtesy of php-fpm
|
|
145
|
+
wait_for_pid () {
|
|
146
|
+
try=0
|
|
147
|
+
|
|
148
|
+
while test $try -lt 35 ; do
|
|
149
|
+
case "$1" in
|
|
150
|
+
'created')
|
|
151
|
+
if [ -f "$2" ] ; then
|
|
152
|
+
try=''
|
|
153
|
+
break
|
|
154
|
+
fi
|
|
155
|
+
;;
|
|
156
|
+
|
|
157
|
+
'removed')
|
|
158
|
+
if [ ! -f "$2" ] ; then
|
|
159
|
+
try=''
|
|
160
|
+
break
|
|
161
|
+
fi
|
|
162
|
+
;;
|
|
163
|
+
esac
|
|
164
|
+
|
|
165
|
+
try=`expr $try + 1`
|
|
166
|
+
sleep 1
|
|
167
|
+
done
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
status(){
|
|
171
|
+
isRunning
|
|
172
|
+
isAlive=$?
|
|
173
|
+
|
|
174
|
+
if [ "${isAlive}" -eq $TRUE ]; then
|
|
175
|
+
echo "$PIDNAME found running with processes: `pidof $PS`"
|
|
176
|
+
else
|
|
177
|
+
echo "$PIDNAME is NOT running."
|
|
178
|
+
fi
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
removePIDFile(){
|
|
182
|
+
if [ $1 ]; then
|
|
183
|
+
if [ -f $1 ]; then
|
|
184
|
+
rm -f $1
|
|
185
|
+
fi
|
|
186
|
+
else
|
|
187
|
+
#Do default removal
|
|
188
|
+
if [ -f $PIDSPATH/$PIDFILE ]; then
|
|
189
|
+
rm -f $PIDSPATH/$PIDFILE
|
|
190
|
+
fi
|
|
191
|
+
fi
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
start() {
|
|
195
|
+
log_daemon_msg "Starting $DESCRIPTION"
|
|
196
|
+
|
|
197
|
+
isRunning
|
|
198
|
+
isAlive=$?
|
|
199
|
+
|
|
200
|
+
if [ "${isAlive}" -eq $TRUE ]; then
|
|
201
|
+
log_end_msg $SCRIPT_ERROR
|
|
202
|
+
else
|
|
203
|
+
start-stop-daemon --start --quiet --chuid \
|
|
204
|
+
$RUNAS --pidfile $PIDSPATH/$PIDFILE --exec $DAEMON \
|
|
205
|
+
-- -c $NGINX_CONF_FILE
|
|
206
|
+
setFilePerms
|
|
207
|
+
log_end_msg $SCRIPT_OK
|
|
208
|
+
fi
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
stop() {
|
|
212
|
+
log_daemon_msg "Stopping $DESCRIPTION"
|
|
213
|
+
|
|
214
|
+
isRunning
|
|
215
|
+
isAlive=$?
|
|
216
|
+
|
|
217
|
+
if [ "${isAlive}" -eq $TRUE ]; then
|
|
218
|
+
start-stop-daemon --stop --quiet --pidfile $PIDSPATH/$PIDFILE
|
|
219
|
+
|
|
220
|
+
wait_for_pid 'removed' $PIDSPATH/$PIDFILE
|
|
221
|
+
|
|
222
|
+
if [ -n "$try" ] ; then
|
|
223
|
+
log_end_msg $SCRIPT_ERROR
|
|
224
|
+
else
|
|
225
|
+
removePIDFile
|
|
226
|
+
log_end_msg $SCRIPT_OK
|
|
227
|
+
fi
|
|
228
|
+
else
|
|
229
|
+
log_end_msg $SCRIPT_ERROR
|
|
230
|
+
fi
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
reload() {
|
|
234
|
+
configtest || return $?
|
|
235
|
+
|
|
236
|
+
log_daemon_msg "Reloading (via HUP) $DESCRIPTION"
|
|
237
|
+
|
|
238
|
+
isRunning
|
|
239
|
+
|
|
240
|
+
if [ $? -eq $TRUE ]; then
|
|
241
|
+
`killall -HUP $PS` #to be safe
|
|
242
|
+
log_end_msg $SCRIPT_OK
|
|
243
|
+
else
|
|
244
|
+
log_end_msg $SCRIPT_ERROR
|
|
245
|
+
fi
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
quietupgrade() {
|
|
249
|
+
log_daemon_msg "Peforming Quiet Upgrade $DESCRIPTION"
|
|
250
|
+
|
|
251
|
+
isRunning
|
|
252
|
+
isAlive=$?
|
|
253
|
+
|
|
254
|
+
if [ "${isAlive}" -eq $TRUE ]; then
|
|
255
|
+
kill -USR2 `cat $PIDSPATH/$PIDFILE`
|
|
256
|
+
kill -WINCH `cat $PIDSPATH/$PIDFILE.oldbin`
|
|
257
|
+
|
|
258
|
+
isRunning
|
|
259
|
+
isAlive=$?
|
|
260
|
+
|
|
261
|
+
if [ "${isAlive}" -eq $TRUE ]; then
|
|
262
|
+
kill -QUIT `cat $PIDSPATH/$PIDFILE.oldbin`
|
|
263
|
+
wait_for_pid 'removed' $PIDSPATH/$PIDFILE.oldbin
|
|
264
|
+
removePIDFile $PIDSPATH/$PIDFILE.oldbin
|
|
265
|
+
|
|
266
|
+
log_end_msg $SCRIPT_OK
|
|
267
|
+
else
|
|
268
|
+
log_end_msg $SCRIPT_ERROR
|
|
269
|
+
|
|
270
|
+
log_daemon_msg "ERROR! Reverting back to original $DESCRIPTION"
|
|
271
|
+
|
|
272
|
+
kill -HUP `cat $PIDSPATH/$PIDFILE`
|
|
273
|
+
kill -TERM `cat $PIDSPATH/$PIDFILE.oldbin`
|
|
274
|
+
kill -QUIT `cat $PIDSPATH/$PIDFILE.oldbin`
|
|
275
|
+
|
|
276
|
+
wait_for_pid 'removed' $PIDSPATH/$PIDFILE.oldbin
|
|
277
|
+
removePIDFile $PIDSPATH/$PIDFILE.oldbin
|
|
278
|
+
|
|
279
|
+
log_end_msg $SCRIPT_ok
|
|
280
|
+
fi
|
|
281
|
+
else
|
|
282
|
+
log_end_msg $SCRIPT_ERROR
|
|
283
|
+
fi
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
terminate() {
|
|
287
|
+
log_daemon_msg "Force terminating (via KILL) $DESCRIPTION"
|
|
288
|
+
|
|
289
|
+
PIDS=`pidof $PS` || true
|
|
290
|
+
|
|
291
|
+
[ -e $PIDSPATH/$PIDFILE ] && PIDS2=`cat $PIDSPATH/$PIDFILE`
|
|
292
|
+
|
|
293
|
+
for i in $PIDS; do
|
|
294
|
+
if [ "$i" = "$PIDS2" ]; then
|
|
295
|
+
kill $i
|
|
296
|
+
wait_for_pid 'removed' $PIDSPATH/$PIDFILE
|
|
297
|
+
removePIDFile
|
|
298
|
+
fi
|
|
299
|
+
done
|
|
300
|
+
|
|
301
|
+
log_end_msg $SCRIPT_OK
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
destroy() {
|
|
305
|
+
log_daemon_msg "Force terminating and may include self (via KILLALL) $DESCRIPTION"
|
|
306
|
+
killall $PS -q >> /dev/null 2>&1
|
|
307
|
+
log_end_msg $SCRIPT_OK
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
pidof_daemon() {
|
|
311
|
+
PIDS=`pidof $PS` || true
|
|
312
|
+
|
|
313
|
+
[ -e $PIDSPATH/$PIDFILE ] && PIDS2=`cat $PIDSPATH/$PIDFILE`
|
|
314
|
+
|
|
315
|
+
for i in $PIDS; do
|
|
316
|
+
if [ "$i" = "$PIDS2" ]; then
|
|
317
|
+
return 1
|
|
318
|
+
fi
|
|
319
|
+
done
|
|
320
|
+
|
|
321
|
+
return 0
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
case "$1" in
|
|
325
|
+
start)
|
|
326
|
+
start
|
|
327
|
+
;;
|
|
328
|
+
stop)
|
|
329
|
+
stop
|
|
330
|
+
;;
|
|
331
|
+
restart|force-reload)
|
|
332
|
+
stop
|
|
333
|
+
sleep 1
|
|
334
|
+
start
|
|
335
|
+
;;
|
|
336
|
+
reload)
|
|
337
|
+
$1
|
|
338
|
+
;;
|
|
339
|
+
status)
|
|
340
|
+
status
|
|
341
|
+
;;
|
|
342
|
+
configtest)
|
|
343
|
+
$1
|
|
344
|
+
;;
|
|
345
|
+
quietupgrade)
|
|
346
|
+
$1
|
|
347
|
+
;;
|
|
348
|
+
terminate)
|
|
349
|
+
$1
|
|
350
|
+
;;
|
|
351
|
+
destroy)
|
|
352
|
+
$1
|
|
353
|
+
;;
|
|
354
|
+
*)
|
|
355
|
+
FULLPATH=/etc/init.d/$PS
|
|
356
|
+
echo "Usage: $FULLPATH {start|stop|restart|force-reload|status|configtest|quietupgrade|terminate|destroy}"
|
|
357
|
+
echo " The 'destroy' command should only be used as a last resort."
|
|
358
|
+
exit 1
|
|
359
|
+
;;
|
|
360
|
+
esac
|
|
361
|
+
|
|
362
|
+
exit 0
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Rotate Rails application logs daily
|
|
2
|
+
/home/capistrano/sites/<%= application %>/shared/log/*.log {
|
|
3
|
+
rotate 30
|
|
4
|
+
daily
|
|
5
|
+
dateformat %Y%m%d.
|
|
6
|
+
dateext
|
|
7
|
+
extension log
|
|
8
|
+
olddir /var/log/sites/<%= application %>
|
|
9
|
+
missingok
|
|
10
|
+
compress
|
|
11
|
+
delaycompress
|
|
12
|
+
notifempty
|
|
13
|
+
copytruncate
|
|
14
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
worker_processes 1;
|
|
2
|
+
|
|
3
|
+
events {
|
|
4
|
+
worker_connections 1024;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
http {
|
|
8
|
+
passenger_root <%= passenger_root %>;
|
|
9
|
+
passenger_ruby <%= passenger_ruby %>;
|
|
10
|
+
|
|
11
|
+
include mime.types;
|
|
12
|
+
default_type application/octet-stream;
|
|
13
|
+
|
|
14
|
+
sendfile on;
|
|
15
|
+
keepalive_timeout 65;
|
|
16
|
+
|
|
17
|
+
map $http_upgrade $connection_upgrade {
|
|
18
|
+
default upgrade;
|
|
19
|
+
'' close;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
include /opt/nginx/sites-enabled/*.site;
|
|
23
|
+
}
|