cap-uwsgi 0.0.1 → 0.0.2

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: c39d5845a45cbbc925b9bbf521cd50dc68e55054
4
- data.tar.gz: e197fe634cd316cd1334703c826e23b1dca195fd
3
+ metadata.gz: 39ea83fc246f65843555078382ec2d67ddd1fd95
4
+ data.tar.gz: 611f9c4fd160c8c157692b1c206ea5c1db4acaaa
5
5
  SHA512:
6
- metadata.gz: db6a117e3f2eefe089c25eb64c04919c7eef83abe4ddb8d1014195c3849b1d805fac5879f2a88927a8eac70eebeeb029bf5dd1dc32e5873fd351ee792eada51b
7
- data.tar.gz: e76fc46483f7330d4e4e999551061a3d2cfa64dfecd756d9f8fc4cf02c655499ecca09fddcb9227e22382532049bc85a2a0aca59b5c32c6dc264c91c4b0d35e8
6
+ metadata.gz: 87174c18969c5a9ae0d1468a06cfa6ad778fd651b366b28960f71eb2853efd5e79582a89ab527df7cbbf0e68aec6c3837d23eaab80f24bc8514f5c259d3a797c
7
+ data.tar.gz: ddea541a9271e9097e67d37b02fb22bc3f247796583cff75ac3f09607bad5bf38d59f663f0e077d4e05ff2c4c8892acb9567378e12c95b93a3cac63808261be4
data/.gitignore CHANGED
@@ -1,5 +1,4 @@
1
1
  puma
2
- sh
3
2
  *~
4
3
  pkg
5
4
  tmp
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- capistrano-uwsgi (0.0.1)
4
+ cap-uwsgi (0.0.1)
5
5
  capistrano (~> 3.0)
6
6
 
7
7
  GEM
@@ -11,6 +11,7 @@ GEM
11
11
  i18n
12
12
  rake (>= 10.0.0)
13
13
  sshkit (~> 1.3)
14
+ gem-release (0.7.1)
14
15
  i18n (0.6.9)
15
16
  net-scp (1.1.2)
16
17
  net-ssh (>= 2.6.5)
@@ -28,4 +29,5 @@ PLATFORMS
28
29
  ruby
29
30
 
30
31
  DEPENDENCIES
31
- capistrano-uwsgi!
32
+ cap-uwsgi!
33
+ gem-release
data/Readme.md CHANGED
@@ -4,7 +4,13 @@
4
4
 
5
5
  gem 'cap-uwsgi'
6
6
 
7
+ ### Workflow
8
+
9
+ * cap _stage uwsgi:emperor:setup #firstly once
10
+ * cap _stage deploy #all is running
11
+
7
12
  ### Ref
8
13
 
9
- * https://github.com/cao7113/uwsgi-rails-demo
14
+ * https://github.com/cao7113/railslab
10
15
  * capistrano-puma
16
+ * web: http://uwsgi-docs.readthedocs.org/en/latest/tutorials/GraphiteAndMetrics.html
data/cap-uwsgi.gemspec CHANGED
@@ -10,12 +10,12 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ['cao7113@hotmail.com']
11
11
  spec.description = %q{uWSGI integration for Capistrano 3}
12
12
  spec.summary = %q{uWSGI integration for Capistrano 3}
13
- spec.homepage = 'http://shareup.me'
13
+ spec.homepage = 'http://github.com/cao7113/cap-uwsgi'
14
14
  spec.license = 'MIT'
15
15
 
16
- spec.files = `git ls-files`.split($/)
16
+ spec.files = `git ls-files --exclude doc`.split($/)
17
17
  spec.require_paths = ['lib']
18
18
 
19
19
  spec.add_dependency 'capistrano', '~> 3.0'
20
-
20
+ spec.add_development_dependency 'gem-release'
21
21
  end
