mina-pumamanager 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: cd904e4f2f7fba90423a0ea0b345cc094fb90a80
4
+ data.tar.gz: e44a1caaf4ac779aa1a71e74cc074ec7eaf8782e
5
+ SHA512:
6
+ metadata.gz: 013d77af4862c0b40b1c102950abb59281c9f8fe2cde6fc72311c9a5eb84803b5c2957d613a4ea21cdf9bbc973acabaf404a881e4bfec12f9799fa4ba4b85fb0
7
+ data.tar.gz: 9e32721003a614950042bee0a020dab1a394d6f7230cc9bfb8e34af0304b12ff71bb2422532109157f7f48c5e6577378c52d9890385a60e50182fbfe4fa3b7e9
data/.DS_Store ADDED
Binary file
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.2
4
+ before_install: gem install bundler -v 1.10.5
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in mina-pumamanager.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 yanguango
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,47 @@
1
+ # Mina::Pumamanager
2
+
3
+ ## Installation
4
+
5
+ Add this line to your application's Gemfile:
6
+
7
+ gem 'mina-pumamanager', require: false
8
+
9
+ And then execute:
10
+
11
+ $ bundle
12
+
13
+ Or install it yourself as:
14
+
15
+ $ gem install mina-pumamanager
16
+
17
+ ## Usage
18
+
19
+ Add this to your `config/deploy.rb` file:
20
+
21
+ require 'mina/puma'
22
+
23
+ Make sure the following settings are set in your `config/deploy.rb`:
24
+ * `deploy_to` - deployment path
25
+ * `shared_path` - shared files path
26
+
27
+ ## Tasks
28
+
29
+ * pumamanager:setup - setup config files for puma-manager
30
+ * puma-manager:start - start puma-manager
31
+ * puma-manager:stop - stop puma-manager
32
+ * puma-manager:restart - restart puma-manager
33
+
34
+ ## Development
35
+
36
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
37
+
38
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
39
+
40
+ ## Contributing
41
+
42
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/mina-pumamanager. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
43
+
44
+
45
+ ## License
46
+
47
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList['test/**/*_test.rb']
8
+ end
9
+
10
+ task :default => :test
@@ -0,0 +1 @@
1
+ load File.expand_path("../pumamanager/tasks.rake", __FILE__)
@@ -0,0 +1,31 @@
1
+ # /etc/init/puma-manager.conf - manage a set of Pumas
2
+
3
+ # This example config should work with Ubuntu 12.04+. It
4
+ # allows you to manage multiple Puma instances with
5
+ # Upstart, Ubuntu's native service management tool.
6
+ #
7
+ # See puma.conf for how to manage a single Puma instance.
8
+ #
9
+ # Use "stop puma-manager" to stop all Puma instances.
10
+ # Use "start puma-manager" to start all instances.
11
+ # Use "restart puma-manager" to restart all instances.
12
+ # Crazy, right?
13
+ #
14
+
15
+ description "Manages the set of puma processes"
16
+
17
+ # This starts upon bootup and stops on shutdown
18
+ start on runlevel [2345]
19
+ stop on runlevel [06]
20
+
21
+ # Set this to the number of Puma processes you want
22
+ # to run on this machine
23
+ env PUMA_CONF="/etc/puma.conf"
24
+
25
+ pre-start script
26
+ for i in \`cat $PUMA_CONF\`; do
27
+ app=\`echo $i | cut -d , -f 1\`
28
+ logger -t "puma-manager" "Starting $app"
29
+ start puma app=$app
30
+ done
31
+ end script
@@ -0,0 +1,70 @@
1
+ # /etc/init/puma.conf - Puma config
2
+
3
+ # This example config should work with Ubuntu 12.04+. It
4
+ # allows you to manage multiple Puma instances with
5
+ # Upstart, Ubuntu's native service management tool.
6
+ #
7
+ # See workers.conf for how to manage all Puma instances at once.
8
+ #
9
+ # Save this config as /etc/init/puma.conf then manage puma with:
10
+ # sudo start puma app=PATH_TO_APP
11
+ # sudo stop puma app=PATH_TO_APP
12
+ # sudo status puma app=PATH_TO_APP
13
+ #
14
+ # or use the service command:
15
+ # sudo service puma {start,stop,restart,status}
16
+ #
17
+
18
+ description "Puma Background Worker"
19
+
20
+ # no "start on", we don't want to automatically start
21
+ stop on (stopping puma-manager or runlevel [06])
22
+
23
+
24
+ # change apps to match your deployment user if you want to use this as a less privileged user (recommended!)
25
+ setuid <%= puma_role %>
26
+ setgid <%= puma_role %>
27
+
28
+ respawn
29
+ respawn limit 3 30
30
+
31
+ instance ${app}
32
+
33
+ script
34
+ # this script runs in /bin/sh by default
35
+ # respawn as bash so we can source in rbenv/rvm
36
+ # quoted heredoc to tell /bin/sh not to interpret
37
+ # variables
38
+
39
+ # source ENV variables manually as Upstart doesn't, eg:
40
+ #. /etc/environment
41
+
42
+ exec /bin/bash <<'EOT'
43
+ # set HOME to the setuid user's home, there doesn't seem to be a better, portable way
44
+ export HOME="$(eval echo ~$(id -un))"
45
+
46
+ if [ -d "/usr/local/rbenv/bin" ]; then
47
+ export PATH="/usr/local/rbenv/bin:/usr/local/rbenv/shims:$PATH"
48
+ elif [ -d "$HOME/.rbenv/bin" ]; then
49
+ export PATH="$HOME/.rbenv/bin:$HOME/.rbenv/shims:$PATH"
50
+ elif [ -f /etc/profile.d/rvm.sh ]; then
51
+ source /etc/profile.d/rvm.sh
52
+ elif [ -f /usr/local/rvm/scripts/rvm ]; then
53
+ source /etc/profile.d/rvm.sh
54
+ elif [ -f "$HOME/.rvm/scripts/rvm" ]; then
55
+ source "$HOME/.rvm/scripts/rvm"
56
+ elif [ -f /usr/local/share/chruby/chruby.sh ]; then
57
+ source /usr/local/share/chruby/chruby.sh
58
+ if [ -f /usr/local/share/chruby/auto.sh ]; then
59
+ source /usr/local/share/chruby/auto.sh
60
+ fi
61
+ # if you aren't using auto, set your version here
62
+ # chruby 2.0.0
63
+ fi
64
+
65
+ cd $app
66
+ logger -t puma "Starting server: $app"
67
+
68
+ exec bundle exec puma -C config/puma.rb
69
+ EOT
70
+ end script
@@ -0,0 +1,66 @@
1
+ namespace :pumamanager do
2
+
3
+ set_default :puma_role, -> { user }
4
+ set_default :puma_app_list, "/etc/puma.conf"
5
+ set_default :upstart_dir, "/etc/init"
6
+
7
+ desc 'Setup puma-manager'
8
+ task :setup => :environment do
9
+ queue %(echo "-----> Setup the puma-manager")
10
+
11
+ puma_conf_content = erb(puma_conf_template).gsub(/(["$])/){"\\#{$1}"}
12
+ puma_conf_temp = "#{deploy_to}/#{shared_path}/puma.conf"
13
+ queue! %[
14
+ if [ -e '#{upstart_dir}/puma.conf' ]; then
15
+ echo '#{upstart_dir}/puma.conf is existed!';
16
+ else
17
+ echo "#{puma_conf_content}" > #{puma_conf_temp}
18
+ sudo cp #{puma_conf_temp} #{upstart_dir}
19
+ fi
20
+ ]
21
+
22
+ puma_manager_conf_content = erb(puma_manager_conf_template).gsub(/(["$])/){"\\#{$1}"}
23
+ puma_manager_conf_temp = "#{deploy_to}/#{shared_path}/puma-manager.conf"
24
+ queue %[
25
+ if [ -e '#{upstart_dir}/puma_manager.conf' ]; then
26
+ echo '#{upstart_dir}/puma_manager.conf is existed!';
27
+ else
28
+ echo "#{puma_manager_conf_content}" > #{puma_manager_conf_temp}
29
+ sudo cp #{puma_manager_conf_temp} #{upstart_dir}
30
+ fi
31
+ ]
32
+
33
+ app_path = "#{deploy_to}/current"
34
+ queue! %[
35
+ if ! [ -e '#{puma_app_list}' ]; then
36
+ sudo touch #{puma_app_list}
37
+ sudo chmod o+rw #{puma_app_list}
38
+ fi
39
+
40
+ if ! grep -q #{app_path} #{puma_app_list}; then
41
+ sudo echo #{app_path} >> #{puma_app_list}
42
+ fi
43
+ ]
44
+ end
45
+
46
+ task :start => :environment do
47
+ queue %(sudo start puma-manager)
48
+ end
49
+
50
+ task :stop => :environment do
51
+ queue %(sudo stop puma-manager)
52
+ end
53
+
54
+ task :restart => :environment do
55
+ queue %(sudo restart puma-manager)
56
+ end
57
+
58
+ private
59
+ def puma_conf_template
60
+ File.expand_path('../puma.conf.erb', __FILE__)
61
+ end
62
+
63
+ def puma_manager_conf_template
64
+ File.expand_path('../puma-manager.conf.erb', __FILE__)
65
+ end
66
+ end
@@ -0,0 +1,5 @@
1
+ module Mina
2
+ module Pumamanager
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'mina/pumamanager/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "mina-pumamanager"
8
+ spec.version = Mina::Pumamanager::VERSION
9
+ spec.authors = ["yanguango"]
10
+ spec.email = ["yanguango@gmail.com"]
11
+
12
+ spec.summary = %q{Puma-manager tasks for Mina}
13
+ spec.description = %q{Mina task to setup and handle puma-manager}
14
+ spec.homepage = "https://github.com/yanguango/mina-pumamanager"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = "exe"
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_dependency 'mina'
23
+ spec.add_development_dependency "bundler", "~> 1.10"
24
+ spec.add_development_dependency "rake", "~> 10.0"
25
+ end
metadata ADDED
@@ -0,0 +1,101 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mina-pumamanager
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - yanguango
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-08-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: mina
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.10'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.10'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ description: Mina task to setup and handle puma-manager
56
+ email:
57
+ - yanguango@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".DS_Store"
63
+ - ".gitignore"
64
+ - ".travis.yml"
65
+ - CODE_OF_CONDUCT.md
66
+ - Gemfile
67
+ - LICENSE.txt
68
+ - README.md
69
+ - Rakefile
70
+ - lib/mina/pumamanager.rb
71
+ - lib/mina/pumamanager/puma-manager.conf.erb
72
+ - lib/mina/pumamanager/puma.conf.erb
73
+ - lib/mina/pumamanager/tasks.rake
74
+ - lib/mina/pumamanager/version.rb
75
+ - mina-pumamanager.gemspec
76
+ homepage: https://github.com/yanguango/mina-pumamanager
77
+ licenses:
78
+ - MIT
79
+ metadata: {}
80
+ post_install_message:
81
+ rdoc_options: []
82
+ require_paths:
83
+ - lib
84
+ required_ruby_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ required_rubygems_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ requirements: []
95
+ rubyforge_project:
96
+ rubygems_version: 2.4.5
97
+ signing_key:
98
+ specification_version: 4
99
+ summary: Puma-manager tasks for Mina
100
+ test_files: []
101
+ has_rdoc: