supporting_cast 0.0.1
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.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +47 -0
- data/Rakefile +1 -0
- data/lib/generators/supporting_cast/config_generator.rb +19 -0
- data/lib/generators/supporting_cast/database_config_generator.rb +17 -0
- data/lib/generators/supporting_cast/elasticsearch_config_generator.rb +46 -0
- data/lib/generators/supporting_cast/foreman_config_generator.rb +17 -0
- data/lib/generators/supporting_cast/generator_helpers.rb +23 -0
- data/lib/generators/supporting_cast/nginx_config_generator.rb +25 -0
- data/lib/generators/supporting_cast/redis_config_generator.rb +39 -0
- data/lib/generators/supporting_cast/sidekiq_config_generator.rb +17 -0
- data/lib/generators/supporting_cast/ssl_certificate_generator.rb +33 -0
- data/lib/generators/supporting_cast/sunspot_config_generator.rb +23 -0
- data/lib/generators/supporting_cast/templates/Procfile.erb +24 -0
- data/lib/generators/supporting_cast/templates/database.yml.erb +11 -0
- data/lib/generators/supporting_cast/templates/elasticsearch.yml.erb +1 -0
- data/lib/generators/supporting_cast/templates/elasticsearch_config.yml.erb +359 -0
- data/lib/generators/supporting_cast/templates/nginx.conf.erb +129 -0
- data/lib/generators/supporting_cast/templates/redis.conf.erb +13 -0
- data/lib/generators/supporting_cast/templates/redis.yml.erb +7 -0
- data/lib/generators/supporting_cast/templates/sidekiq.yml.erb +9 -0
- data/lib/generators/supporting_cast/templates/sunspot.yml.erb +11 -0
- data/lib/generators/supporting_cast/templates/unicorn.rb.erb +55 -0
- data/lib/generators/supporting_cast/unicorn_config_generator.rb +21 -0
- data/lib/supporting_cast.rb +5 -0
- data/lib/supporting_cast/railtie.rb +12 -0
- data/lib/supporting_cast/version.rb +3 -0
- data/lib/tasks/supporting_cast.rake +53 -0
- data/supporting_cast.gemspec +19 -0
- metadata +78 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Ross Kaffenberger
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# SupportingCast
|
2
|
+
|
3
|
+
Opinionated generators for common Rails backing services, e.g. Redis, nginx, sidekiq, nginx, i.e., the supporting cast.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'supporting_cast', :group => :development
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install supporting_cast
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
$ rails g supporting_cast:config # Bootstrap the whole supporting cast
|
22
|
+
|
23
|
+
$ rails g supporting_cast:<name>_config # Generate config for given cast member
|
24
|
+
|
25
|
+
## Configurations
|
26
|
+
|
27
|
+
SupportingCast is intended to make it easier to get backing services up and running for Rails local (development and test) environments. A guiding principle, largely inspired by the [12 Factor App](http://www.12factor.net/), is to minimize divergence between local and production environments.
|
28
|
+
|
29
|
+
### Redis
|
30
|
+
|
31
|
+
As Francis Hwang said in his post, [Testing Rails Against a Running Redis Instance](http://fhwang.net/2010/09/23/Testing-Rails-against-a-running-Redis-instance-and-doing-it-with-Hydra-to-boot):
|
32
|
+
|
33
|
+
> If your Rails app uses Redis, there are basically three approaches you can take for when the code under test hits Redis.
|
34
|
+
>
|
35
|
+
> 1. Mock Redis
|
36
|
+
> 2. Stub Redis
|
37
|
+
> 3. Stop messing around and just use Redis
|
38
|
+
|
39
|
+
SupportingCast will generate configurations for running separate Redis instances for development and test. Paired with the foreman configuration, it's dead simple to start/stop multiple Redis instances for local environments. You could [use Redis namespaces to separate environments](http://dev.af83.com/2012/07/31/should-we-namespace-redis.html), but why mess around?
|
40
|
+
|
41
|
+
## Contributing
|
42
|
+
|
43
|
+
1. Fork it
|
44
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
45
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
46
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
47
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module SupportingCast
|
2
|
+
module Generators
|
3
|
+
class ConfigGenerator < Rails::Generators::Base
|
4
|
+
desc "Generate configuration files for development and test"
|
5
|
+
|
6
|
+
def generate_config_files
|
7
|
+
Rails::Generators.invoke "supporting_cast:redis_config" if yes?("Configure redis? [yn]")
|
8
|
+
Rails::Generators.invoke "supporting_cast:database_config" if yes?("Configure database.yml? [yn]")
|
9
|
+
Rails::Generators.invoke "supporting_cast:elasticsearch_config" if yes?("Configure elasticsearch? [yn]")
|
10
|
+
Rails::Generators.invoke "supporting_cast:sunspot_config" if yes?("Configure sunspot? [yn]")
|
11
|
+
Rails::Generators.invoke "supporting_cast:foreman_config" if yes?("Add Procfile for foreman? [yn]")
|
12
|
+
Rails::Generators.invoke "supporting_cast:nginx_config" if yes?("Configure nginx? [yn]")
|
13
|
+
Rails::Generators.invoke "supporting_cast:unicorn_config" if yes?("Configure unicorn? [yn]")
|
14
|
+
Rails::Generators.invoke "supporting_cast:sidekiq_config" if yes?("Configure sidekiq? [yn]")
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'generators/supporting_cast/generator_helpers'
|
2
|
+
|
3
|
+
module SupportingCast
|
4
|
+
module Generators
|
5
|
+
class DatabaseConfigGenerator < Rails::Generators::Base
|
6
|
+
include GeneratorHelpers
|
7
|
+
|
8
|
+
desc "Generate database.yml file from template"
|
9
|
+
source_root File.join(File.dirname(__FILE__), 'templates')
|
10
|
+
|
11
|
+
def database_yml
|
12
|
+
template 'database.yml.erb', "config/database.yml"
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'generators/supporting_cast/generator_helpers'
|
2
|
+
|
3
|
+
module SupportingCast
|
4
|
+
module Generators
|
5
|
+
class ElasticsearchConfigGenerator < Rails::Generators::Base
|
6
|
+
include GeneratorHelpers
|
7
|
+
|
8
|
+
desc "Generate elasticsearch.yml and elasticsearch config files for development and test"
|
9
|
+
source_root File.join(File.dirname(__FILE__), 'templates')
|
10
|
+
|
11
|
+
attr_accessor :env, :port
|
12
|
+
|
13
|
+
def default_port
|
14
|
+
9200
|
15
|
+
end
|
16
|
+
|
17
|
+
def elasticsearch_options
|
18
|
+
{
|
19
|
+
"test" => { hosts: ["127.0.0.1:#{test_port}"] },
|
20
|
+
"development" => { hosts: ["127.0.0.1:#{development_port}"] }
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
def mkdir_elasticsearch_conf
|
25
|
+
empty_directory "config/elasticsearch"
|
26
|
+
end
|
27
|
+
|
28
|
+
def development_elasticsearch_conf
|
29
|
+
env = 'development'
|
30
|
+
port = development_port
|
31
|
+
template 'elasticsearch_config.yml.erb', "config/elasticsearch/#{env}.conf"
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_elasticsearch_conf
|
35
|
+
env = 'test'
|
36
|
+
port = test_port
|
37
|
+
template 'elasticsearch_config.yml.erb', "config/elasticsearch/#{env}.conf"
|
38
|
+
end
|
39
|
+
|
40
|
+
def redis_yml
|
41
|
+
template 'elasticsearch.yml.erb', "config/elasticsearch.yml"
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'generators/supporting_cast/generator_helpers'
|
2
|
+
|
3
|
+
module SupportingCast
|
4
|
+
module Generators
|
5
|
+
class ForemanConfigGenerator < Rails::Generators::Base
|
6
|
+
include GeneratorHelpers
|
7
|
+
source_root File.join(File.dirname(__FILE__), 'templates')
|
8
|
+
|
9
|
+
desc "Generate a Procfile for use with foreman"
|
10
|
+
|
11
|
+
def procfile
|
12
|
+
template 'Procfile.erb', "Procfile"
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module SupportingCast
|
2
|
+
module Generators
|
3
|
+
module GeneratorHelpers
|
4
|
+
|
5
|
+
def application_name
|
6
|
+
ENV['APPLICATION_NAME'] || ::Rails.application.class.name.split('::').first.downcase
|
7
|
+
end
|
8
|
+
|
9
|
+
def rails_root
|
10
|
+
Rails.root
|
11
|
+
end
|
12
|
+
|
13
|
+
def development_port
|
14
|
+
@development_port ||= default_port + 1 + rand(100)
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_port
|
18
|
+
@test_port ||= development_port + 1
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'generators/supporting_cast/generator_helpers'
|
2
|
+
|
3
|
+
module SupportingCast
|
4
|
+
module Generators
|
5
|
+
class NginxConfigGenerator < Rails::Generators::Base
|
6
|
+
include GeneratorHelpers
|
7
|
+
source_root File.join(File.dirname(__FILE__), 'templates')
|
8
|
+
|
9
|
+
desc 'Generate nginx configuration for development'
|
10
|
+
|
11
|
+
def mkdir_nginx_conf
|
12
|
+
empty_directory 'config/nginx'
|
13
|
+
end
|
14
|
+
|
15
|
+
def nginx_conf
|
16
|
+
template 'nginx.conf.erb', 'config/nginx/nginx.conf'
|
17
|
+
end
|
18
|
+
|
19
|
+
def ssl_certificate
|
20
|
+
Rails::Generators.invoke "supporting_cast:ssl_certificate" if yes?("Add self-signed ssl ssl_certificate for nginx? [yn]")
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'generators/supporting_cast/generator_helpers'
|
2
|
+
|
3
|
+
module SupportingCast
|
4
|
+
module Generators
|
5
|
+
class RedisConfigGenerator < Rails::Generators::Base
|
6
|
+
include GeneratorHelpers
|
7
|
+
|
8
|
+
desc "Generate environment-specific redis.yml and redis conf files from template"
|
9
|
+
source_root File.join(File.dirname(__FILE__), 'templates')
|
10
|
+
|
11
|
+
attr_reader :env, :port
|
12
|
+
|
13
|
+
def default_port
|
14
|
+
6379
|
15
|
+
end
|
16
|
+
|
17
|
+
def mkdir_redis_conf
|
18
|
+
empty_directory "config/redis"
|
19
|
+
end
|
20
|
+
|
21
|
+
def development_redis_conf
|
22
|
+
@env = 'development'
|
23
|
+
@port = development_port
|
24
|
+
template 'redis.conf.erb', "config/redis/#{env}.conf"
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_redis_conf
|
28
|
+
@env = 'test'
|
29
|
+
@port = test_port
|
30
|
+
template 'redis.conf.erb', "config/redis/#{env}.conf"
|
31
|
+
end
|
32
|
+
|
33
|
+
def redis_yml
|
34
|
+
template 'redis.yml.erb', "config/redis.yml"
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'generators/supporting_cast/generator_helpers'
|
2
|
+
|
3
|
+
module SupportingCast
|
4
|
+
module Generators
|
5
|
+
class SidekiqConfigGenerator < Rails::Generators::Base
|
6
|
+
include GeneratorHelpers
|
7
|
+
|
8
|
+
desc "Generate sidekiq.yml file from template"
|
9
|
+
source_root File.join(File.dirname(__FILE__), 'templates')
|
10
|
+
|
11
|
+
def sidekiq_yml
|
12
|
+
template 'sidekiq.yml.erb', "config/sidekiq.yml"
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# openssl req -new -nodes -keyout server.key -out server.csr
|
2
|
+
|
3
|
+
require 'generators/supporting_cast/generator_helpers'
|
4
|
+
|
5
|
+
module SupportingCast
|
6
|
+
module Generators
|
7
|
+
class SslCertificateGenerator < Rails::Generators::Base
|
8
|
+
include GeneratorHelpers
|
9
|
+
|
10
|
+
desc "Generate ssl certificate files"
|
11
|
+
|
12
|
+
def openssl
|
13
|
+
inside('config/nginx') do
|
14
|
+
run('rm server.key server.csr server.crt')
|
15
|
+
|
16
|
+
# generate private key and certificate signing request
|
17
|
+
run('openssl req -new -nodes -keyout server.key -out server.csr')
|
18
|
+
|
19
|
+
# generate certificate
|
20
|
+
run('openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt')
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def own
|
25
|
+
inside('config/nginx') do
|
26
|
+
run('chmod 400 *.key *.crt')
|
27
|
+
run('sudo chown root *.key *.crt')
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'generators/supporting_cast/generator_helpers'
|
2
|
+
|
3
|
+
module SupportingCast
|
4
|
+
module Generators
|
5
|
+
class SunspotConfigGenerator < Rails::Generators::Base
|
6
|
+
include GeneratorHelpers
|
7
|
+
|
8
|
+
desc "Generate sunspot.yml and sunspot config files for development and test"
|
9
|
+
source_root File.join(File.dirname(__FILE__), 'templates')
|
10
|
+
|
11
|
+
attr_accessor :env, :port
|
12
|
+
|
13
|
+
def default_port
|
14
|
+
8988
|
15
|
+
end
|
16
|
+
|
17
|
+
def sunspot_yml
|
18
|
+
template 'sunspot.yml.erb', "config/sunspot.yml"
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# make sure processes run in the foreground
|
2
|
+
# thin: bundle exec thin start -p $PORT
|
3
|
+
# unicorn: nohup bundle exec unicorn -c config/unicorn/unicorn.rb
|
4
|
+
# nginx: sudo /usr/local/sbin/nginx -c <%= rails_root %>/config/nginx/nginx.conf -g "daemon off;"
|
5
|
+
# redis_dev: redis-server ./config/redis/development.conf
|
6
|
+
# redis_test: redis-server ./config/redis/test.conf
|
7
|
+
# guard: bundle exec guard
|
8
|
+
# solr: bundle exec rake sunspot:solr:run
|
9
|
+
# elastic_dev: elasticsearch -f -Des.config=./config/elasticsearch/development.yml
|
10
|
+
# elastic_test: elasticsearch -f -Des.config=./config/elasticsearch/test.yml
|
11
|
+
# resque: bundle exec rake resque:work QUEUE=*
|
12
|
+
# sidekiq: bundle exec sidekiq
|
13
|
+
|
14
|
+
# Optional but useful
|
15
|
+
|
16
|
+
# zeus: zeus start
|
17
|
+
# spork: bundle exec spork --port 9899
|
18
|
+
# spork_challenges: cd engines/challenges && bundle exec spork --port 9901
|
19
|
+
# spork_groups_cucumber: cd engines/groups && bundle exec spork cucumber --port 9902
|
20
|
+
# spork_groups_rspec: cd engines/groups && bundle exec spork rspec --port 9903
|
21
|
+
# evergreen: bundle exec evergreen serve
|
22
|
+
# redis-commander --port 8081 --redis-host localhost --redis-port 9464
|
23
|
+
# memcache: /usr/local/bin/memcached -l localhost
|
24
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= elasticsearch_options.to_yaml %>
|
@@ -0,0 +1,359 @@
|
|
1
|
+
##################### ElasticSearch Configuration Example #####################
|
2
|
+
|
3
|
+
# This file contains an overview of various configuration settings,
|
4
|
+
# targeted at operations staff. Application developers should
|
5
|
+
# consult the guide at <http://elasticsearch.org/guide>.
|
6
|
+
#
|
7
|
+
# The installation procedure is covered at
|
8
|
+
# <http://elasticsearch.org/guide/reference/setup/installation.html>.
|
9
|
+
#
|
10
|
+
# ElasticSearch comes with reasonable defaults for most settings,
|
11
|
+
# so you can try it out without bothering with configuration.
|
12
|
+
#
|
13
|
+
# Most of the time, these defaults are just fine for running a production
|
14
|
+
# cluster. If you're fine-tuning your cluster, or wondering about the
|
15
|
+
# effect of certain configuration option, please _do ask_ on the
|
16
|
+
# mailing list or IRC channel [http://elasticsearch.org/community].
|
17
|
+
|
18
|
+
# Any element in the configuration can be replaced with environment variables
|
19
|
+
# by placing them in ${...} notation. For example:
|
20
|
+
#
|
21
|
+
# node.rack: ${RACK_ENV_VAR}
|
22
|
+
|
23
|
+
# See <http://elasticsearch.org/guide/reference/setup/configuration.html>
|
24
|
+
# for information on supported formats and syntax for the configuration file.
|
25
|
+
|
26
|
+
|
27
|
+
################################### Cluster ###################################
|
28
|
+
|
29
|
+
# Cluster name identifies your cluster for auto-discovery. If you're running
|
30
|
+
# multiple clusters on the same network, make sure you're using unique names.
|
31
|
+
#
|
32
|
+
cluster.name: elasticsearch_<%= application_name %>_<%= env %>
|
33
|
+
|
34
|
+
#################################### Node #####################################
|
35
|
+
|
36
|
+
# Node names are generated dynamically on startup, so you're relieved
|
37
|
+
# from configuring them manually. You can tie this node to a specific name:
|
38
|
+
#
|
39
|
+
# node.name: "Franz Kafka"
|
40
|
+
|
41
|
+
# Every node can be configured to allow or deny being eligible as the master,
|
42
|
+
# and to allow or deny to store the data.
|
43
|
+
#
|
44
|
+
# Allow this node to be eligible as a master node (enabled by default):
|
45
|
+
#
|
46
|
+
# node.master: true
|
47
|
+
#
|
48
|
+
# Allow this node to store data (enabled by default):
|
49
|
+
#
|
50
|
+
# node.data: true
|
51
|
+
|
52
|
+
# You can exploit these settings to design advanced cluster topologies.
|
53
|
+
#
|
54
|
+
# 1. You want this node to never become a master node, only to hold data.
|
55
|
+
# This will be the "workhorse" of your cluster.
|
56
|
+
#
|
57
|
+
# node.master: false
|
58
|
+
# node.data: true
|
59
|
+
#
|
60
|
+
# 2. You want this node to only serve as a master: to not store any data and
|
61
|
+
# to have free resources. This will be the "coordinator" of your cluster.
|
62
|
+
#
|
63
|
+
# node.master: true
|
64
|
+
# node.data: false
|
65
|
+
#
|
66
|
+
# 3. You want this node to be neither master nor data node, but
|
67
|
+
# to act as a "search load balancer" (fetching data from nodes,
|
68
|
+
# aggregating results, etc.)
|
69
|
+
#
|
70
|
+
# node.master: false
|
71
|
+
# node.data: false
|
72
|
+
|
73
|
+
# Use the Cluster Health API [http://localhost:9200/_cluster/health], the
|
74
|
+
# Node Info API [http://localhost:9200/_cluster/nodes] or GUI tools
|
75
|
+
# such as <http://github.com/lukas-vlcek/bigdesk> and
|
76
|
+
# <http://mobz.github.com/elasticsearch-head> to inspect the cluster state.
|
77
|
+
|
78
|
+
# A node can have generic attributes associated with it, which can later be used
|
79
|
+
# for customized shard allocation filtering, or allocation awareness. An attribute
|
80
|
+
# is a simple key value pair, similar to node.key: value, here is an example:
|
81
|
+
#
|
82
|
+
# node.rack: rack314
|
83
|
+
|
84
|
+
# By default, multiple nodes are allowed to start from the same installation location
|
85
|
+
# to disable it, set the following:
|
86
|
+
# node.max_local_storage_nodes: 1
|
87
|
+
|
88
|
+
|
89
|
+
#################################### Index ####################################
|
90
|
+
|
91
|
+
# You can set a number of options (such as shard/replica options, mapping
|
92
|
+
# or analyzer definitions, translog settings, ...) for indices globally,
|
93
|
+
# in this file.
|
94
|
+
#
|
95
|
+
# Note, that it makes more sense to configure index settings specifically for
|
96
|
+
# a certain index, either when creating it or by using the index templates API.
|
97
|
+
#
|
98
|
+
# See <http://elasticsearch.org/guide/reference/index-modules/> and
|
99
|
+
# <http://elasticsearch.org/guide/reference/api/admin-indices-create-index.html>
|
100
|
+
# for more information.
|
101
|
+
|
102
|
+
# Set the number of shards (splits) of an index (5 by default):
|
103
|
+
#
|
104
|
+
# index.number_of_shards: 5
|
105
|
+
|
106
|
+
# Set the number of replicas (additional copies) of an index (1 by default):
|
107
|
+
#
|
108
|
+
# index.number_of_replicas: 1
|
109
|
+
|
110
|
+
# Note, that for development on a local machine, with small indices, it usually
|
111
|
+
# makes sense to "disable" the distributed features:
|
112
|
+
#
|
113
|
+
# index.number_of_shards: 1
|
114
|
+
# index.number_of_replicas: 0
|
115
|
+
|
116
|
+
# These settings directly affect the performance of index and search operations
|
117
|
+
# in your cluster. Assuming you have enough machines to hold shards and
|
118
|
+
# replicas, the rule of thumb is:
|
119
|
+
#
|
120
|
+
# 1. Having more *shards* enhances the _indexing_ performance and allows to
|
121
|
+
# _distribute_ a big index across machines.
|
122
|
+
# 2. Having more *replicas* enhances the _search_ performance and improves the
|
123
|
+
# cluster _availability_.
|
124
|
+
#
|
125
|
+
# The "number_of_shards" is a one-time setting for an index.
|
126
|
+
#
|
127
|
+
# The "number_of_replicas" can be increased or decreased anytime,
|
128
|
+
# by using the Index Update Settings API.
|
129
|
+
#
|
130
|
+
# ElasticSearch takes care about load balancing, relocating, gathering the
|
131
|
+
# results from nodes, etc. Experiment with different settings to fine-tune
|
132
|
+
# your setup.
|
133
|
+
|
134
|
+
# Use the Index Status API (<http://localhost:9200/A/_status>) to inspect
|
135
|
+
# the index status.
|
136
|
+
|
137
|
+
|
138
|
+
#################################### Paths ####################################
|
139
|
+
|
140
|
+
# Path to directory containing configuration (this file and logging.yml):
|
141
|
+
#
|
142
|
+
# path.conf: /path/to/conf
|
143
|
+
|
144
|
+
# Path to directory where to store index data allocated for this node.
|
145
|
+
#
|
146
|
+
path.data: /usr/local/var/elasticsearch/
|
147
|
+
#
|
148
|
+
# Can optionally include more than one location, causing data to be striped across
|
149
|
+
# the locations (à la RAID 0) on a file level, favouring locations with most free
|
150
|
+
# space on creation. For example:
|
151
|
+
#
|
152
|
+
path.data: /usr/local/var/elasticsearch/
|
153
|
+
|
154
|
+
# Path to temporary files:
|
155
|
+
#
|
156
|
+
# path.work: /path/to/work
|
157
|
+
|
158
|
+
# Path to log files:
|
159
|
+
#
|
160
|
+
path.logs: /usr/local/var/log/elasticsearch/
|
161
|
+
|
162
|
+
# Path to where plugins are installed:
|
163
|
+
#
|
164
|
+
# path.plugins: /path/to/plugins
|
165
|
+
|
166
|
+
|
167
|
+
#################################### Plugin ###################################
|
168
|
+
|
169
|
+
# If a plugin listed here is not installed for current node, the node will not start.
|
170
|
+
#
|
171
|
+
# plugin.mandatory: mapper-attachments,lang-groovy
|
172
|
+
|
173
|
+
|
174
|
+
################################### Memory ####################################
|
175
|
+
|
176
|
+
# ElasticSearch performs poorly when JVM starts swapping: you should ensure that
|
177
|
+
# it _never_ swaps.
|
178
|
+
#
|
179
|
+
# Set this property to true to lock the memory:
|
180
|
+
#
|
181
|
+
# bootstrap.mlockall: true
|
182
|
+
|
183
|
+
# Make sure that the ES_MIN_MEM and ES_MAX_MEM environment variables are set
|
184
|
+
# to the same value, and that the machine has enough memory to allocate
|
185
|
+
# for ElasticSearch, leaving enough memory for the operating system itself.
|
186
|
+
#
|
187
|
+
# You should also make sure that the ElasticSearch process is allowed to lock
|
188
|
+
# the memory, eg. by using `ulimit -l unlimited`.
|
189
|
+
|
190
|
+
|
191
|
+
############################## Network And HTTP ###############################
|
192
|
+
|
193
|
+
# ElasticSearch, by default, binds itself to the 0.0.0.0 address, and listens
|
194
|
+
# on port [9200-9300] for HTTP traffic and on port [9300-9400] for node-to-node
|
195
|
+
# communication. (the range means that if the port is busy, it will automatically
|
196
|
+
# try the next port).
|
197
|
+
|
198
|
+
# Set the bind address specifically (IPv4 or IPv6):
|
199
|
+
#
|
200
|
+
# network.bind_host: 192.168.0.1
|
201
|
+
|
202
|
+
# Set the address other nodes will use to communicate with this node. If not
|
203
|
+
# set, it is automatically derived. It must point to an actual IP address.
|
204
|
+
#
|
205
|
+
# network.publish_host: 192.168.0.1
|
206
|
+
|
207
|
+
# Set both 'bind_host' and 'publish_host':
|
208
|
+
#
|
209
|
+
network.host: localhost
|
210
|
+
|
211
|
+
# Set a custom port for the node to node communication (9300 by default):
|
212
|
+
#
|
213
|
+
# transport.tcp.port: 9300
|
214
|
+
|
215
|
+
# Enable compression for all communication between nodes (disabled by default):
|
216
|
+
#
|
217
|
+
# transport.tcp.compress: true
|
218
|
+
|
219
|
+
# Set a custom port to listen for HTTP traffic:
|
220
|
+
#
|
221
|
+
http.port: <%= port %>
|
222
|
+
|
223
|
+
# Set a custom allowed content length:
|
224
|
+
#
|
225
|
+
# http.max_content_length: 100mb
|
226
|
+
|
227
|
+
# Disable HTTP completely:
|
228
|
+
#
|
229
|
+
# http.enabled: false
|
230
|
+
|
231
|
+
|
232
|
+
################################### Gateway ###################################
|
233
|
+
|
234
|
+
# The gateway allows for persisting the cluster state between full cluster
|
235
|
+
# restarts. Every change to the state (such as adding an index) will be stored
|
236
|
+
# in the gateway, and when the cluster starts up for the first time,
|
237
|
+
# it will read its state from the gateway.
|
238
|
+
|
239
|
+
# There are several types of gateway implementations. For more information,
|
240
|
+
# see <http://elasticsearch.org/guide/reference/modules/gateway>.
|
241
|
+
|
242
|
+
# The default gateway type is the "local" gateway (recommended):
|
243
|
+
#
|
244
|
+
# gateway.type: local
|
245
|
+
|
246
|
+
# Settings below control how and when to start the initial recovery process on
|
247
|
+
# a full cluster restart (to reuse as much local data as possible when using shared
|
248
|
+
# gateway).
|
249
|
+
|
250
|
+
# Allow recovery process after N nodes in a cluster are up:
|
251
|
+
#
|
252
|
+
# gateway.recover_after_nodes: 1
|
253
|
+
|
254
|
+
# Set the timeout to initiate the recovery process, once the N nodes
|
255
|
+
# from previous setting are up (accepts time value):
|
256
|
+
#
|
257
|
+
# gateway.recover_after_time: 5m
|
258
|
+
|
259
|
+
# Set how many nodes are expected in this cluster. Once these N nodes
|
260
|
+
# are up (and recover_after_nodes is met), begin recovery process immediately
|
261
|
+
# (without waiting for recover_after_time to expire):
|
262
|
+
#
|
263
|
+
# gateway.expected_nodes: 2
|
264
|
+
|
265
|
+
|
266
|
+
############################# Recovery Throttling #############################
|
267
|
+
|
268
|
+
# These settings allow to control the process of shards allocation between
|
269
|
+
# nodes during initial recovery, replica allocation, rebalancing,
|
270
|
+
# or when adding and removing nodes.
|
271
|
+
|
272
|
+
# Set the number of concurrent recoveries happening on a node:
|
273
|
+
#
|
274
|
+
# 1. During the initial recovery
|
275
|
+
#
|
276
|
+
# cluster.routing.allocation.node_initial_primaries_recoveries: 4
|
277
|
+
#
|
278
|
+
# 2. During adding/removing nodes, rebalancing, etc
|
279
|
+
#
|
280
|
+
# cluster.routing.allocation.node_concurrent_recoveries: 2
|
281
|
+
|
282
|
+
# Set to throttle throughput when recovering (eg. 100mb, by default unlimited):
|
283
|
+
#
|
284
|
+
# indices.recovery.max_size_per_sec: 0
|
285
|
+
|
286
|
+
# Set to limit the number of open concurrent streams when
|
287
|
+
# recovering a shard from a peer:
|
288
|
+
#
|
289
|
+
# indices.recovery.concurrent_streams: 5
|
290
|
+
|
291
|
+
|
292
|
+
################################## Discovery ##################################
|
293
|
+
|
294
|
+
# Discovery infrastructure ensures nodes can be found within a cluster
|
295
|
+
# and master node is elected. Multicast discovery is the default.
|
296
|
+
|
297
|
+
# Set to ensure a node sees N other master eligible nodes to be considered
|
298
|
+
# operational within the cluster. Set this option to a higher value (2-4)
|
299
|
+
# for large clusters (>3 nodes):
|
300
|
+
#
|
301
|
+
# discovery.zen.minimum_master_nodes: 1
|
302
|
+
|
303
|
+
# Set the time to wait for ping responses from other nodes when discovering.
|
304
|
+
# Set this option to a higher value on a slow or congested network
|
305
|
+
# to minimize discovery failures:
|
306
|
+
#
|
307
|
+
# discovery.zen.ping.timeout: 3s
|
308
|
+
|
309
|
+
# See <http://elasticsearch.org/guide/reference/modules/discovery/zen.html>
|
310
|
+
# for more information.
|
311
|
+
|
312
|
+
# Unicast discovery allows to explicitly control which nodes will be used
|
313
|
+
# to discover the cluster. It can be used when multicast is not present,
|
314
|
+
# or to restrict the cluster communication-wise.
|
315
|
+
#
|
316
|
+
# 1. Disable multicast discovery (enabled by default):
|
317
|
+
#
|
318
|
+
# discovery.zen.ping.multicast.enabled: false
|
319
|
+
#
|
320
|
+
# 2. Configure an initial list of master nodes in the cluster
|
321
|
+
# to perform discovery when new nodes (master or data) are started:
|
322
|
+
#
|
323
|
+
# discovery.zen.ping.unicast.hosts: ["host1", "host2:port", "host3[portX-portY]"]
|
324
|
+
|
325
|
+
# EC2 discovery allows to use AWS EC2 API in order to perform discovery.
|
326
|
+
#
|
327
|
+
# You have to install the cloud-aws plugin for enabling the EC2 discovery.
|
328
|
+
#
|
329
|
+
# See <http://elasticsearch.org/guide/reference/modules/discovery/ec2.html>
|
330
|
+
# for more information.
|
331
|
+
#
|
332
|
+
# See <http://elasticsearch.org/tutorials/2011/08/22/elasticsearch-on-ec2.html>
|
333
|
+
# for a step-by-step tutorial.
|
334
|
+
|
335
|
+
|
336
|
+
################################## Slow Log ##################################
|
337
|
+
|
338
|
+
# Shard level query and fetch threshold logging.
|
339
|
+
|
340
|
+
#index.search.slowlog.level: TRACE
|
341
|
+
#index.search.slowlog.threshold.query.warn: 10s
|
342
|
+
#index.search.slowlog.threshold.query.info: 5s
|
343
|
+
#index.search.slowlog.threshold.query.debug: 2s
|
344
|
+
#index.search.slowlog.threshold.query.trace: 500ms
|
345
|
+
|
346
|
+
#index.search.slowlog.threshold.fetch.warn: 1s
|
347
|
+
#index.search.slowlog.threshold.fetch.info: 800ms
|
348
|
+
#index.search.slowlog.threshold.fetch.debug: 500ms
|
349
|
+
#index.search.slowlog.threshold.fetch.trace: 200ms
|
350
|
+
|
351
|
+
################################## GC Logging ################################
|
352
|
+
|
353
|
+
#monitor.jvm.gc.ParNew.warn: 1000ms
|
354
|
+
#monitor.jvm.gc.ParNew.info: 700ms
|
355
|
+
#monitor.jvm.gc.ParNew.debug: 400ms
|
356
|
+
|
357
|
+
#monitor.jvm.gc.ConcurrentMarkSweep.warn: 10s
|
358
|
+
#monitor.jvm.gc.ConcurrentMarkSweep.info: 5s
|
359
|
+
#monitor.jvm.gc.ConcurrentMarkSweep.debug: 2s
|
@@ -0,0 +1,129 @@
|
|
1
|
+
user nobody;
|
2
|
+
worker_processes 2;
|
3
|
+
pid /var/run/nginx.pid;
|
4
|
+
|
5
|
+
error_log <%= rails_root %>/log/nginx.error.log info;
|
6
|
+
|
7
|
+
events {
|
8
|
+
worker_connections 256;
|
9
|
+
}
|
10
|
+
|
11
|
+
http {
|
12
|
+
default_type application/octet-stream;
|
13
|
+
|
14
|
+
log_format main '$remote_addr - $remote_user [$time_local] '
|
15
|
+
'"$request" $status $body_bytes_sent "$http_referer" '
|
16
|
+
'"$http_user_agent" "$http_x_forwarded_for"';
|
17
|
+
|
18
|
+
access_log <%= rails_root %>/log/nginx.access.log main;
|
19
|
+
|
20
|
+
sendfile on;
|
21
|
+
|
22
|
+
keepalive_timeout 65;
|
23
|
+
|
24
|
+
upstream <%= application_name %>_upstream {
|
25
|
+
server 0.0.0.0:5000;
|
26
|
+
}
|
27
|
+
|
28
|
+
upstream <%= application_name %>_upstream_ssl {
|
29
|
+
server 0.0.0.0:5000;
|
30
|
+
}
|
31
|
+
|
32
|
+
server {
|
33
|
+
listen 80;
|
34
|
+
server_name *.dev;
|
35
|
+
|
36
|
+
root <%= rails_root %>/public;
|
37
|
+
|
38
|
+
access_log <%= rails_root %>/log/<%= application_name %>.access.log main;
|
39
|
+
error_log <%= rails_root %>/log/<%= application_name %>.error.log notice;
|
40
|
+
|
41
|
+
# needed to forward user's IP address to rails
|
42
|
+
proxy_set_header X-Real-IP $remote_addr;
|
43
|
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
44
|
+
proxy_set_header Host $http_host;
|
45
|
+
proxy_set_header X-Forwarded-Proto $scheme;
|
46
|
+
|
47
|
+
proxy_redirect off;
|
48
|
+
proxy_max_temp_file_size 0;
|
49
|
+
|
50
|
+
if (-f $request_filename) {
|
51
|
+
break;
|
52
|
+
}
|
53
|
+
|
54
|
+
location / {
|
55
|
+
client_max_body_size 5M;
|
56
|
+
if (!-f $request_filename) {
|
57
|
+
proxy_pass http://<%= application_name %>_upstream;
|
58
|
+
break;
|
59
|
+
}
|
60
|
+
}
|
61
|
+
|
62
|
+
location ~* \.(eot|ttf|woff|svg)$ {
|
63
|
+
add_header Access-Control-Allow-Origin *;
|
64
|
+
if (!-f $request_filename) {
|
65
|
+
proxy_pass http://<%= application_name %>_upstream;
|
66
|
+
break;
|
67
|
+
}
|
68
|
+
}
|
69
|
+
|
70
|
+
error_page 500 502 503 504 /50x.html;
|
71
|
+
location = /50x.html {
|
72
|
+
root html;
|
73
|
+
}
|
74
|
+
}
|
75
|
+
|
76
|
+
server {
|
77
|
+
listen 443;
|
78
|
+
server_name *.dev;
|
79
|
+
|
80
|
+
ssl on;
|
81
|
+
ssl_certificate server.crt;
|
82
|
+
ssl_certificate_key server.key;
|
83
|
+
|
84
|
+
ssl_session_timeout 5m;
|
85
|
+
|
86
|
+
ssl_protocols SSLv2 SSLv3 TLSv1;
|
87
|
+
ssl_ciphers HIGH:!aNULL:!MD5;
|
88
|
+
ssl_prefer_server_ciphers on;
|
89
|
+
|
90
|
+
root <%= rails_root %>/public;
|
91
|
+
|
92
|
+
access_log <%= rails_root %>/log/<%= application_name %>.access.log main;
|
93
|
+
error_log <%= rails_root %>/log/<%= application_name %>.error.log notice;
|
94
|
+
|
95
|
+
# needed to forward user's IP address to rails
|
96
|
+
proxy_set_header X-Real-IP $remote_addr;
|
97
|
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
98
|
+
proxy_set_header Host $http_host;
|
99
|
+
proxy_set_header X-Forwarded-Proto $scheme;
|
100
|
+
|
101
|
+
proxy_redirect off;
|
102
|
+
proxy_max_temp_file_size 0;
|
103
|
+
|
104
|
+
if (-f $request_filename) {
|
105
|
+
break;
|
106
|
+
}
|
107
|
+
|
108
|
+
location / {
|
109
|
+
client_max_body_size 5M;
|
110
|
+
if (!-f $request_filename) {
|
111
|
+
proxy_pass http://<%= application_name %>_upstream_ssl;
|
112
|
+
break;
|
113
|
+
}
|
114
|
+
}
|
115
|
+
|
116
|
+
location ~* \.(eot|ttf|woff|svg)$ {
|
117
|
+
add_header Access-Control-Allow-Origin *;
|
118
|
+
if (!-f $request_filename) {
|
119
|
+
proxy_pass http://<%= application_name %>_upstream_ssl;
|
120
|
+
break;
|
121
|
+
}
|
122
|
+
}
|
123
|
+
|
124
|
+
error_page 500 502 503 504 /50x.html;
|
125
|
+
location = /50x.html {
|
126
|
+
root html;
|
127
|
+
}
|
128
|
+
}
|
129
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# Redis configuration
|
2
|
+
daemonize no
|
3
|
+
pidfile ./tmp/pids/redis_<%= env %>.pid
|
4
|
+
port <%= port %>
|
5
|
+
timeout 300
|
6
|
+
save 900 1
|
7
|
+
save 300 10
|
8
|
+
save 60 10000
|
9
|
+
dbfilename ./db/<%= env %>.rdb
|
10
|
+
loglevel debug
|
11
|
+
logfile ./log/redis_<%= env %>.log
|
12
|
+
databases 1
|
13
|
+
glueoutputbuf yes
|
@@ -0,0 +1,55 @@
|
|
1
|
+
working_directory '<%= rails_root %>'
|
2
|
+
worker_processes 1
|
3
|
+
listen '<%= rails_root %>/unicorn_<%= application_name %>.sock', :backlog => 1024
|
4
|
+
timeout 15
|
5
|
+
pid "<%= rails_root %>/log/unicorn_<%= application_name %>.pid"
|
6
|
+
|
7
|
+
# Based on http://gist.github.com/206253
|
8
|
+
|
9
|
+
logger Logger.new("log/unicorn.log")
|
10
|
+
|
11
|
+
# Load the app into the master before forking workers for super-fast worker spawn times
|
12
|
+
preload_app true
|
13
|
+
|
14
|
+
# some applications/frameworks log to stderr or stdout, so prevent
|
15
|
+
# them from going to /dev/null when daemonized here:
|
16
|
+
stderr_path "log/unicorn.stderr.log"
|
17
|
+
stdout_path "log/unicorn.stdout.log"
|
18
|
+
|
19
|
+
# REE - http://www.rubyenterpriseedition.com/faq.html#adapt_apps_for_cow
|
20
|
+
if GC.respond_to?(:copy_on_write_friendly=)
|
21
|
+
GC.copy_on_write_friendly = true
|
22
|
+
end
|
23
|
+
|
24
|
+
before_fork do |server, worker|
|
25
|
+
|
26
|
+
##
|
27
|
+
# When sent a USR2, Unicorn will suffix its pidfile with .oldbin and
|
28
|
+
# immediately start loading up a new version of itself (loaded with a new
|
29
|
+
# version of our app). When this new Unicorn is completely loaded
|
30
|
+
# it will begin spawning workers. The first worker spawned will check to
|
31
|
+
# see if an .oldbin pidfile exists. If so, this means we've just booted up
|
32
|
+
# a new Unicorn and need to tell the old one that it can now die. To do so
|
33
|
+
# we send it a QUIT.
|
34
|
+
#
|
35
|
+
# Using this method we get 0 downtime deploys.
|
36
|
+
old_pid = "#{server.config[:pid]}.oldbin"
|
37
|
+
|
38
|
+
if File.exists?(old_pid) && server.pid != old_pid
|
39
|
+
begin
|
40
|
+
sig = (worker.nr + 1) >= server.worker_processes ? :TERM : :TTOU
|
41
|
+
Process.kill(sig, File.read(old_pid).to_i)
|
42
|
+
rescue Errno::ENOENT, Errno::ESRCH
|
43
|
+
# someone else did our job for us
|
44
|
+
end
|
45
|
+
end
|
46
|
+
sleep 1
|
47
|
+
end
|
48
|
+
|
49
|
+
after_fork do |server, worker|
|
50
|
+
worker_pid = File.join(File.dirname(server.config[:pid]), "unicorn_worker_<%= application_name %>_#{worker.nr}.pid")
|
51
|
+
File.open(worker_pid, "w") { |f| f.puts Process.pid }
|
52
|
+
if defined?(ActiveRecord::Base)
|
53
|
+
ActiveRecord::Base.establish_connection
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'generators/supporting_cast/generator_helpers'
|
2
|
+
|
3
|
+
module SupportingCast
|
4
|
+
module Generators
|
5
|
+
class UnicornConfigGenerator < Rails::Generators::Base
|
6
|
+
include GeneratorHelpers
|
7
|
+
source_root File.join(File.dirname(__FILE__), 'templates')
|
8
|
+
|
9
|
+
desc 'Generate unicorn configuration for development'
|
10
|
+
|
11
|
+
def mkdir_unicorn_conf
|
12
|
+
empty_directory 'config/unicorn'
|
13
|
+
end
|
14
|
+
|
15
|
+
def nginx_conf
|
16
|
+
template 'unicorn.rb.erb', 'config/unicorn/unicorn.rb'
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
namespace :supporting_cast do
|
2
|
+
|
3
|
+
task :require do
|
4
|
+
require 'rails/generators'
|
5
|
+
end
|
6
|
+
|
7
|
+
desc "Generate redis.yml and redis config files for development and test"
|
8
|
+
task :redis => :require do
|
9
|
+
Rails::Generators.invoke "supporting_cast:redis_config"
|
10
|
+
end
|
11
|
+
|
12
|
+
desc "Generate database.yml for development and test"
|
13
|
+
task :database => :require do
|
14
|
+
Rails::Generators.invoke "supporting_cast:database_config"
|
15
|
+
end
|
16
|
+
|
17
|
+
desc "Generate elasticsearch.yml and elasticsearch config files for development and test"
|
18
|
+
task :elasticsearch => :require do
|
19
|
+
Rails::Generators.invoke "supporting_cast:elasticsearch_config"
|
20
|
+
end
|
21
|
+
|
22
|
+
desc "Generate sunspot.yml and sunspot config files for development and test"
|
23
|
+
task :sunspot => :require do
|
24
|
+
Rails::Generators.invoke "supporting_cast:sunspot_config"
|
25
|
+
end
|
26
|
+
|
27
|
+
desc "Generate a Procfile for use with foreman"
|
28
|
+
task :foreman => :require do
|
29
|
+
Rails::Generators.invoke "supporting_cast:foreman_config"
|
30
|
+
end
|
31
|
+
|
32
|
+
desc "Generate nginx configuration for development"
|
33
|
+
task :nginx => :require do
|
34
|
+
Rails::Generators.invoke "supporting_cast:nginx_config"
|
35
|
+
end
|
36
|
+
|
37
|
+
desc "Generate unicorn configuration for development"
|
38
|
+
task :unicorn => :require do
|
39
|
+
Rails::Generators.invoke "supporting_cast:unicorn_config"
|
40
|
+
end
|
41
|
+
|
42
|
+
desc "Generate sidekiq configuration for development"
|
43
|
+
task :sidekiq => :require do
|
44
|
+
Rails::Generators.invoke "supporting_cast:sidekiq_config"
|
45
|
+
end
|
46
|
+
|
47
|
+
task :default => :require do
|
48
|
+
Rails::Generators.invoke "supporting_cast:config"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
desc "Bootstrap all supporting_cast configuration files"
|
53
|
+
task :supporting_cast => "supporting_cast:default"
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'supporting_cast/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "supporting_cast"
|
8
|
+
gem.version = SupportingCast::VERSION
|
9
|
+
gem.authors = ["Ross Kaffenberger"]
|
10
|
+
gem.email = ["rosskaff@gmail.com"]
|
11
|
+
gem.description = "Opinionated generators for common Rails supporting cast services, or 'supporting_casts'"
|
12
|
+
gem.summary = "Opinionated generators for common Rails supporting cast services, or 'supporting_casts'"
|
13
|
+
gem.homepage = ""
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
end
|
metadata
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: supporting_cast
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Ross Kaffenberger
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-12-16 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: Opinionated generators for common Rails supporting cast services, or
|
15
|
+
'supporting_casts'
|
16
|
+
email:
|
17
|
+
- rosskaff@gmail.com
|
18
|
+
executables: []
|
19
|
+
extensions: []
|
20
|
+
extra_rdoc_files: []
|
21
|
+
files:
|
22
|
+
- .gitignore
|
23
|
+
- Gemfile
|
24
|
+
- LICENSE.txt
|
25
|
+
- README.md
|
26
|
+
- Rakefile
|
27
|
+
- lib/generators/supporting_cast/config_generator.rb
|
28
|
+
- lib/generators/supporting_cast/database_config_generator.rb
|
29
|
+
- lib/generators/supporting_cast/elasticsearch_config_generator.rb
|
30
|
+
- lib/generators/supporting_cast/foreman_config_generator.rb
|
31
|
+
- lib/generators/supporting_cast/generator_helpers.rb
|
32
|
+
- lib/generators/supporting_cast/nginx_config_generator.rb
|
33
|
+
- lib/generators/supporting_cast/redis_config_generator.rb
|
34
|
+
- lib/generators/supporting_cast/sidekiq_config_generator.rb
|
35
|
+
- lib/generators/supporting_cast/ssl_certificate_generator.rb
|
36
|
+
- lib/generators/supporting_cast/sunspot_config_generator.rb
|
37
|
+
- lib/generators/supporting_cast/templates/Procfile.erb
|
38
|
+
- lib/generators/supporting_cast/templates/database.yml.erb
|
39
|
+
- lib/generators/supporting_cast/templates/elasticsearch.yml.erb
|
40
|
+
- lib/generators/supporting_cast/templates/elasticsearch_config.yml.erb
|
41
|
+
- lib/generators/supporting_cast/templates/nginx.conf.erb
|
42
|
+
- lib/generators/supporting_cast/templates/redis.conf.erb
|
43
|
+
- lib/generators/supporting_cast/templates/redis.yml.erb
|
44
|
+
- lib/generators/supporting_cast/templates/sidekiq.yml.erb
|
45
|
+
- lib/generators/supporting_cast/templates/sunspot.yml.erb
|
46
|
+
- lib/generators/supporting_cast/templates/unicorn.rb.erb
|
47
|
+
- lib/generators/supporting_cast/unicorn_config_generator.rb
|
48
|
+
- lib/supporting_cast.rb
|
49
|
+
- lib/supporting_cast/railtie.rb
|
50
|
+
- lib/supporting_cast/version.rb
|
51
|
+
- lib/tasks/supporting_cast.rake
|
52
|
+
- supporting_cast.gemspec
|
53
|
+
homepage: ''
|
54
|
+
licenses: []
|
55
|
+
post_install_message:
|
56
|
+
rdoc_options: []
|
57
|
+
require_paths:
|
58
|
+
- lib
|
59
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
60
|
+
none: false
|
61
|
+
requirements:
|
62
|
+
- - ! '>='
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '0'
|
65
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
66
|
+
none: false
|
67
|
+
requirements:
|
68
|
+
- - ! '>='
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
requirements: []
|
72
|
+
rubyforge_project:
|
73
|
+
rubygems_version: 1.8.10
|
74
|
+
signing_key:
|
75
|
+
specification_version: 3
|
76
|
+
summary: Opinionated generators for common Rails supporting cast services, or 'supporting_casts'
|
77
|
+
test_files: []
|
78
|
+
has_rdoc:
|