data/doc/conf/rack.ini ADDED
@@ -0,0 +1,7 @@
1
+ [uwsgi]
2
+ #socket = 127.0.0.1:3031
3
+ http = :8080
4
+ rack = app.ru
5
+ processes = 2
6
+ master = true
7
+ stats = 127.0.0.1:9000
@@ -0,0 +1,14 @@
1
+ [uwsgi]
2
+ #socket = 127.0.0.1:3081
3
+ socket = /tmp/railsup.sock
4
+ #socket = :8090
5
+ #http = :3081
6
+ rack = config.ru
7
+ master = true
8
+ #processes = 2
9
+ # starting from 4.0, Rails support multiple threads(only for ruby2.0)
10
+ #rbthreads = 4
11
+ # lazy-apps = true
12
+ chdir = /home/cao/dev/railsup
13
+ env = RAILS_ENV=production
14
+ chmod-socket = 666
@@ -0,0 +1,7 @@
1
+ [uwsgi]
2
+ #socket = 127.0.0.1:3031
3
+ http = :8081
4
+ rack = sinatra.ru
5
+ processes = 2
6
+ master = true
7
+ lazy-apps = true
data/doc/options.md ADDED
@@ -0,0 +1,17 @@
1
+ # Useful uWSGI options references
2
+
3
+ ## Common
4
+
5
+ * processes
6
+ * master
7
+ * http
8
+ * http-socket
9
+
10
+ ## Upsart init job
11
+
12
+ * die-on-term
13
+
14
+ ## Ruby/Rack apps
15
+
16
+ * http-modifier1 = 7
17
+ * rack = app.ru
data/doc/upstart.md ADDED
@@ -0,0 +1,22 @@
1
+ Ref: http://uwsgi-docs.readthedocs.org/en/latest/Upstart.html
2
+
3
+ ## About --die-on-term
4
+
5
+ By default uWSGI maps the SIGTERM signal to 'a brutal reload procedure'
6
+
7
+ However, Upstart uses SIGTERM to completely shutdown processes. die-on-term inverts the meanings of SIGTERM and SIGQUIT to uWSGI.
8
+
9
+
10
+ ## Socket activation(Ubuntu12.04+)
11
+
12
+ let processes start when connections are made to specific sockets.
13
+
14
+ So can use this feature to start uWSGI only when a client(or the webserver) first connects to it.
15
+
16
+ # simple uWSGI script
17
+
18
+ description "uwsgi tiny instance"
19
+ start on socket PROTO=inet PORT=3031
20
+ stop on runlevel [06]
21
+
22
+ exec uwsgi --master --processes 4 --die-on-term --wsgi-file /var/www/myapp.wsgi
@@ -61,6 +61,12 @@ namespace :uwsgi do
61
61
  end
62
62
  end
63
63
 
64
+ desc 'Setup this app into to emperor'
65
+ task :setup do
66
+ invoke "uwsgi:emperor:add"
67
+ invoke "uwsgi:nginx:setup"
68
+ end
69
+
64
70
  desc 'Add current project to the emperor'
65
71
  task :add do
66
72
  on roles(fetch(:uwsgi_role)), in: :sequence, wait: 1 do |role|
@@ -74,6 +80,7 @@ namespace :uwsgi do
74
80
  on roles(fetch(:uwsgi_role)) do
75
81
  sudo "rm -f '#{emperor_app_conf}'"
76
82
  end
83
+ invoke "uwsgi:nginx:deconf"
77
84
  end
78
85
 
79
86
  desc 'Touch current project for reload'
@@ -6,12 +6,22 @@ end
6
6
 
7
7
  namespace :uwsgi do
8
8
  namespace :nginx do
9
+
10
+ desc "Setup nginx for this app"
11
+ task :setup do
12
+ invoke "uwsgi:nginx:conf"
13
+ on roles(fetch(:uwsgi_role)) do |role|
14
+ sudo "service nginx reload"
15
+ end
16
+ end
17
+
9
18
  desc 'Config uwsgi nginx service'
10
19
  task :conf do
11
20
  on roles(fetch(:uwsgi_role)) do |role|
12
21
  @role = role
13
22
  template_uwsgi 'uwsgi_nginx.conf', "#{fetch(:tmp_dir)}/nginx.conf", @role
14
23
  sudo "mv -b #{fetch(:tmp_dir)}/nginx.conf #{uwsgi_nginx_app_conf}"
24
+ #sudo "service nginx reload"
15
25
  end
16
26
  end
17
27
 
@@ -20,6 +30,7 @@ namespace :uwsgi do
20
30
  on roles(fetch(:uwsgi_role)) do |role|
21
31
  @role = role
22
32
  sudo "rm -f #{uwsgi_nginx_app_conf}"
33
+ sudo "service nginx reload"
23
34
  end
24
35
  end
25
36
 
@@ -32,7 +32,7 @@ namespace :uwsgi do
32
32
  @role = role
