teleporter 2.0.8 → 2.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/generators/teleport/capistrano.rb +1 -1
- data/lib/generators/teleport/templates/capistrano/deploy/deploy.rb.tt +1 -0
- data/lib/generators/teleport/templates/capistrano/deploy/production.rb.tt +0 -1
- data/lib/generators/teleport/templates/capistrano/deploy/staging.rb.tt +0 -1
- data/lib/generators/teleport/templates/capistrano/shared/monit_sidekiq.erb +6 -7
- data/lib/generators/teleport/templates/capistrano/tasks/setup_config.rake +4 -3
- data/lib/teleporter/version.rb +1 -1
- metadata +1 -9
- data/lib/generators/teleport/templates/capistrano/shared/database.example.yml.erb +0 -11
- data/lib/generators/teleport/templates/capistrano/shared/monit.erb +0 -7
- data/lib/generators/teleport/templates/capistrano/shared/nginx.conf.erb +0 -55
- data/lib/generators/teleport/templates/capistrano/shared/puma.conf.erb +0 -1
- data/lib/generators/teleport/templates/capistrano/shared/puma.erb +0 -332
- data/lib/generators/teleport/templates/capistrano/shared/puma.rb.erb +0 -18
- data/lib/generators/teleport/templates/capistrano/shared/run-puma.erb +0 -3
- data/lib/generators/teleport/templates/capistrano/shared/sidekiq.yml.erb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3c07445ab18be348fd3f3ccbd82b248f5d654c5
|
4
|
+
data.tar.gz: ba980322715f1acc0dcfd6770107eb2e54df1b8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9aa894358360582d1624a89872260087bfde9c1cabf5be239fe1db34c335343b41893592f6b4c8f4b6407ede5a6efb896df76c7fdb87afa99b23ffcd3b23ac1
|
7
|
+
data.tar.gz: 43e4ea96d0b4bc804043c922f2198e809a81a515df76b3ccf7494fc990622066fdf26f9957656582aa9866e8fde0145a259d1f15ad6c7cae7412449f186ad59b
|
@@ -1,11 +1,10 @@
|
|
1
|
-
|
2
|
-
set mail-format { subject: <%= "#{fetch(:full_app_name)} - #{fetch(:rails_env)}" %> $SERVICE $EVENT at $DATE }
|
1
|
+
set mail-format { subject: <%= "#{fetch(:application)} - #{fetch(:stage)}" %> $SERVICE $EVENT at $DATE }
|
3
2
|
|
4
|
-
check process
|
3
|
+
check process <%= fetch(:application) %>_<%= fetch(:stage) %>
|
5
4
|
with pidfile <%= current_path %>/tmp/pids/sidekiq.pid
|
6
|
-
start program = "/etc/init.d/sidekiq_<%= application %>_<%= fetch(:
|
7
|
-
stop program = "/etc/init.d/sidekiq_<%= application %>_<%= fetch(:
|
5
|
+
start program = "/etc/init.d/sidekiq_<%= fetch(:application) %>_<%= fetch(:stage)%> start"
|
6
|
+
stop program = "/etc/init.d/sidekiq_<%= fetch(:application) %>_<%= fetch(:stage)%> stop"
|
8
7
|
if mem is greater than 500.0 MB for 1 cycles then restart # eating up memory?
|
9
|
-
if cpu is greater than 50% for 2 cycles then alert
|
10
|
-
if cpu is greater than 80% for 30 cycles then restart
|
8
|
+
if cpu is greater than 50% for 2 cycles then alert # send an email to admin
|
9
|
+
if cpu is greater than 80% for 30 cycles then restart # hung process?
|
11
10
|
group sidekiq
|
@@ -12,20 +12,21 @@ namespace :deploy do
|
|
12
12
|
set(:symlinks, [
|
13
13
|
{
|
14
14
|
source: "log_rotation",
|
15
|
-
link: "/etc/logrotate.d/{{application}}"
|
15
|
+
link: "/etc/logrotate.d/{{application}}_{{stage}}"
|
16
16
|
},
|
17
17
|
{
|
18
18
|
source: "monit_sidekiq",
|
19
|
-
link: "/etc/monit/conf.d/sidekiq_{{application}}.conf"
|
19
|
+
link: "/etc/monit/conf.d/sidekiq_{{application}}_{{stage}}.conf"
|
20
20
|
},
|
21
21
|
{
|
22
22
|
source: "sidekiq_init.sh",
|
23
|
-
link: "/etc/init.d/sidekiq_{{application}}"
|
23
|
+
link: "/etc/init.d/sidekiq_{{application}}_{{stage}}"
|
24
24
|
},
|
25
25
|
])
|
26
26
|
execute :mkdir, "-p #{shared_path}/config"
|
27
27
|
execute :mkdir, "-p #{current_path}"
|
28
28
|
application = fetch(:application)
|
29
|
+
stage = fetch(:stage)
|
29
30
|
|
30
31
|
config_files = fetch(:config_files)
|
31
32
|
config_files.each do |file|
|
data/lib/teleporter/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: teleporter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ponomarev Nikolay
|
@@ -104,16 +104,8 @@ files:
|
|
104
104
|
- lib/generators/teleport/templates/capistrano/deploy/deploy.rb.tt
|
105
105
|
- lib/generators/teleport/templates/capistrano/deploy/production.rb.tt
|
106
106
|
- lib/generators/teleport/templates/capistrano/deploy/staging.rb.tt
|
107
|
-
- lib/generators/teleport/templates/capistrano/shared/database.example.yml.erb
|
108
107
|
- lib/generators/teleport/templates/capistrano/shared/log_rotation.erb
|
109
|
-
- lib/generators/teleport/templates/capistrano/shared/monit.erb
|
110
108
|
- lib/generators/teleport/templates/capistrano/shared/monit_sidekiq.erb
|
111
|
-
- lib/generators/teleport/templates/capistrano/shared/nginx.conf.erb
|
112
|
-
- lib/generators/teleport/templates/capistrano/shared/puma.conf.erb
|
113
|
-
- lib/generators/teleport/templates/capistrano/shared/puma.erb
|
114
|
-
- lib/generators/teleport/templates/capistrano/shared/puma.rb.erb
|
115
|
-
- lib/generators/teleport/templates/capistrano/shared/run-puma.erb
|
116
|
-
- lib/generators/teleport/templates/capistrano/shared/sidekiq.yml.erb
|
117
109
|
- lib/generators/teleport/templates/capistrano/shared/sidekiq_init.sh.erb
|
118
110
|
- lib/generators/teleport/templates/capistrano/shared/unicorn.rb.erb
|
119
111
|
- lib/generators/teleport/templates/capistrano/shared/unicorn_init.sh.erb
|
@@ -1,11 +0,0 @@
|
|
1
|
-
<%= fetch(:rails_env) %>:
|
2
|
-
adapter: postgresql
|
3
|
-
timeout: 5000
|
4
|
-
encoding: utf8
|
5
|
-
reconnect: false
|
6
|
-
database: <%= "#{fetch(:application)}_#{fetch(:rails_env)}" %>
|
7
|
-
pool: 5
|
8
|
-
username: <%= "#{fetch(:deploy_user)}" %>
|
9
|
-
password: secret
|
10
|
-
host:
|
11
|
-
port: 5432
|
@@ -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 <%= fetch(:deploy_user) %> /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 <%= fetch(:deploy_user) %> /bin/bash -c 'cd <%= current_path %> && <%= SSHKit.config.command_map[:bundle] %> exec pumactl -S <%= fetch(:puma_state) %> stop'"
|
@@ -1,55 +0,0 @@
|
|
1
|
-
upstream puma {
|
2
|
-
server unix:/<%= fetch(:deploy_to) %>/shared/tmp/sockets/puma.sock fail_timeout=0;
|
3
|
-
}
|
4
|
-
|
5
|
-
server {
|
6
|
-
listen 80 default deferred;
|
7
|
-
root <%= fetch(:deploy_to) %>/current/public;
|
8
|
-
|
9
|
-
location ^~ /assets/ {
|
10
|
-
gzip_static on;
|
11
|
-
expires max;
|
12
|
-
add_header Cache-Control public;
|
13
|
-
}
|
14
|
-
|
15
|
-
try_files $uri/index.html $uri @puma;
|
16
|
-
location @puma {
|
17
|
-
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
18
|
-
proxy_set_header Host $http_host;
|
19
|
-
proxy_redirect off;
|
20
|
-
proxy_pass http://puma;
|
21
|
-
}
|
22
|
-
|
23
|
-
error_page 500 502 503 504 /500.html;
|
24
|
-
client_max_body_size 4G;
|
25
|
-
keepalive_timeout 10;
|
26
|
-
}
|
27
|
-
|
28
|
-
<% if fetch(:enable_ssl) %>
|
29
|
-
server {
|
30
|
-
listen 443 default deferred;
|
31
|
-
root <%= fetch(:deploy_to) %>/current/public;
|
32
|
-
|
33
|
-
location ^~ /assets/ {
|
34
|
-
gzip_static on;
|
35
|
-
expires max;
|
36
|
-
add_header Cache-Control public;
|
37
|
-
}
|
38
|
-
|
39
|
-
try_files $uri/index.html $uri @puma;
|
40
|
-
location @puma {
|
41
|
-
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
42
|
-
proxy_set_header X-Forwarded-Proto https;
|
43
|
-
proxy_set_header Host $http_host;
|
44
|
-
proxy_redirect off;
|
45
|
-
proxy_pass http://puma;
|
46
|
-
}
|
47
|
-
|
48
|
-
error_page 500 502 503 504 /500.html;
|
49
|
-
client_max_body_size 4G;
|
50
|
-
keepalive_timeout 10;
|
51
|
-
ssl on;
|
52
|
-
ssl_certificate <%= fetch(:deploy_to) %>/shared/ssl_cert.crt;
|
53
|
-
ssl_certificate_key <%= fetch(:deploy_to) %>/shared/ssl_private_key.key;
|
54
|
-
}#
|
55
|
-
<% end %>
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= current_path %>,<%= fetch(:deploy_user) %>
|
@@ -1,332 +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
|
-
#
|
15
|
-
# Do NOT "set -e"
|
16
|
-
|
17
|
-
# PATH should only include /usr/* if it runs after the mountnfs.sh script
|
18
|
-
PATH=/usr/local/bin:/usr/local/sbin/:/sbin:/usr/sbin:/bin:/usr/bin
|
19
|
-
DESC="Puma rack web server"
|
20
|
-
NAME=puma
|
21
|
-
DAEMON=$NAME
|
22
|
-
SCRIPTNAME=/etc/init.d/$NAME
|
23
|
-
CONFIG=/etc/puma.conf
|
24
|
-
JUNGLE=`cat $CONFIG`
|
25
|
-
RUNPUMA=/usr/local/bin/run-puma
|
26
|
-
|
27
|
-
# Load the VERBOSE setting and other rcS variables
|
28
|
-
. /lib/init/vars.sh
|
29
|
-
|
30
|
-
# Define LSB log_* functions.
|
31
|
-
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
|
32
|
-
. /lib/lsb/init-functions
|
33
|
-
|
34
|
-
#
|
35
|
-
# Function that starts the jungle
|
36
|
-
#
|
37
|
-
do_start() {
|
38
|
-
log_daemon_msg "=> Running the jungle..."
|
39
|
-
for i in $JUNGLE; do
|
40
|
-
dir=`echo $i | cut -d , -f 1`
|
41
|
-
user=`echo $i | cut -d , -f 2`
|
42
|
-
config_file=`echo $i | cut -d , -f 3`
|
43
|
-
if [ "$config_file" = "" ]; then
|
44
|
-
config_file="$dir/config/puma.rb"
|
45
|
-
fi
|
46
|
-
log_file=`echo $i | cut -d , -f 4`
|
47
|
-
if [ "$log_file" = "" ]; then
|
48
|
-
log_file="$dir/log/puma.log"
|
49
|
-
fi
|
50
|
-
do_start_one $dir $user $config_file $log_file
|
51
|
-
done
|
52
|
-
}
|
53
|
-
|
54
|
-
do_start_one() {
|
55
|
-
PIDFILE=$1/tmp/puma/pid
|
56
|
-
if [ -e $PIDFILE ]; then
|
57
|
-
PID=`cat $PIDFILE`
|
58
|
-
# If the puma isn't running, run it, otherwise restart it.
|
59
|
-
if [ "`ps -A -o pid= | grep -c $PID`" -eq 0 ]; then
|
60
|
-
do_start_one_do $1 $2 $3 $4
|
61
|
-
else
|
62
|
-
do_restart_one $1
|
63
|
-
fi
|
64
|
-
else
|
65
|
-
do_start_one_do $1 $2 $3 $4
|
66
|
-
fi
|
67
|
-
}
|
68
|
-
|
69
|
-
do_start_one_do() {
|
70
|
-
log_daemon_msg "--> Woke up puma $1"
|
71
|
-
log_daemon_msg "user $2"
|
72
|
-
log_daemon_msg "log to $4"
|
73
|
-
start-stop-daemon --verbose --start --chdir $1 --chuid $2 --background --exec $RUNPUMA -- $1 $3 $4
|
74
|
-
}
|
75
|
-
|
76
|
-
#
|
77
|
-
# Function that stops the jungle
|
78
|
-
#
|
79
|
-
do_stop() {
|
80
|
-
log_daemon_msg "=> Putting all the beasts to bed..."
|
81
|
-
for i in $JUNGLE; do
|
82
|
-
dir=`echo $i | cut -d , -f 1`
|
83
|
-
do_stop_one $dir
|
84
|
-
done
|
85
|
-
}
|
86
|
-
#
|
87
|
-
# Function that stops the daemon/service
|
88
|
-
#
|
89
|
-
do_stop_one() {
|
90
|
-
log_daemon_msg "--> Stopping $1"
|
91
|
-
PIDFILE=$1/tmp/puma/pid
|
92
|
-
STATEFILE=$1/tmp/puma/state
|
93
|
-
if [ -e $PIDFILE ]; then
|
94
|
-
PID=`cat $PIDFILE`
|
95
|
-
if [ "`ps -A -o pid= | grep -c $PID`" -eq 0 ]; then
|
96
|
-
log_daemon_msg "---> Puma $1 isn't running."
|
97
|
-
else
|
98
|
-
log_daemon_msg "---> About to kill PID `cat $PIDFILE`"
|
99
|
-
pumactl --state $STATEFILE stop
|
100
|
-
# Many daemons don't delete their pidfiles when they exit.
|
101
|
-
rm -f $PIDFILE $STATEFILE
|
102
|
-
fi
|
103
|
-
else
|
104
|
-
log_daemon_msg "---> No puma here..."
|
105
|
-
fi
|
106
|
-
return 0
|
107
|
-
}
|
108
|
-
|
109
|
-
#
|
110
|
-
# Function that restarts the jungle
|
111
|
-
#
|
112
|
-
do_restart() {
|
113
|
-
for i in $JUNGLE; do
|
114
|
-
dir=`echo $i | cut -d , -f 1`
|
115
|
-
do_restart_one $dir
|
116
|
-
done
|
117
|
-
}
|
118
|
-
|
119
|
-
#
|
120
|
-
# Function that sends a SIGUSR2 to the daemon/service
|
121
|
-
#
|
122
|
-
do_restart_one() {
|
123
|
-
PIDFILE=$1/tmp/puma/pid
|
124
|
-
i=`grep $1 $CONFIG`
|
125
|
-
dir=`echo $i | cut -d , -f 1`
|
126
|
-
|
127
|
-
if [ -e $PIDFILE ]; then
|
128
|
-
log_daemon_msg "--> About to restart puma $1"
|
129
|
-
pumactl --state $dir/tmp/puma/state restart
|
130
|
-
# kill -s USR2 `cat $PIDFILE`
|
131
|
-
# TODO Check if process exist
|
132
|
-
else
|
133
|
-
log_daemon_msg "--> Your puma was never playing... Let's get it out there first"
|
134
|
-
user=`echo $i | cut -d , -f 2`
|
135
|
-
config_file=`echo $i | cut -d , -f 3`
|
136
|
-
if [ "$config_file" = "" ]; then
|
137
|
-
config_file="$dir/config/puma.rb"
|
138
|
-
fi
|
139
|
-
log_file=`echo $i | cut -d , -f 4`
|
140
|
-
if [ "$log_file" = "" ]; then
|
141
|
-
log_file="$dir/log/puma.log"
|
142
|
-
fi
|
143
|
-
do_start_one $dir $user $config_file $log_file
|
144
|
-
fi
|
145
|
-
return 0
|
146
|
-
}
|
147
|
-
|
148
|
-
#
|
149
|
-
# Function that statuss the jungle
|
150
|
-
#
|
151
|
-
do_status() {
|
152
|
-
for i in $JUNGLE; do
|
153
|
-
dir=`echo $i | cut -d , -f 1`
|
154
|
-
do_status_one $dir
|
155
|
-
done
|
156
|
-
}
|
157
|
-
|
158
|
-
#
|
159
|
-
# Function that sends a SIGUSR2 to the daemon/service
|
160
|
-
#
|
161
|
-
do_status_one() {
|
162
|
-
PIDFILE=$1/tmp/puma/pid
|
163
|
-
i=`grep $1 $CONFIG`
|
164
|
-
dir=`echo $i | cut -d , -f 1`
|
165
|
-
|
166
|
-
if [ -e $PIDFILE ]; then
|
167
|
-
log_daemon_msg "--> About to status puma $1"
|
168
|
-
pumactl --state $dir/tmp/puma/state stats
|
169
|
-
# kill -s USR2 `cat $PIDFILE`
|
170
|
-
# TODO Check if process exist
|
171
|
-
else
|
172
|
-
log_daemon_msg "--> $1 isn't there :(..."
|
173
|
-
fi
|
174
|
-
return 0
|
175
|
-
}
|
176
|
-
|
177
|
-
do_add() {
|
178
|
-
str=""
|
179
|
-
# App's directory
|
180
|
-
if [ -d "$1" ]; then
|
181
|
-
if [ "`grep -c "^$1" $CONFIG`" -eq 0 ]; then
|
182
|
-
str=$1
|
183
|
-
else
|
184
|
-
echo "The app is already being managed. Remove it if you want to update its config."
|
185
|
-
exit 1
|
186
|
-
fi
|
187
|
-
else
|
188
|
-
echo "The directory $1 doesn't exist."
|
189
|
-
exit 1
|
190
|
-
fi
|
191
|
-
# User to run it as
|
192
|
-
if [ "`grep -c "^$2:" /etc/passwd`" -eq 0 ]; then
|
193
|
-
echo "The user $2 doesn't exist."
|
194
|
-
exit 1
|
195
|
-
else
|
196
|
-
str="$str,$2"
|
197
|
-
fi
|
198
|
-
# Config file
|
199
|
-
if [ "$3" != "" ]; then
|
200
|
-
if [ -e $3 ]; then
|
201
|
-
str="$str,$3"
|
202
|
-
else
|
203
|
-
echo "The config file $3 doesn't exist."
|
204
|
-
exit 1
|
205
|
-
fi
|
206
|
-
fi
|
207
|
-
# Log file
|
208
|
-
if [ "$4" != "" ]; then
|
209
|
-
str="$str,$4"
|
210
|
-
fi
|
211
|
-
|
212
|
-
# Add it to the jungle
|
213
|
-
echo $str >> $CONFIG
|
214
|
-
log_daemon_msg "Added a Puma to the jungle: $str. You still have to start it though."
|
215
|
-
}
|
216
|
-
|
217
|
-
do_remove() {
|
218
|
-
if [ "`grep -c "^$1" $CONFIG`" -eq 0 ]; then
|
219
|
-
echo "There's no app $1 to remove."
|
220
|
-
else
|
221
|
-
# Stop it first.
|
222
|
-
do_stop_one $1
|
223
|
-
# Remove it from the config.
|
224
|
-
sed -i "\\:^$1:d" $CONFIG
|
225
|
-
log_daemon_msg "Removed a Puma from the jungle: $1."
|
226
|
-
fi
|
227
|
-
}
|
228
|
-
|
229
|
-
case "$1" in
|
230
|
-
start)
|
231
|
-
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
|
232
|
-
if [ "$#" -eq 1 ]; then
|
233
|
-
do_start
|
234
|
-
else
|
235
|
-
i=`grep $2 $CONFIG`
|
236
|
-
dir=`echo $i | cut -d , -f 1`
|
237
|
-
user=`echo $i | cut -d , -f 2`
|
238
|
-
config_file=`echo $i | cut -d , -f 3`
|
239
|
-
if [ "$config_file" = "" ]; then
|
240
|
-
config_file="$dir/config/puma.rb"
|
241
|
-
fi
|
242
|
-
log_file=`echo $i | cut -d , -f 4`
|
243
|
-
if [ "$log_file" = "" ]; then
|
244
|
-
log_file="$dir/log/puma.log"
|
245
|
-
fi
|
246
|
-
do_start_one $dir $user $config_file $log_file
|
247
|
-
fi
|
248
|
-
case "$?" in
|
249
|
-
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
|
250
|
-
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
|
251
|
-
esac
|
252
|
-
;;
|
253
|
-
stop)
|
254
|
-
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
|
255
|
-
if [ "$#" -eq 1 ]; then
|
256
|
-
do_stop
|
257
|
-
else
|
258
|
-
i=`grep $2 $CONFIG`
|
259
|
-
dir=`echo $i | cut -d , -f 1`
|
260
|
-
do_stop_one $dir
|
261
|
-
fi
|
262
|
-
case "$?" in
|
263
|
-
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
|
264
|
-
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
|
265
|
-
esac
|
266
|
-
;;
|
267
|
-
status)
|
268
|
-
# TODO Implement.
|
269
|
-
log_daemon_msg "Status $DESC" "$NAME"
|
270
|
-
if [ "$#" -eq 1 ]; then
|
271
|
-
do_status
|
272
|
-
else
|
273
|
-
i=`grep $2 $CONFIG`
|
274
|
-
dir=`echo $i | cut -d , -f 1`
|
275
|
-
do_status_one $dir
|
276
|
-
fi
|
277
|
-
case "$?" in
|
278
|
-
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
|
279
|
-
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
|
280
|
-
esac
|
281
|
-
;;
|
282
|
-
restart)
|
283
|
-
log_daemon_msg "Restarting $DESC" "$NAME"
|
284
|
-
if [ "$#" -eq 1 ]; then
|
285
|
-
do_restart
|
286
|
-
else
|
287
|
-
i=`grep $2 $CONFIG`
|
288
|
-
dir=`echo $i | cut -d , -f 1`
|
289
|
-
do_restart_one $dir
|
290
|
-
fi
|
291
|
-
case "$?" in
|
292
|
-
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
|
293
|
-
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
|
294
|
-
esac
|
295
|
-
;;
|
296
|
-
add)
|
297
|
-
if [ "$#" -lt 3 ]; then
|
298
|
-
echo "Please, specifiy the app's directory and the user that will run it at least."
|
299
|
-
echo " Usage: $SCRIPTNAME add /path/to/app user /path/to/app/config/puma.rb /path/to/app/config/log/puma.log"
|
300
|
-
echo " config and log are optionals."
|
301
|
-
exit 1
|
302
|
-
else
|
303
|
-
do_add $2 $3 $4 $5
|
304
|
-
fi
|
305
|
-
case "$?" in
|
306
|
-
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
|
307
|
-
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
|
308
|
-
esac
|
309
|
-
;;
|
310
|
-
remove)
|
311
|
-
if [ "$#" -lt 2 ]; then
|
312
|
-
echo "Please, specifiy the app's directory to remove."
|
313
|
-
exit 1
|
314
|
-
else
|
315
|
-
do_remove $2
|
316
|
-
fi
|
317
|
-
case "$?" in
|
318
|
-
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
|
319
|
-
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
|
320
|
-
esac
|
321
|
-
;;
|
322
|
-
*)
|
323
|
-
echo "Usage:" >&2
|
324
|
-
echo " Run the jungle: $SCRIPTNAME {start|stop|status|restart}" >&2
|
325
|
-
echo " Add a Puma: $SCRIPTNAME add /path/to/app user /path/to/app/config/puma.rb /path/to/app/config/log/puma.log"
|
326
|
-
echo " config and log are optionals."
|
327
|
-
echo " Remove a Puma: $SCRIPTNAME remove /path/to/app"
|
328
|
-
echo " On a Puma: $SCRIPTNAME {start|stop|status|restart} PUMA-NAME" >&2
|
329
|
-
exit 3
|
330
|
-
;;
|
331
|
-
esac
|
332
|
-
:
|
@@ -1,18 +0,0 @@
|
|
1
|
-
workers Integer(ENV['PUMA_WORKERS'] || 3)
|
2
|
-
threads Integer(ENV['MIN_THREADS'] || 1), Integer(ENV['MAX_THREADS'] || 16)
|
3
|
-
|
4
|
-
preload_app!
|
5
|
-
|
6
|
-
rackup DefaultRackup
|
7
|
-
port ENV['PORT'] || 3000
|
8
|
-
environment ENV['RACK_ENV'] || 'development'
|
9
|
-
|
10
|
-
on_worker_boot do
|
11
|
-
# worker specific setup
|
12
|
-
ActiveSupport.on_load(:active_record) do
|
13
|
-
config = ActiveRecord::Base.configurations[Rails.env] ||
|
14
|
-
Rails.application.config.database_configuration[Rails.env]
|
15
|
-
config['pool'] = ENV['MAX_THREADS'] || 16
|
16
|
-
ActiveRecord::Base.establish_connection(config)
|
17
|
-
end
|
18
|
-
end
|