pixelforce_recipes 0.6 → 0.7
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23b5a059ff6c01a74cb2a9129e32722e1d351989
|
4
|
+
data.tar.gz: 0129c285267bc58f381f6bbbcd99000f826a706b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4243926b04d5cb89aa2bf2fce1852c3657f4a73b51e9be20e563c2a181b6100bf83794f2328cf3f3ad2d92293bdad5329210ee129b0f01d28831db5d920c369
|
7
|
+
data.tar.gz: c3186189eaf6ee671175b6df92eb3a3b5a8abe53ba971228d7a3beb3503437e2691b0ba49eaf0eb8ef24071a1ab885522a2a5a47287b83cbc2447606f3586a68
|
data/lib/pixelforce_recipes.rb
CHANGED
@@ -3,4 +3,5 @@ require "capistrano"
|
|
3
3
|
|
4
4
|
require File.expand_path("#{File.dirname(__FILE__)}/pixelforce_recipes/base")
|
5
5
|
require File.expand_path("#{File.dirname(__FILE__)}/pixelforce_recipes/unicorn")
|
6
|
-
require File.expand_path("#{File.dirname(__FILE__)}/pixelforce_recipes/sidekiq")
|
6
|
+
require File.expand_path("#{File.dirname(__FILE__)}/pixelforce_recipes/sidekiq")
|
7
|
+
require File.expand_path("#{File.dirname(__FILE__)}/pixelforce_recipes/puma")
|
@@ -0,0 +1,26 @@
|
|
1
|
+
if Capistrano::Configuration.instance(false)
|
2
|
+
|
3
|
+
Capistrano::Configuration.instance(true).load do |instance|
|
4
|
+
|
5
|
+
namespace :puma do
|
6
|
+
|
7
|
+
desc "Setup puma configuration for this application"
|
8
|
+
task :setup, roles: :web do
|
9
|
+
template "puma_init.erb", "/tmp/puma"
|
10
|
+
run "#{sudo} mv /tmp/puma /etc/init.d/#{application}"
|
11
|
+
run "#{sudo} chmod +x /etc/init.d/#{application}"
|
12
|
+
run "#{sudo} update-rc.d #{application} defaults"
|
13
|
+
template "nginx_puma_config.erb", "/tmp/nginx_puma_config"
|
14
|
+
run "#{sudo} mv /tmp/nginx_puma_config /etc/nginx/sites-enabled/#{application}"
|
15
|
+
end
|
16
|
+
# after "deploy:setup", "nginx:setup"
|
17
|
+
|
18
|
+
%w[start stop restart].each do |command|
|
19
|
+
desc "#{command} puma"
|
20
|
+
task command, roles: :web do
|
21
|
+
run "/etc/init.d/#{application} #{command}"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
upstream <%= application %> {
|
2
|
+
server unix:///home/ubuntu/<%= application %>/shared/sockets/<%= application %>.sock;
|
3
|
+
}
|
4
|
+
|
5
|
+
server {
|
6
|
+
listen 80 default_server deferred;
|
7
|
+
server_name <%= server_address %>;
|
8
|
+
|
9
|
+
root /home/ubuntu/<%= application %>/current/public;
|
10
|
+
access_log /home/ubuntu/<%= application %>/current/log/nginx.access.log;
|
11
|
+
error_log /home/ubuntu/<%= application %>/current/log/nginx.error.log info;
|
12
|
+
|
13
|
+
location ^~ /assets/ {
|
14
|
+
gzip_static on;
|
15
|
+
expires max;
|
16
|
+
add_header Cache-Control public;
|
17
|
+
}
|
18
|
+
|
19
|
+
try_files $uri $uri @<%= application %>;
|
20
|
+
location @<%= application %> {
|
21
|
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
22
|
+
proxy_set_header Host $http_host;
|
23
|
+
proxy_redirect off;
|
24
|
+
proxy_buffering on;
|
25
|
+
proxy_set_header X-Real-IP $remote_addr;
|
26
|
+
|
27
|
+
proxy_pass http://<%= application %>;
|
28
|
+
}
|
29
|
+
|
30
|
+
location /cable {
|
31
|
+
proxy_pass http://<%= application %>;
|
32
|
+
proxy_http_version 1.1;
|
33
|
+
proxy_set_header Upgrade $http_upgrade;
|
34
|
+
proxy_set_header Connection "upgrade";
|
35
|
+
}
|
36
|
+
|
37
|
+
error_page 500 502 503 504 /500.html;
|
38
|
+
client_max_body_size 10M;
|
39
|
+
keepalive_timeout 10;
|
40
|
+
}
|
@@ -0,0 +1,55 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
### BEGIN INIT INFO
|
4
|
+
# Provides: puma
|
5
|
+
# Required-Start: $local_fs $remote_fs $network $syslog
|
6
|
+
# Required-Stop: $local_fs $remote_fs $network $syslog
|
7
|
+
# Default-Start: 2 3 4 5
|
8
|
+
# Default-Stop: 0 1 6
|
9
|
+
# Short-Description: starts the puma web server
|
10
|
+
# Description: starts puma
|
11
|
+
### END INIT INFO
|
12
|
+
|
13
|
+
USER="<%= user %>"
|
14
|
+
DAEMON=puma
|
15
|
+
PROJECT_PATH="<%= deploy_to %>"
|
16
|
+
DAEMON_OPTS="-e <%= rails_env %>"
|
17
|
+
NAME=puma
|
18
|
+
DESC="puma app for $USER"
|
19
|
+
PID="$PROJECT_PATH/shared/pids/puma.pid"
|
20
|
+
|
21
|
+
case "$1" in
|
22
|
+
start)
|
23
|
+
CD_TO_APP_DIR="cd $PROJECT_PATH/current"
|
24
|
+
START_DAEMON_PROCESS="bundle exec $DAEMON $DAEMON_OPTS"
|
25
|
+
|
26
|
+
echo -n "Starting $DESC: "
|
27
|
+
if [ `whoami` = 'root' ]; then
|
28
|
+
su - $USER -c "$CD_TO_APP_DIR > /dev/null 2>&1 && $START_DAEMON_PROCESS"
|
29
|
+
else
|
30
|
+
$CD_TO_APP_DIR > /dev/null 2>&1 && $START_DAEMON_PROCESS
|
31
|
+
fi
|
32
|
+
echo "$NAME."
|
33
|
+
;;
|
34
|
+
stop)
|
35
|
+
echo -n "Stopping $DESC: "
|
36
|
+
kill -QUIT `cat $PID`
|
37
|
+
echo "$NAME."
|
38
|
+
;;
|
39
|
+
restart)
|
40
|
+
echo -n "Restarting $DESC: "
|
41
|
+
kill -USR2 `cat $PID`
|
42
|
+
echo "$NAME."
|
43
|
+
;;
|
44
|
+
reload)
|
45
|
+
echo -n "Reloading $DESC configuration: "
|
46
|
+
kill -HUP `cat $PID`
|
47
|
+
echo "$NAME."
|
48
|
+
;;
|
49
|
+
*)
|
50
|
+
echo "Usage: $NAME {start|stop|restart|reload}" >&2
|
51
|
+
exit 1
|
52
|
+
;;
|
53
|
+
esac
|
54
|
+
|
55
|
+
exit 0
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pixelforce_recipes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.7'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Zhang
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -84,8 +84,11 @@ files:
|
|
84
84
|
- bin/setup
|
85
85
|
- lib/pixelforce_recipes.rb
|
86
86
|
- lib/pixelforce_recipes/base.rb
|
87
|
+
- lib/pixelforce_recipes/puma.rb
|
87
88
|
- lib/pixelforce_recipes/sidekiq.rb
|
88
89
|
- lib/pixelforce_recipes/templates/nginx_config.erb
|
90
|
+
- lib/pixelforce_recipes/templates/nginx_puma_config.erb
|
91
|
+
- lib/pixelforce_recipes/templates/puma_init.erb
|
89
92
|
- lib/pixelforce_recipes/templates/sidekiq_init.erb
|
90
93
|
- lib/pixelforce_recipes/templates/unicorn_init.erb
|
91
94
|
- lib/pixelforce_recipes/unicorn.rb
|