33
33
  if test "! gem query -in uwsgi >/dev/null"
34
34
  sudo "apt-get -y install libssl-dev libpcre3-dev"
35
- execute "gem install uwsgi"
35
+ execute "gem install uwsgi -V"
36
36
  end
37
37
  end
38
38
  end
File without changes
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module Uwsgi
3
- VERSION = '0.0.1'
3
+ VERSION = '0.0.2'
4
4
  end
5
5
  end
data/sh/init-emperor ADDED
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env bash
2
+ #Usage: [APP_USER=xxx] [CONF_DIR=xxx] $0
3
+
4
+ set -e
5
+
6
+ app_user=${APP_USER:-$USER}
7
+
8
+ root_dir=$(dirname $0)
9
+ PATH=$root_dir:$PATH install
10
+
11
+ #mk conf dir
12
+ conf_dir=${CONF_DIR:-/etc/uwsgi}
13
+ if [ -d $conf_dir ];then
14
+ echo Has found $conf_dir
15
+ else
16
+ sudo mkdir $conf_dir
17
+ sudo chown -R $app_user:$app_user $conf_dir
18
+ echo Mkdir $conf_dir
19
+ fi
20
+
21
+ #install emperor init conf
22
+ if which rbenv &>/dev/null;then
23
+ bin_uwsgi=`rbenv which uwsgi`
24
+ else
25
+ bin_uwsgi=`which uwsgi`
26
+ fi
27
+
28
+ tmpfile=/tmp/uwsgi-emperor.conf
29
+ dest=/etc/init/emperor.conf
30
+ cat <<-Conf >$tmpfile
31
+ #Emperor uWSGI script
32
+ #Generated at `date`
33
+
34
+ description "uWSGI Emperor Job"
35
+ start on runlevel [2345]
36
+ stop on runlevel [06]
37
+
38
+ setuid $app_user
39
+ setgid $app_user
40
+
41
+ exec $bin_uwsgi --master --die-on-term --emperor $conf_dir
42
+ Conf
43
+ sudo cp -b $tmpfile $dest
44
+ echo Has configured uWSGI emperor to $dest
data/sh/install ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env bash
2
+
3
+ which gem &>/dev/null || { echo No ruby env && exit 1;}
4
+ gem query -in uwsgi >/dev/null && echo "Has installed uwsgi gem" && exit
5
+
6
+ echo Ref: http://uwsgi-docs.readthedocs.org/en/latest/RackQuickstart.html#automatically-starting-uwsgi-on-boot
7
+ echo Installing uwsgi gem for rack app
8
+ sudo apt-get -y install libssl-dev libpcre3-dev
9
+ gem install uwsgi
10
+ echo Installed uwsgi
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cap-uwsgi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - cao7113
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-22 00:00:00.000000000 Z
11
+ date: 2014-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: '3.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: gem-release
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  description: uWSGI integration for Capistrano 3
28
42
  email:
29
43
  - cao7113@hotmail.com
@@ -37,18 +51,26 @@ files:
37
51
  - Rakefile
38
52
  - Readme.md
39
53
  - cap-uwsgi.gemspec
54
+ - doc/conf/rack.ini
55
+ - doc/conf/rails.ini
56
+ - doc/conf/sinatra.ini
57
+ - doc/options.md
58
+ - doc/upstart.md
40
59
  - lib/cap-uwsgi.rb
41
60
  - lib/capistrano/tasks/emperor.cap
42
61
  - lib/capistrano/tasks/nginx.cap
43
62
  - lib/capistrano/tasks/uwsgi.cap
44
63
  - lib/capistrano/templates/uwsgi.ini.erb
64
+ - lib/capistrano/templates/uwsgi.ini.skel.erb
45
65
  - lib/capistrano/templates/uwsgi_emperor.conf.erb
46
66
  - lib/capistrano/templates/uwsgi_nginx.conf.erb
47
67
  - lib/capistrano/uwsgi.rb
48
68
  - lib/capistrano/uwsgi/emperor.rb
49
69
  - lib/capistrano/uwsgi/nginx.rb
50
70
  - lib/capistrano/uwsgi/version.rb
51
- homepage: http://shareup.me
71
+ - sh/init-emperor
72
+ - sh/install
73
+ homepage: http://github.com/cao7113/cap-uwsgi
52
74
  licenses:
53
75
  - MIT
54
76
  metadata: {}