capistrano3-puma 1.2.1 → 6.0.0.beta.1

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.
@@ -1,336 +0,0 @@
1
- #! /bin/sh
2
- ### BEGIN INIT INFO
3
- # Provides: puma
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: Example initscript
9
- # Description: This file should be used to construct scripts to be
10
- # placed in /etc/init.d.
11
- ### END INIT INFO
12
-
13
- # Author: Darío Javier Cravero <'dario@exordo.com'>
14
- # Modified by: Abdelkader Boudih <'terminale@gmail.com'>
15
- #
16
- # Do NOT "set -e"
17
-
18
- # PATH should only include /usr/* if it runs after the mountnfs.sh script
19
- PATH=/usr/local/bin:/usr/local/sbin/:/sbin:/usr/sbin:/bin:/usr/bin
20
- DESC="Puma rack web server"
21
- NAME=puma
22
- DAEMON=$NAME
23
- SCRIPTNAME=/etc/init.d/$NAME
24
- CONFIG=<%=fetch(:puma_jungle_conf)%>
25
- JUNGLE=`cat $CONFIG`
26
- RUNPUMA=<%=fetch(:puma_run_path)%>
27
-
28
- # Load the VERBOSE setting and other rcS variables
29
- . /lib/init/vars.sh
30
-
31
- # Define LSB log_* functions.
32
- # Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
33
- . /lib/lsb/init-functions
34
-
35
- #
36
- # Function that starts the jungle
37
- #
38
- do_start() {
39
- log_daemon_msg "=> Running the jungle..."
40
- for i in $JUNGLE; do
41
- dir=`echo $i | cut -d , -f 1`
42
- user=`echo $i | cut -d , -f 2`
43
- config_file=`echo $i | cut -d , -f 3`
44
- if [ "$config_file" = "" ]; then
45
- config_file="$dir/config/puma.rb"
46
- fi
47
- log_file=`echo $i | cut -d , -f 4`
48
- if [ "$log_file" = "" ]; then
49
- log_file="$dir/log/puma.log"
50
- fi
51
- do_start_one $dir $user $config_file $log_file
52
- done
53
- }
54
-
55
- do_start_one() {
56
- PIDFILE=$1/tmp/pids/puma.pid
57
- if [ -e $PIDFILE ]; then
58
- PID=`cat $PIDFILE`
59
- # If the puma isn't running, run it, otherwise restart it.
60
- if [ "`ps -A -o pid= | grep -c $PID`" -eq 0 ]; then
61
- do_start_one_do $1 $2
62
- else
63
- do_restart_one $1 $2
64
- fi
65
- else
66
- do_start_one_do $1 $2
67
- fi
68
- }
69
-
70
- do_start_one_do() {
71
- log_daemon_msg "--> Woke up puma $1"
72
- log_daemon_msg "user $2"
73
- log_daemon_msg "log to $4"
74
- log_daemon_msg "start-stop-daemon --verbose --start --chdir $1 --chuid $2 --background --exec $RUNPUMA $1 "
75
- start-stop-daemon --verbose --start --chdir $1 --chuid $2 --background --exec $RUNPUMA -- $1
76
- }
77
-
78
- #
79
- # Function that stops the jungle
80
- #
81
- do_stop() {
82
- log_daemon_msg "=> Putting all the beasts to bed..."
83
- for i in $JUNGLE; do
84
- dir=`echo $i | cut -d , -f 1`
85
- user=`echo $i | cut -d , -f 2`
86
- do_stop_one $dir $user
87
- done
88
- }
89
- #
90
- # Function that stops the daemon/service
91
- #
92
- do_stop_one() {
93
- log_daemon_msg "--> Stopping $1"
94
- PIDFILE=$1/tmp/pids/puma.pid
95
- STATEFILE=$1/tmp/pids/puma.state
96
- if [ -e $PIDFILE ]; then
97
- PID=`cat $PIDFILE`
98
- if [ "`ps -A -o pid= | grep -c $PID`" -eq 0 ]; then
99
- log_daemon_msg "---> Puma $1 isn't running."
100
- else
101
- log_daemon_msg "---> About to kill PID `cat $PIDFILE`"
102
- su - $2 -c "pumactl --state $STATEFILE stop"
103
- # Many daemons don't delete their pidfiles when they exit.
104
- rm -f $PIDFILE $STATEFILE
105
- fi
106
- else
107
- log_daemon_msg "---> No puma here..."
108
- fi
109
- return 0
110
- }
111
-
112
- #
113
- # Function that restarts the jungle
114
- #
115
- do_restart() {
116
- for i in $JUNGLE; do
117
- dir=`echo $i | cut -d , -f 1`
118
- user=`echo $i | cut -d , -f 2`
119
- do_restart_one $dir $user
120
- done
121
- }
122
-
123
- #
124
- # Function that sends a SIGUSR2 to the daemon/service
125
- #
126
- do_restart_one() {
127
- PIDFILE=$1/tmp/pids/puma.pid
128
- i=`grep $1 $CONFIG`
129
- dir=`echo $i | cut -d , -f 1`
130
-
131
- if [ -e $PIDFILE ]; then
132
- log_daemon_msg "--> About to restart puma $1"
133
- su - $2 -c "pumactl --state $dir/tmp/pids/puma.state restart"
134
- # kill -s USR2 `cat $PIDFILE`
135
- # TODO Check if process exist
136
- else
137
- log_daemon_msg "--> Your puma was never playing... Let's get it out there first"
138
- user=`echo $i | cut -d , -f 2`
139
- config_file=`echo $i | cut -d , -f 3`
140
- if [ "$config_file" = "" ]; then
141
- config_file="$dir/config/puma.rb"
142
- do_start_one $dir $user $config_file
143
- fi
144
- log_file=`echo $i | cut -d , -f 4`
145
- if [ "$log_file" = "" ]; then
146
- log_file="$dir/log/puma.log"
147
- fi
148
- do_start_one $dir $user $config_file $log_file
149
- fi
150
- return 0
151
- }
152
-
153
- #
154
- # Function that statuss the jungle
155
- #
156
- do_status() {
157
- for i in $JUNGLE; do
158
- dir=`echo $i | cut -d , -f 1`
159
- user=`echo $i | cut -d , -f 2`
160
- do_status_one $dir $user
161
- done
162
- }
163
-
164
- #
165
- # Function that sends a SIGUSR2 to the daemon/service
166
- #
167
- do_status_one() {
168
- PIDFILE=$1/tmp/pids/puma.pid
169
- i=`grep $1 $CONFIG`
170
- dir=`echo $i | cut -d , -f 1`
171
-
172
- if [ -e $PIDFILE ]; then
173
- log_daemon_msg "--> About to status puma $1"
174
-
175
- su - $2 -c "pumactl --state $dir/tmp/pids/puma.state stats "
176
-
177
- else
178
- log_daemon_msg "--> $1 isn't there :(..."
179
- fi
180
- return 0
181
- }
182
-
183
- do_add() {
184
- str=""
185
- # App's directory
186
- if [ -d "$1" ]; then
187
- if [ "`grep -c "^$1" $CONFIG`" -eq 0 ]; then
188
- str=$1
189
- else
190
- echo "The app is already being managed. Remove it if you want to update its config."
191
- exit 0
192
- fi
193
- else
194
- echo "The directory $1 doesn't exist."
195
- exit 1
196
- fi
197
- # User to run it as
198
- if [ "`grep -c "^$2:" /etc/passwd`" -eq 0 ]; then
199
- echo "The user $2 doesn't exist."
200
- exit 1
201
- else
202
- str="$str,$2"
203
- fi
204
- # Config file
205
- if [ "$3" != "" ]; then
206
- if [ -e $3 ]; then
207
- str="$str,$3"
208
- else
209
- echo "The config file $3 doesn't exist."
210
- exit 1
211
- fi
212
- fi
213
- # Log file
214
- if [ "$4" != "" ]; then
215
- str="$str,$4"
216
- fi
217
-
218
- # Add it to the jungle
219
- echo $str >> $CONFIG
220
- log_daemon_msg "Added a Puma to the jungle: $str. You still have to start it though."
221
- }
222
-
223
- do_remove() {
224
- if [ "`grep -c "^$1" $CONFIG`" -eq 0 ]; then
225
- echo "There's no app $1 to remove."
226
- else
227
- # Stop it first.
228
- do_stop_one $1
229
- # Remove it from the config.
230
- sed -i "\\:^$1:d" $CONFIG
231
- log_daemon_msg "Removed a Puma from the jungle: $1."
232
- fi
233
- }
234
-
235
- case "$1" in
236
- start)
237
- [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
238
- if [ "$#" -eq 1 ]; then
239
- do_start
240
- else
241
- i=`grep $2 $CONFIG`
242
- dir=`echo $i | cut -d , -f 1`
243
- user=`echo $i | cut -d , -f 2`
244
- config_file=`echo $i | cut -d , -f 3`
245
- if [ "$config_file" = "" ]; then
246
- config_file="$dir/config/puma.rb"
247
-
248
- do_start_one $dir $user $config_file
249
- fi
250
- case "$?" in
251
- 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
252
- 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
253
- esac
254
- fi
255
- ;;
256
- stop)
257
- [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
258
- if [ "$#" -eq 1 ]; then
259
- do_stop
260
- else
261
- i=`grep $2 $CONFIG`
262
- dir=`echo $i | cut -d , -f 1`
263
- do_stop_one $dir
264
- fi
265
- case "$?" in
266
- 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
267
- 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
268
- esac
269
- ;;
270
- status)
271
- # TODO Implement.
272
- log_daemon_msg "Status $DESC" "$NAME"
273
- if [ "$#" -eq 1 ]; then
274
- do_status
275
- else
276
- i=`grep $2 $CONFIG`
277
- dir=`echo $i | cut -d , -f 1`
278
- do_status_one $dir
279
- fi
280
- case "$?" in
281
- 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
282
- 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
283
- esac
284
- ;;
285
- restart)
286
- log_daemon_msg "Restarting $DESC" "$NAME"
287
- if [ "$#" -eq 1 ]; then
288
- do_restart
289
- else
290
- i=`grep $2 $CONFIG`
291
- dir=`echo $i | cut -d , -f 1`
292
- do_restart_one $dir
293
- fi
294
- case "$?" in
295
- 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
296
- 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
297
- esac
298
- ;;
299
- add)
300
- if [ "$#" -lt 3 ]; then
301
- echo "Please, specifiy the app's directory and the user that will run it at least."
302
- echo " Usage: $SCRIPTNAME add /path/to/app user /path/to/app/config/puma.rb /path/to/app/config/log/puma.log"
303
- echo " config and log are optionals."
304
- exit 1
305
- else
306
- do_add $2 $3 $4 $5
307
- fi
308
- case "$?" in
309
- 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
310
- 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
311
- esac
312
- ;;
313
- remove)
314
- if [ "$#" -lt 2 ]; then
315
- echo "Please, specifiy the app's directory to remove."
316
- exit 1
317
- else
318
- do_remove $2
319
- fi
320
- case "$?" in
321
- 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
322
- 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
323
- esac
324
- ;;
325
- *)
326
- echo "Usage:" >&2
327
- echo " Run the jungle: $SCRIPTNAME {start|stop|status|restart}" >&2
328
- echo " Add a Puma: $SCRIPTNAME add /path/to/app user /path/to/app/config/puma.rb /path/to/app/config/log/puma.log"
329
- echo " config and log are optionals."
330
- echo " Remove a Puma: $SCRIPTNAME remove /path/to/app"
331
- echo " On a Puma: $SCRIPTNAME {start|stop|status|restart} PUMA-NAME" >&2
332
- exit 3
333
- ;;
334
- esac
335
- :
336
-
@@ -1,328 +0,0 @@
1
- #!/bin/sh
2
- #
3
- # puma - this script starts and stops the puma daemon
4
- #
5
- # chkconfig: - 85 15
6
- # description: Description \
7
- # goes here...
8
- # processname: puma
9
- # config: /etc/puma.conf
10
- # pidfile: /home/stanislaw/apps/micro-apps/puma/puma.pid
11
- # Author: Darío Javier Cravero <'dario@exordo.com'>
12
- #
13
- # Do NOT "set -e"
14
- # Original script https://github.com/puma/puma/blob/master/tools/jungle/puma
15
- # It was modified here by Stanislaw Pankevich <'s.pankevich@gmail.com'>
16
- # to run on CentOS 5.5 boxes.
17
- # Script works perfectly on CentOS 5: script uses its native daemon().
18
- # Puma is being stopped/restarted by sending signals, control app is not used.
19
- # Source function library.
20
- . /etc/rc.d/init.d/functions
21
-
22
- # Source networking configuration.
23
- . /etc/sysconfig/network
24
- # Check that networking is up.
25
- [ "$NETWORKING" = "no" ] && exit 0
26
- # PATH should only include /usr/* if it runs after the mountnfs.sh script
27
- PATH=/usr/local/bin:/usr/local/sbin/:/sbin:/usr/sbin:/bin:/usr/bin
28
- DESC="Puma rack web server"
29
- NAME=puma
30
- DAEMON=$NAME
31
- SCRIPTNAME=/etc/init.d/$NAME
32
- CONFIG=<%=fetch(:puma_jungle_conf)%>
33
- JUNGLE=`cat $CONFIG`
34
- RUNPUMA=<%=fetch(:puma_run_path)%>
35
- # Skipping the following non-CentOS string
36
- # Load the VERBOSE setting and other rcS variables
37
- # . /lib/init/vars.sh
38
- # CentOS does not have these functions natively
39
- log_daemon_msg() { echo "$@"; }
40
- log_end_msg() { [ $1 -eq 0 ] && RES=OK; logger ${RES:=FAIL}; }
41
- # Define LSB log_* functions.
42
- # Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
43
- . /lib/lsb/init-functions
44
-
45
- #
46
- # Function that starts the jungle
47
- #
48
- do_start() {
49
- log_daemon_msg "=> Running the jungle..."
50
- for i in $JUNGLE; do
51
- dir=`echo $i | cut -d , -f 1`
52
- user=`echo $i | cut -d , -f 2`
53
- config_file=`echo $i | cut -d , -f 3`
54
- if [ "$config_file" = "" ]; then
55
- config_file="$dir/config/puma.rb"
56
- fi
57
- log_file=`echo $i | cut -d , -f 4`
58
- if [ "$log_file" = "" ]; then
59
- log_file="$dir/log/puma.log"
60
- fi
61
- do_start_one $dir $user $config_file $log_file
62
- done
63
- }
64
- do_start_one() {
65
- PIDFILE=$1/tmp/pids/puma.pid
66
- if [ -e $PIDFILE ]; then
67
- PID=`cat $PIDFILE`
68
- # If the puma isn't running, run it, otherwise restart it.
69
- if [ "`ps -A -o pid= | grep -c $PID`" -eq 0 ]; then
70
- do_start_one_do $1 $2
71
- else
72
- do_restart_one $1
73
- fi
74
- else
75
- do_start_one_do $1 $2 $3 $4
76
- fi
77
- }
78
- do_start_one_do() {
79
- log_daemon_msg "--> Woke up puma $1"
80
- daemon --user $2 $RUNPUMA $1
81
- }
82
- #
83
- # Function that stops the jungle
84
- #
85
- do_stop() {
86
- log_daemon_msg "=> Putting all the beasts to bed..."
87
- for i in $JUNGLE; do
88
- dir=`echo $i | cut -d , -f 1`
89
- do_stop_one $dir
90
- done
91
- }
92
- #
93
- # Function that stops the daemon/service
94
- #
95
- do_stop_one() {
96
- log_daemon_msg "--> Stopping $1"
97
- PIDFILE=$1/tmp/pids/puma.pid
98
- STATEFILE=$1/tmp/pids/puma.state
99
- echo $PIDFILE
100
- if [ -e $PIDFILE ]; then
101
- PID=`cat $PIDFILE`
102
- echo "Pid:"
103
- echo $PID
104
- if [ "`ps -A -o pid= | grep -c $PID`" -eq 0 ]; then
105
- log_daemon_msg "---> Puma $1 isn't running."
106
- else
107
- log_daemon_msg "---> About to kill PID `cat $PIDFILE`"
108
- pumactl --state $STATEFILE stop
109
- rm -f $PIDFILE $STATEFILE
110
- fi
111
- else
112
- log_daemon_msg "---> No puma here..."
113
- fi
114
- return 0
115
- }
116
- #
117
- # Function that restarts the jungle
118
- #
119
- do_restart() {
120
- for i in $JUNGLE; do
121
- dir=`echo $i | cut -d , -f 1`
122
- do_restart_one $dir
123
- done
124
- }
125
- #
126
- # Function that sends a SIGUSR2 to the daemon/service
127
- #
128
- do_restart_one() {
129
- PIDFILE=$1/tmp/pids/puma.pid
130
- i=`grep $1 $CONFIG`
131
- dir=`echo $i | cut -d , -f 1`
132
- if [ -e $PIDFILE ]; then
133
- log_daemon_msg "--> About to restart puma $1"
134
- pumactl --state $dir/tmp/pids/puma.state restart
135
-
136
- else
137
- log_daemon_msg "--> Your puma was never playing... Let's get it out there first"
138
- user=`echo $i | cut -d , -f 2`
139
- config_file=`echo $i | cut -d , -f 3`
140
- if [ "$config_file" = "" ]; then
141
- config_file="$dir/config/puma.rb"
142
- fi
143
- log_file=`echo $i | cut -d , -f 4`
144
- if [ "$log_file" = "" ]; then
145
- log_file="$dir/log/puma.log"
146
- fi
147
- do_start_one $dir $user $config_file $log_file
148
- fi
149
- return 0
150
- }
151
- #
152
- # Function that statuss then jungle
153
- #
154
- do_status() {
155
- for i in $JUNGLE; do
156
- dir=`echo $i | cut -d , -f 1`
157
- do_status_one $dir
158
- done
159
- }
160
- #
161
- # Function that sends a SIGUSR2 to the daemon/service
162
- #
163
- do_status_one() {
164
- PIDFILE=$1/tmp/pids/puma.pid
165
- i=`grep $1 $CONFIG`
166
- dir=`echo $i | cut -d , -f 1`
167
- if [ -e $PIDFILE ]; then
168
- log_daemon_msg "--> About to status puma $1"
169
- pumactl --state $dir/tmp/pids/puma.state stats
170
-
171
- else
172
- log_daemon_msg "--> $1 isn't there :(..."
173
- fi
174
- return 0
175
- }
176
- do_add() {
177
- str=""
178
- # App's directory
179
- if [ -d "$1" ]; then
180
- if [ "`grep -c "^$1" $CONFIG`" -eq 0 ]; then
181
- str=$1
182
- else
183
- echo "The app is already being managed. Remove it if you want to update its config."
184
- exit 1
185
- fi
186
- else
187
- echo "The directory $1 doesn't exist."
188
- exit 1
189
- fi
190
- # User to run it as
191
- if [ "`grep -c "^$2:" /etc/passwd`" -eq 0 ]; then
192
- echo "The user $2 doesn't exist."
193
- exit 1
194
- else
195
- str="$str,$2"
196
- fi
197
- # Config file
198
- if [ "$3" != "" ]; then
199
- if [ -e $3 ]; then
200
- str="$str,$3"
201
- else
202
- echo "The config file $3 doesn't exist."
203
- exit 1
204
- fi
205
- fi
206
- # Log file
207
- if [ "$4" != "" ]; then
208
- str="$str,$4"
209
- fi
210
- # Add it to the jungle
211
- echo $str >> $CONFIG
212
- log_daemon_msg "Added a Puma to the jungle: $str. You still have to start it though."
213
- }
214
- do_remove() {
215
- if [ "`grep -c "^$1" $CONFIG`" -eq 0 ]; then
216
- echo "There's no app $1 to remove."
217
- else
218
- # Stop it first.
219
- do_stop_one $1
220
- # Remove it from the config.
221
- sed -i "\\:^$1:d" $CONFIG
222
- log_daemon_msg "Removed a Puma from the jungle: $1."
223
- fi
224
- }
225
- case "$1" in
226
- start)
227
- [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
228
- if [ "$#" -eq 1 ]; then
229
- do_start
230
- else
231
- i=`grep $2 $CONFIG`
232
- dir=`echo $i | cut -d , -f 1`
233
- user=`echo $i | cut -d , -f 2`
234
- config_file=`echo $i | cut -d , -f 3`
235
- if [ "$config_file" = "" ]; then
236
- config_file="$dir/config/puma.rb"
237
- fi
238
- log_file=`echo $i | cut -d , -f 4`
239
- if [ "$log_file" = "" ]; then
240
- log_file="$dir/log/puma.log"
241
- fi
242
- do_start_one $dir $user $config_file $log_file
243
- fi
244
- case "$?" in
245
- 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
246
- 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
247
- esac
248
- ;;
249
- stop)
250
- [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
251
- if [ "$#" -eq 1 ]; then
252
- do_stop
253
- else
254
- i=`grep $2 $CONFIG`
255
- dir=`echo $i | cut -d , -f 1`
256
- do_stop_one $dir
257
- fi
258
- case "$?" in
259
- 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
260
- 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
261
- esac
262
- ;;
263
- status)
264
- # TODO Implement.
265
- log_daemon_msg "Status $DESC" "$NAME"
266
- if [ "$#" -eq 1 ]; then
267
- do_status
268
- else
269
- i=`grep $2 $CONFIG`
270
- dir=`echo $i | cut -d , -f 1`
271
- do_status_one $dir
272
- fi
273
- case "$?" in
274
- 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
275
- 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
276
- esac
277
- ;;
278
- restart)
279
- log_daemon_msg "Restarting $DESC" "$NAME"
280
- if [ "$#" -eq 1 ]; then
281
- do_restart
282
- else
283
- i=`grep $2 $CONFIG`
284
- dir=`echo $i | cut -d , -f 1`
285
- do_restart_one $dir
286
- fi
287
- case "$?" in
288
- 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
289
- 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
290
- esac
291
- ;;
292
- add)
293
- if [ "$#" -lt 3 ]; then
294
- echo "Please, specifiy the app's directory and the user that will run it at least."
295
- echo " Usage: $SCRIPTNAME add /path/to/app user /path/to/app/config/puma.rb /path/to/app/config/log/puma.log"
296
- echo " config and log are optionals."
297
- exit 1
298
- else
299
- do_add $2 $3 $4 $5
300
- fi
301
- case "$?" in
302
- 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
303
- 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
304
- esac
305
- ;;
306
- remove)
307
- if [ "$#" -lt 2 ]; then
308
- echo "Please, specifiy the app's directory to remove."
309
- exit 1
310
- else
311
- do_remove $2
312
- fi
313
- case "$?" in
314
- 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
315
- 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
316
- esac
317
- ;;
318
- *)
319
- echo "Usage:" >&2
320
- echo " Run the jungle: $SCRIPTNAME {start|stop|status|restart}" >&2
321
- echo " Add a Puma: $SCRIPTNAME add /path/to/app user /path/to/app/config/puma.rb /path/to/app/config/log/puma.log"
322
- echo " config and log are optionals."
323
- echo " Remove a Puma: $SCRIPTNAME remove /path/to/app"
324
- echo " On a Puma: $SCRIPTNAME {start|stop|status|restart} PUMA-NAME" >&2
325
- exit 3
326
- ;;
327
- esac
328
- :
@@ -1,42 +0,0 @@
1
- #!/usr/bin/env puma
2
-
3
- directory '<%= current_path %>'
4
- rackup "<%=fetch(:puma_rackup)%>"
5
- environment '<%= fetch(:puma_env) %>'
6
- <% if fetch(:puma_tag) %>
7
- tag '<%= fetch(:puma_tag)%>'
8
- <% end %>
9
- pidfile "<%=fetch(:puma_pid)%>"
10
- state_path "<%=fetch(:puma_state)%>"
11
- stdout_redirect '<%=fetch(:puma_access_log)%>', '<%=fetch(:puma_error_log)%>', true
12
-
13
-
14
- threads <%=fetch(:puma_threads).join(',')%>
15
-
16
- <%= puma_bind %>
17
- <% if fetch(:puma_control_app) %>
18
- activate_control_app "<%= fetch(:puma_default_control_app) %>"
19
- <% end %>
20
- workers <%= puma_workers %>
21
- <% if fetch(:puma_worker_timeout) %>
22
- worker_timeout <%= fetch(:puma_worker_timeout).to_i %>
23
- <% end %>
24
-
25
- <% if puma_preload_app? %>
26
- preload_app!
27
- <% else %>
28
- prune_bundler
29
- <% end %>
30
-
31
- on_restart do
32
- puts 'Refreshing Gemfile'
33
- ENV["BUNDLE_GEMFILE"] = "<%= fetch(:bundle_gemfile, "#{current_path}/Gemfile") %>"
34
- end
35
-
36
- <% if puma_preload_app? and fetch(:puma_init_active_record) %>
37
- on_worker_boot do
38
- ActiveSupport.on_load(:active_record) do
39
- ActiveRecord::Base.establish_connection
40
- end
41
- end
42
- <% end %>
@@ -1,7 +0,0 @@
1
- # Monit configuration for Puma
2
- # Service name: <%= puma_monit_service_name %>
3
- #
4
- check process <%= puma_monit_service_name %>
5
- with pidfile "<%= fetch(:puma_pid) %>"
6
- start program = "/usr/bin/sudo -u <%= puma_user(@role) %> /bin/bash -c 'cd <%= current_path %> && <%= SSHKit.config.command_map[:bundle] %> exec puma -C <%= fetch(:puma_conf) %> --daemon'"
7
- stop program = "/usr/bin/sudo -u <%= puma_user(@role) %> /bin/bash -c 'cd <%= current_path %> && <%= SSHKit.config.command_map[:bundle] %> exec pumactl -S <%= fetch(:puma_state) %> stop'"