itamae-plugin-recipe-unicorn 0.1.0

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 473f917fe25cea4019d0696b814926f3d7d56663
4
+ data.tar.gz: ba78236bf4974ca8909a5e15a9581659a6575b88
5
+ SHA512:
6
+ metadata.gz: 1ffb8637d48a26d3c9354380f4cd439fc0510fa104cd3983cd4c68fdadad0c665353e55c0c71dca6a10f066a0e49b0f8616fefc1924cd117a05bae75abd15eef
7
+ data.tar.gz: b0f2f02fb714db648f4d6c5b57da781f606f65c06cb2333ef82159bfdd315266edc5b91afc6fef181fbe4669a9791a88c0dba49daf1b8086658511b8c94054b9
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ /.idea/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.3
4
+ before_install: gem install bundler -v 1.10.6
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in itamae-plugin-recipe-unicorn.gemspec
4
+ gemspec
@@ -0,0 +1,49 @@
1
+ # Itamae::Plugin::Recipe::unicorn
2
+
3
+ Itamae recipe plugin for unicorn service script.
4
+
5
+ - unicorn service script
6
+ - unicorn logrotate.d script
7
+
8
+ ## Installation
9
+
10
+ Add this line to your application's Gemfile:
11
+
12
+ ```ruby
13
+ gem 'itamae-plugin-recipe-unicorn'
14
+ ```
15
+
16
+ And then execute:
17
+
18
+ $ bundle
19
+
20
+ Or install it yourself as:
21
+
22
+ $ gem install itamae-plugin-recipe-unicorn
23
+
24
+ ## Usage
25
+
26
+ ### Install
27
+
28
+ ```ruby
29
+ include_recipe "unicorn::service"
30
+ include_recipe "unicorn::logrotate"
31
+ ```
32
+
33
+ ```yaml
34
+ unicorn:
35
+ path: /usr/local/rbenv/shims:/usr/local/rbenv/bin:$PATH
36
+ rbenv_root: /home/ec2-user/.rbenv
37
+ ruby_ver: 2.1.0
38
+ env: production
39
+ app_root: /var/www/www.example.com
40
+ app_dir: /current
41
+ conf_dir: /current/config/unicorn/production.rb
42
+ pid_dir: /shared/tmp/pids/unicorn.pid
43
+ user: ec2-user
44
+ log_rotate_interval: 12
45
+ ```
46
+
47
+ ## Contributing
48
+
49
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/itamae-plugin-recipe-unicorn.
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "itamae/plugin/recipe/unicorn"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'itamae/plugin/recipe/unicorn/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "itamae-plugin-recipe-unicorn"
8
+ spec.version = Itamae::Plugin::Recipe::Unicorn::VERSION
9
+ spec.authors = ["zaru"]
10
+ spec.email = ["zarutofu@gmail.com"]
11
+
12
+ spec.summary = %q{Itamae plugin to install unicorn service script}
13
+ spec.description = %q{Itamae plugin to install unicorn service script}
14
+ spec.homepage = "https://github.com/zaru/itamae-plugin-recipe-unicorn"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.bindir = "exe"
18
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.10"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_development_dependency "rspec"
24
+ end
@@ -0,0 +1 @@
1
+ require "itamae/plugin/recipe/unicorn/version"
@@ -0,0 +1,6 @@
1
+ template "/etc/logrotate.d/unicorn" do
2
+ owner "root"
3
+ group "root"
4
+ mode "644"
5
+ source "./templates/etc/logrotate.d/unicorn.erb"
6
+ end
@@ -0,0 +1,6 @@
1
+ template "/etc/rc.d/init.d/unicorn" do
2
+ owner "root"
3
+ group "root"
4
+ mode "755"
5
+ source "./templates/etc/rc.d/init.d/unicorn.erb"
6
+ end
@@ -0,0 +1,15 @@
1
+ <%= node[:unicorn][:app_root] %>/shared/log/*.log
2
+ <%= node[:unicorn][:app_root] %>/log/*.log {
3
+ daily
4
+ rotate <%= node[:unicorn][:log_rotate_interval] %>
5
+ missingok
6
+ notifempty
7
+ copytruncate
8
+ compress
9
+ create 0666 <%= node[:unicorn][:user] %> <%= node[:unicorn][:user] %>
10
+
11
+ lastaction
12
+ pid=<%= node[:unicorn][:app_root] %><%= node[:unicorn][:pid_dir] %>
13
+ test -s $pid && kill -USR1 "$(cat $pid)"
14
+ endscript
15
+ }
@@ -0,0 +1,85 @@
1
+ #!/bin/sh
2
+
3
+ export PATH=<%= node[:unicorn][:path] %>
4
+ export RBENV_ROOT=<%= node[:unicorn][:rbenv_root] %>
5
+ export RBENV_VERSION=<%= node[:unicorn][:ruby_ver] %>
6
+ export RAILS_ENV=<%= node[:unicorn][:env] %>
7
+ ENVIROMENT=<%= node[:unicorn][:env] %>
8
+ NAME=unicorn
9
+ APP_ROOT_DIR="<%= node[:unicorn][:app_root] %><%= node[:unicorn][:app_dir] %>"
10
+ CONF="<%= node[:unicorn][:app_root] %><%= node[:unicorn][:conf_dir] %>"
11
+ PID="<%= node[:unicorn][:app_root] %><%= node[:unicorn][:pid_dir] %>"
12
+ USER=<%= node[:unicorn][:user] %>
13
+
14
+ start()
15
+ {
16
+ if [ -e $PID ]; then
17
+ echo "$NAME already started";
18
+ exit 1;
19
+ fi
20
+ echo "start $NAME";
21
+ cd $APP_ROOT_DIR
22
+ su -c "$RBENV_ROOT/bin/rbenv exec bundle exec unicorn -E $ENVIROMENT -c $CONF -D" $USER
23
+ }
24
+
25
+ stop()
26
+ {
27
+ if [ ! -e $PID ]; then
28
+ echo "$NAME not started";
29
+ exit 1;
30
+ fi
31
+ echo "stop $NAME";
32
+ su -c "kill -QUIT `cat ${PID}`" $USER
33
+ su -c "rm -f $PID" $USER
34
+ }
35
+
36
+ force_stop()
37
+ {
38
+ if [ ! -e $PID ]; then
39
+ echo "$NAME not started";
40
+ exit 1;
41
+ fi
42
+ echo "stop $NAME";
43
+ su -c "kill -TERM `cat ${PID}`" $USER
44
+ su -c "rm -f $PID" $USER
45
+ }
46
+
47
+ reload()
48
+ {
49
+ if [ ! -e $PID ]; then
50
+ echo "$NAME not started";
51
+ start
52
+ exit 0;
53
+ fi
54
+ echo "reload $NAME";
55
+ su -c "kill -HUP `cat ${PID}`" $USER
56
+ }
57
+
58
+ restart()
59
+ {
60
+ stop
61
+ start
62
+ }
63
+
64
+ case "$1" in
65
+ start)
66
+ start
67
+ ;;
68
+ stop)
69
+ stop
70
+ ;;
71
+ force-stop)
72
+ force_stop
73
+ ;;
74
+ reload)
75
+ reload
76
+ ;;
77
+ restart)
78
+ restart
79
+ ;;
80
+ *)
81
+ echo "Syntax Error: release [start|stop|force-stop|reload|restart]"
82
+ ;;
83
+ esac
84
+
85
+ exit
@@ -0,0 +1,9 @@
1
+ module Itamae
2
+ module Plugin
3
+ module Recipe
4
+ module Unicorn
5
+ VERSION = "0.1.0"
6
+ end
7
+ end
8
+ end
9
+ end
metadata ADDED
@@ -0,0 +1,100 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: itamae-plugin-recipe-unicorn
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - zaru
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-11-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.10'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.10'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: Itamae plugin to install unicorn service script
56
+ email:
57
+ - zarutofu@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".rspec"
64
+ - ".travis.yml"
65
+ - Gemfile
66
+ - README.md
67
+ - Rakefile
68
+ - bin/console
69
+ - bin/setup
70
+ - itamae-plugin-recipe-unicorn.gemspec
71
+ - lib/itamae/plugin/recipe/unicorn.rb
72
+ - lib/itamae/plugin/recipe/unicorn/logrotate.rb
73
+ - lib/itamae/plugin/recipe/unicorn/service.rb
74
+ - lib/itamae/plugin/recipe/unicorn/templates/etc/logrotate.d/unicorn.erb
75
+ - lib/itamae/plugin/recipe/unicorn/templates/etc/rc.d/init.d/unicorn.erb
76
+ - lib/itamae/plugin/recipe/unicorn/version.rb
77
+ homepage: https://github.com/zaru/itamae-plugin-recipe-unicorn
78
+ licenses: []
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.1
97
+ signing_key:
98
+ specification_version: 4
99
+ summary: Itamae plugin to install unicorn service script
100
+ test_files: []