pixelforce_recipes 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: 6cbec43c71767f6eb8df4424b10380ee6f793706
4
+ data.tar.gz: a02541bb61a87823acd3a8af14c8d1383043b5af
5
+ SHA512:
6
+ metadata.gz: 844badeba418485ce25036b19bdba045cc57a8c6e57a429683794204acce7381f42ac1684a56050c244a7a0eec05d06dbdb9b4fa9ec5fded9fb840e5492cdc54
7
+ data.tar.gz: 6ec02896a84eeb82ff348a769b111ca47b5f04930a67f78cc10feb742f7ce8cb628d4b022e04863316d9636813a338695b3deaebaee8b4fa847c06142be9104d
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ /pkg
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in pixelforce_recipes.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,52 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ pixelforce_recipes (0.1.0)
5
+ capistrano (> 2.0.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ airbrussh (1.1.0)
11
+ sshkit (>= 1.6.1, != 1.7.0)
12
+ capistrano (3.6.1)
13
+ airbrussh (>= 1.0.0)
14
+ capistrano-harrow
15
+ i18n
16
+ rake (>= 10.0.0)
17
+ sshkit (>= 1.9.0)
18
+ capistrano-harrow (0.5.3)
19
+ diff-lcs (1.2.5)
20
+ i18n (0.7.0)
21
+ net-scp (1.2.1)
22
+ net-ssh (>= 2.6.5)
23
+ net-ssh (3.2.0)
24
+ rake (10.5.0)
25
+ rspec (3.5.0)
26
+ rspec-core (~> 3.5.0)
27
+ rspec-expectations (~> 3.5.0)
28
+ rspec-mocks (~> 3.5.0)
29
+ rspec-core (3.5.2)
30
+ rspec-support (~> 3.5.0)
31
+ rspec-expectations (3.5.0)
32
+ diff-lcs (>= 1.2.0, < 2.0)
33
+ rspec-support (~> 3.5.0)
34
+ rspec-mocks (3.5.0)
35
+ diff-lcs (>= 1.2.0, < 2.0)
36
+ rspec-support (~> 3.5.0)
37
+ rspec-support (3.5.0)
38
+ sshkit (1.11.2)
39
+ net-scp (>= 1.1.2)
40
+ net-ssh (>= 2.8.0)
41
+
42
+ PLATFORMS
43
+ ruby
44
+
45
+ DEPENDENCIES
46
+ bundler (~> 1.12)
47
+ pixelforce_recipes!
48
+ rake (~> 10.0)
49
+ rspec (~> 3.0)
50
+
51
+ BUNDLED WITH
52
+ 1.12.5
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2016
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 all
13
+ 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 THE
21
+ SOFTWARE.
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 John
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,41 @@
1
+ # PixelforceRecipes
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/pixelforce_recipes`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'pixelforce_recipes'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install pixelforce_recipes
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ 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).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/pixelforce_recipes. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
+
37
+
38
+ ## License
39
+
40
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
41
+
data/Rakefile ADDED
@@ -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
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "pixelforce_recipes"
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
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,6 @@
1
+ require "pixelforce_recipes/version"
2
+ require "capistrano"
3
+
4
+ require File.expand_path("#{File.dirname(__FILE__)}/pixelforce_recipes/base")
5
+ require File.expand_path("#{File.dirname(__FILE__)}/pixelforce_recipes/unicorn")
6
+ require File.expand_path("#{File.dirname(__FILE__)}/pixelforce_recipes/sidekiq")
@@ -0,0 +1,24 @@
1
+ if Capistrano::Configuration.instance(false)
2
+
3
+ Capistrano::Configuration.instance(true).load do |instance|
4
+
5
+ def template(from, to)
6
+ erb = File.read(File.expand_path("../templates/#{from}", __FILE__))
7
+ put ERB.new(erb).result(binding), to
8
+ end
9
+
10
+ def set_default(name, *args, &block)
11
+ set(name, *args, &block) unless exists?(name)
12
+ end
13
+
14
+ namespace :deploy do
15
+ desc "Install everything onto the server"
16
+ task :install do
17
+ run "#{sudo} apt-get -y update"
18
+ run "#{sudo} apt-get -y install curl git-core python-software-properties build-essential openssl libreadline6 libreadline6-dev zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion"
19
+ end
20
+ end
21
+
22
+ end
23
+
24
+ end
@@ -0,0 +1,19 @@
1
+ namespace :sidekiq do
2
+ desc "Install sidekiq"
3
+
4
+ desc "Setup sidekiq configuration for this application"
5
+ task :setup, roles: :sidekiq do
6
+ template "sidekiq_init.erb", "/tmp/sidekiq"
7
+ run "#{sudo} mv /tmp/sidekiq /etc/init.d/sidekiq"
8
+ run "#{sudo} chmod +x /etc/init.d/sidekiq"
9
+ run "#{sudo} update-rc.d sidekiq defaults"
10
+ end
11
+ # after "deploy:setup", "nginx:setup"
12
+
13
+ %w[start stop restart].each do |command|
14
+ desc "#{command} sidekiq"
15
+ task command do
16
+ run "/etc/init.d/sidekiq #{command}"
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,29 @@
1
+ upstream <%= application %> {
2
+ server unix:/tmp/<%= application %>.sock fail_timeout=0;
3
+ }
4
+
5
+ server {
6
+ listen 80;
7
+ server_name <%= server_address %>;
8
+ root /home/deploy/<%= application %>/current/public;
9
+
10
+ try_files $uri/index.html $uri @<%= application %>;
11
+
12
+ location ~* ^(/assets|/favicon.ico) {
13
+ access_log off;
14
+ expires max;
15
+ }
16
+
17
+ location @<%= application %> {
18
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
19
+ proxy_set_header Host $http_host;
20
+ proxy_redirect off;
21
+ proxy_buffering on;
22
+ proxy_set_header X-Real-IP $remote_addr;
23
+ proxy_pass http://<%= application %>;
24
+ }
25
+
26
+ error_page 500 502 503 504 /500.html;
27
+ client_max_body_size 1G;
28
+ keepalive_timeout 10;
29
+ }
@@ -0,0 +1,50 @@
1
+ #!/bin/bash
2
+
3
+ ### BEGIN INIT INFO
4
+ # Provides: sidekiq
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 sidekiq web server
10
+ # Description: starts sidekiq
11
+ ### END INIT INFO
12
+
13
+ USER="deploy"
14
+ DAEMON=sidekiq
15
+ PROJECT_PATH="<%= deploy_to %>"
16
+ NAME=sidekiq
17
+ DESC="Sidekiq app for $USER"
18
+ PID="$PROJECT_PATH/shared/pids/sidekiq.pid"
19
+ LOGFILE="$PROJECT_PATH/shared/log/sidekiq.log"
20
+
21
+ case "$1" in
22
+ start)
23
+ CD_TO_APP_DIR="cd $PROJECT_PATH/current"
24
+ START_DAEMON_PROCESS="bundle exec sidekiq -d -e production -L $LOGFILE -P $PID"
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 -INT `cat $PID`
37
+ echo "$NAME."
38
+ ;;
39
+ reload)
40
+ echo -n "Reloading $DESC configuration: "
41
+ kill -HUP `cat $PID`
42
+ echo "$NAME."
43
+ ;;
44
+ *)
45
+ echo "Usage: $NAME {start|stop|restart|reload}" >&2
46
+ exit 1
47
+ ;;
48
+ esac
49
+
50
+ exit 0
@@ -0,0 +1,55 @@
1
+ #!/bin/bash
2
+
3
+ ### BEGIN INIT INFO
4
+ # Provides: unicorn
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 unicorn web server
10
+ # Description: starts unicorn
11
+ ### END INIT INFO
12
+
13
+ USER="deploy"
14
+ DAEMON=unicorn
15
+ PROJECT_PATH="<%= deploy_to %>"
16
+ DAEMON_OPTS="-c $PROJECT_PATH/current/config/unicorn.rb -E <%= rails_env %> -D"
17
+ NAME=unicorn
18
+ DESC="Unicorn app for $USER"
19
+ PID="$PROJECT_PATH/shared/pids/unicorn.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
@@ -0,0 +1,29 @@
1
+ if Capistrano::Configuration.instance(false)
2
+
3
+ Capistrano::Configuration.instance(true).load do |instance|
4
+
5
+ namespace :unicorn do
6
+ desc "Install unicorn"
7
+
8
+ desc "Setup unicorn configuration for this application"
9
+ task :setup, roles: :web do
10
+ template "unicorn_init.erb", "/tmp/unicorn"
11
+ run "#{sudo} mv /tmp/unicorn /etc/init.d/#{application}"
12
+ run "#{sudo} chmod +x /etc/init.d/#{application}"
13
+ run "#{sudo} update-rc.d #{application} defaults"
14
+ template "nginx_config.erb", "/tmp/nginx_config"
15
+ run "#{sudo} mv /tmp/nginx_config /etc/nginx/sites-enabled/#{application}"
16
+ end
17
+ # after "deploy:setup", "nginx:setup"
18
+
19
+ %w[start stop restart].each do |command|
20
+ desc "#{command} unicorn"
21
+ task command, roles: :web do
22
+ run "/etc/init.d/#{application} #{command}"
23
+ end
24
+ end
25
+ end
26
+
27
+ end
28
+
29
+ end
@@ -0,0 +1,3 @@
1
+ module PixelforceRecipes
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'pixelforce_recipes/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "pixelforce_recipes"
8
+ spec.version = PixelforceRecipes::VERSION
9
+ spec.authors = ["Ben Zhang"]
10
+ spec.email = ["bzbnhang@gmail.com"]
11
+
12
+ spec.summary = %q{Write a short summary, because Rubygems requires one.}
13
+ spec.description = %q{Write a longer description or delete this line.}
14
+ spec.homepage = "https://git.pixelforcesystems.com.au/"
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_development_dependency "bundler", "~> 1.12"
23
+ spec.add_development_dependency "rake", "~> 10.0"
24
+ spec.add_development_dependency "rspec", "~> 3.0"
25
+ spec.add_dependency(%q<capistrano>, ["> 2.0.0"])
26
+ end
metadata ADDED
@@ -0,0 +1,118 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pixelforce_recipes
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Ben Zhang
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-09-13 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.12'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.12'
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: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: capistrano
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">"
60
+ - !ruby/object:Gem::Version
61
+ version: 2.0.0
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">"
67
+ - !ruby/object:Gem::Version
68
+ version: 2.0.0
69
+ description: Write a longer description or delete this line.
70
+ email:
71
+ - bzbnhang@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - Gemfile
78
+ - Gemfile.lock
79
+ - LICENSE
80
+ - LICENSE.txt
81
+ - README.md
82
+ - Rakefile
83
+ - bin/console
84
+ - bin/setup
85
+ - lib/pixelforce_recipes.rb
86
+ - lib/pixelforce_recipes/base.rb
87
+ - lib/pixelforce_recipes/sidekiq.rb
88
+ - lib/pixelforce_recipes/templates/nginx_config.erb
89
+ - lib/pixelforce_recipes/templates/sidekiq_init.erb
90
+ - lib/pixelforce_recipes/templates/unicorn_init.erb
91
+ - lib/pixelforce_recipes/unicorn.rb
92
+ - lib/pixelforce_recipes/version.rb
93
+ - pixelforce_recipes.gemspec
94
+ homepage: https://git.pixelforcesystems.com.au/
95
+ licenses:
96
+ - MIT
97
+ metadata: {}
98
+ post_install_message:
99
+ rdoc_options: []
100
+ require_paths:
101
+ - lib
102
+ required_ruby_version: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ required_rubygems_version: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ requirements: []
113
+ rubyforge_project:
114
+ rubygems_version: 2.4.8
115
+ signing_key:
116
+ specification_version: 4
117
+ summary: Write a short summary, because Rubygems requires one.
118
+ test_files: []