capistrano-solr 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: da7deafaae3e6a5fe143ba9288ec227ab2fc6fc5
4
+ data.tar.gz: 83133851f6e493b3dc43660cc15a074e5a308b33
5
+ SHA512:
6
+ metadata.gz: df109973fbda465c6e23e277826b5a04b669975b79f0ba984b13653dc06b3af4628d98f7c46bd0a17009dd635cbb90a531a22cc1c710db7d12914703943ad843
7
+ data.tar.gz: d8defe2a5a0ccdc31fbaf82f00143d1be3e641d8b76699c0ff2e0849d3b9fa317f66450ef2d21c0f2a8e0b946fe10245007c666adbefdbafd045a7b8ed7a41db
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/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
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.6
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in capistrano-solr.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # Capistrano::Solr
2
+
3
+ ## Installation
4
+
5
+ Add this line to your application's Gemfile:
6
+
7
+ ```ruby
8
+ gem 'capistrano-solr'
9
+ ```
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install capistrano-solr
18
+
19
+ ## Usage
20
+
21
+ See the example https://github.com/rainkinz/capistrano-solr-example project
22
+ which contains a fully working version that can be deployed to a local Vagrant
23
+ instance.
24
+
25
+ ## Development
26
+
27
+ After checking out the repo, run `bin/setup` to install dependencies. Then,
28
+ run `rake spec` to run the tests. You can also run `bin/console` for an
29
+ interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To
32
+ release a new version, update the version number in `version.rb`, and then run
33
+ `bundle exec rake release`, which will create a git tag for the version,
34
+ push git commits and tags, and push the `.gem` file to
35
+ [rubygems.org](https://rubygems.org).
36
+
37
+ ## Contributing
38
+
39
+ Bug reports and pull requests are welcome on GitHub at
40
+ https://github.com/rainkinz/capistrano-solr.
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 "capistrano/solr"
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,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,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'capistrano/solr/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "capistrano-solr"
8
+ spec.version = Capistrano::Solr::VERSION
9
+ spec.authors = ["rainkinz"]
10
+ spec.email = ["brendan.grainger@gmail.com"]
11
+
12
+ spec.summary = %q{Capistrano deployment tasks for Solr}
13
+ spec.description = %q{Capistrano deployment tasks for Solr}
14
+ spec.homepage = "https://github.com/rainkinz/capistrano-solr"
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_dependency "capistrano", ">= 3.0"
22
+ spec.add_dependency "tilt", "~> 2.0.2"
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.10"
25
+ spec.add_development_dependency "rake", "~> 10.0"
26
+ spec.add_development_dependency "rspec"
27
+ spec.add_development_dependency "pry"
28
+ end
@@ -0,0 +1,115 @@
1
+ require 'pry'
2
+ require 'erb'
3
+ require 'tilt'
4
+
5
+ module Capistrano
6
+
7
+ module DSL
8
+
9
+ module SolrPaths
10
+
11
+ # Name of the directory on the nodes where we install our components,
12
+ # relative to the deploy user directory
13
+ def install_base_name
14
+ 'solr'
15
+ end
16
+
17
+ def install_home
18
+ # File.join(user_home, install_base_name)
19
+ "/opt/#{install_base_name}"
20
+ end
21
+
22
+ def user_home
23
+ File.join("/home", fetch(:user))
24
+ end
25
+
26
+ def solr_user
27
+ fetch(:user)
28
+ end
29
+
30
+ # The path to download the solr distribution to
31
+ def download_dir
32
+ fetch(:solr_download_path, default_download_dir)
33
+ end
34
+
35
+ def default_download_dir
36
+ File.join(user_home, "solr_downloads")
37
+ end
38
+
39
+ ##
40
+ # Java
41
+ #
42
+ def java_install_script_path
43
+ File.join(download_dir, 'java_install.sh')
44
+ end
45
+
46
+ ##
47
+ # Solr Components
48
+ #
49
+
50
+ def solr_url
51
+ 'http://www.mirrorservice.org/sites/ftp.apache.org/lucene/solr/5.4.0/solr-5.4.0.tgz'
52
+ end
53
+
54
+ def solr_path
55
+ File.join(download_dir, File.basename(solr_url))
56
+ end
57
+
58
+ def solr_tgz
59
+ File.join(download_dir, File.basename(solr_url))
60
+ end
61
+
62
+ def solr_install_dir
63
+ File.join(install_home, File.basename(solr_tgz, '.tgz'))
64
+ end
65
+
66
+ def solr_service_name
67
+ fetch(:solr_service_name, "cap-solr")
68
+ end
69
+
70
+ def solr_service_script
71
+ File.join("/etc/init.d", solr_service_name)
72
+ end
73
+
74
+ ##
75
+ # Zookeeper Components
76
+ #
77
+
78
+ def zookeeper_url
79
+ 'http://www.mirrorservice.org/sites/ftp.apache.org/zookeeper/zookeeper-3.4.7/zookeeper-3.4.7.tar.gz'
80
+ end
81
+
82
+ def zookeeper_tgz
83
+ File.join(download_dir, File.basename(zookeeper_url))
84
+ end
85
+
86
+ def zookeeper_install_dir
87
+ File.join(install_home, File.basename(zookeeper_tgz, '.tar.gz'))
88
+ end
89
+
90
+ def zookeeper_hosts
91
+ roles(fetch(:zookeeper_roles)).map(&:hostname)
92
+ end
93
+
94
+ def zookeeper_service_name
95
+ fetch(:zookeeper_service_name, "cap-zookeeper")
96
+ end
97
+
98
+ ##
99
+ # Utilities
100
+ #
101
+
102
+ def template(name)
103
+ File.join(Capistrano::Solr.templates_dir, name)
104
+ end
105
+
106
+ def upload_template(template_path, remote_path, opts = {})
107
+ template = Tilt.new(template_path)
108
+ io = StringIO.new(template.render(nil, opts))
109
+ upload! io, remote_path
110
+ end
111
+
112
+ end
113
+
114
+ end
115
+ end
@@ -0,0 +1,14 @@
1
+ require "capistrano/solr/version"
2
+ load File.expand_path("../tasks/solr.rake", __FILE__)
3
+
4
+ module Capistrano
5
+ module Solr
6
+ def self.gem_root
7
+ File.expand_path("../../../", __FILE__)
8
+ end
9
+
10
+ def self.templates_dir
11
+ File.join(gem_root, "templates")
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,5 @@
1
+ module Capistrano
2
+ module Solr
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,266 @@
1
+ require 'capistrano/dsl/solr_paths'
2
+
3
+ include Capistrano::DSL::SolrPaths
4
+
5
+ namespace :load do
6
+ task :defaults do
7
+ puts "Loading defaults"
8
+ end
9
+ end
10
+
11
+ # By default only deploy to servers with the solr role
12
+ set :solr_roles, :solr
13
+ set :zookeeper_roles, :zookeeper
14
+ set :solr_num_shards, 2
15
+
16
+ namespace :solr do
17
+
18
+ task :setup_sudoers do
19
+ end
20
+
21
+ task :prepare_download_dir do
22
+ on roles(fetch(:solr_roles)) do |host|
23
+ if test "[ -d #{download_dir} ]"
24
+ info "#{download_dir} already exist"
25
+ else
26
+ execute :mkdir, download_dir
27
+ end
28
+ end
29
+ end
30
+
31
+ task :upload_java_install_script do
32
+ on roles(fetch(:solr_roles)) do |host|
33
+ upload! template('java_install.sh'), download_dir
34
+ execute "chmod u+x #{java_install_script_path}"
35
+ end
36
+ end
37
+
38
+ task :install_java do
39
+ on roles(fetch(:solr_roles)) do |host|
40
+ execute :sudo, java_install_script_path
41
+ end
42
+ end
43
+
44
+ task :download_solr do
45
+ on roles(fetch(:solr_roles)) do |host|
46
+ if test "[ -f #{solr_path} ]"
47
+ info "Already downloaded solr to #{solr_path}"
48
+ else
49
+ within download_dir do
50
+ execute "cd #{download_dir}; wget --no-verbose #{solr_url}"
51
+ end
52
+ end
53
+ end
54
+ end
55
+
56
+ task :download_zookeeper do
57
+ on roles(fetch(:zookeeper_roles)) do |host|
58
+ if test "[ -f #{zookeeper_tgz} ]"
59
+ info "Already downloaded zookeeper to #{zookeeper_tgz}"
60
+ else
61
+ within download_dir do
62
+ execute "cd #{download_dir}; wget --no-verbose #{zookeeper_url}"
63
+ end
64
+ end
65
+ end
66
+ end
67
+
68
+ task :extract_zookeeper do
69
+ on roles(fetch(:zookeeper_roles)) do |host|
70
+ execute "cd #{install_home}; tar xf #{zookeeper_tgz}"
71
+ end
72
+ end
73
+
74
+ task :create_install_dir do
75
+ on roles(fetch(:solr_roles)) do |host|
76
+ execute :sudo, "sudo mkdir -p #{install_home}"
77
+ execute :sudo, "sudo chown -R #{fetch(:user)} #{install_home}"
78
+ end
79
+
80
+ on roles(fetch(:zookeeper_roles)) do |host|
81
+ execute :sudo, "sudo mkdir -p #{install_home}"
82
+ execute :sudo, "sudo chown -R #{fetch(:user)} #{install_home}"
83
+ end
84
+ end
85
+
86
+ task :configure_zookeeper do
87
+ zk_id = 0
88
+ on roles(fetch(:zookeeper_roles)) do |host|
89
+ # Write the zookeeper node id to the my_id file
90
+ within zookeeper_install_dir do
91
+ execute("cd #{zookeeper_install_dir}; mkdir -p data")
92
+ execute "cd #{zookeeper_install_dir}; echo #{zk_id} > data/myid"
93
+ context = { hosts: zookeeper_hosts, path: zookeeper_install_dir }
94
+ upload_template(template('zoo.cfg.erb'),
95
+ File.join(zookeeper_install_dir, 'conf', 'zoo.cfg'),
96
+ context)
97
+ zk_id = zk_id + 1
98
+ end
99
+ end
100
+ end
101
+
102
+ desc "Write an Upstart script for ZooKeeper"
103
+ task :upstart_zookeeper do
104
+
105
+ on roles(fetch(:zookeeper_roles)) do |host|
106
+ context = {
107
+ user: solr_user,
108
+ group: solr_user,
109
+ path: zookeeper_install_dir
110
+ }
111
+
112
+ tmp_path = "/tmp/#{zookeeper_service_name}.conf"
113
+ upstart_path = "/etc/init/#{zookeeper_service_name}.conf"
114
+ upload_template(template('zookeeper_upstart.conf.erb'),
115
+ tmp_path,
116
+ context)
117
+ execute :sudo, "mv #{tmp_path} #{upstart_path}"
118
+ end
119
+ end
120
+
121
+ desc "Start up zookeeper"
122
+ task :start_zookeeper do
123
+ on roles(fetch(:zookeeper_roles)) do |host|
124
+ status = capture("service #{zookeeper_service_name} status")
125
+ if status =~ /running/
126
+ info "Zookeeper already running"
127
+ else
128
+ execute :sudo, "service #{zookeeper_service_name} start"
129
+ end
130
+ end
131
+ end
132
+
133
+ desc "Stop up zookeeper on all nodes"
134
+ task :stop_zookeeper do
135
+ on roles(fetch(:zookeeper_roles)) do |host|
136
+ execute :sudo, "service #{zookeeper_service_name} stop"
137
+ end
138
+ end
139
+
140
+
141
+ task :extract_solr do
142
+ on roles(fetch(:solr_roles)) do |host|
143
+ execute "cd #{install_home}; tar xf #{solr_tgz}"
144
+ end
145
+ end
146
+
147
+ # Effectively install solr as a service on the node
148
+ task :configure_solr_service do
149
+ on roles(fetch(:solr_roles)) do |host|
150
+ within download_dir do
151
+ if test "[ -f #{solr_service_script} ]"
152
+ info "#{solr_service_name} already installed at #{solr_service_script}"
153
+ else
154
+ solr_install_script = "#{File.basename(solr_tgz, '.tgz')}/bin/install_solr_service.sh"
155
+ execute("cd #{download_dir}; tar xzf #{solr_tgz} #{solr_install_script} --strip-components=2")
156
+
157
+ # Usage: install_solr_service.sh path_to_solr_distribution_archive OPTIONS
158
+ # The first argument to the script must be a path to a Solr distribution archive, such as solr-5.0.0.tgz
159
+ # (only .tgz or .zip are supported formats for the archive)
160
+ # Supported OPTIONS include:
161
+ # -d Directory for live / writable Solr files, such as logs, pid files, and index data; defaults to /var/solr
162
+ # -i Directory to extract the Solr installation archive; defaults to /opt/
163
+ # The specified path must exist prior to using this script.
164
+ # -p Port Solr should bind to; default is 8983
165
+ # -s Service name; defaults to solr
166
+ # -u User to own the Solr files and run the Solr process as; defaults to solr
167
+ # This script will create the specified user account if it does not exist.
168
+ # -f Upgrade Solr. Overwrite symlink and init script of previous installation.
169
+ execute :sudo, "cd #{download_dir}; sudo ./install_solr_service.sh #{solr_tgz} -s #{solr_service_name} -u #{solr_user}"
170
+
171
+ # Stop the service
172
+ execute :sudo, solr_service_script, "stop"
173
+ end
174
+ end
175
+ end
176
+ end
177
+
178
+ task :update_solr_service_config do
179
+ on roles(fetch(:solr_roles)) do |host|
180
+ # Update the config
181
+ zk_host = zookeeper_hosts.map {|ip| "#{ip}:2181" }.join(',')
182
+ zk_host = "#{zk_host}/solr"
183
+ config = {
184
+ :heap_size => "512m",
185
+ :zk_host => "ZK_HOST=#{zk_host}",
186
+ :zk_client_timeout => 'ZK_CLIENT_TIMEOUT="15000"'
187
+ }
188
+
189
+ tmp_path = "/tmp/#{solr_service_name}.in.sh"
190
+ upload_template(
191
+ template('solr.in.sh.erb'),
192
+ tmp_path,
193
+ config
194
+ )
195
+ solr_servce_config = "/etc/default/#{solr_service_name}.in.sh"
196
+ execute :sudo, "mv", tmp_path, solr_servce_config
197
+ execute :sudo, "chown", solr_user, solr_servce_config
198
+ execute :sudo, "chmod u+x #{solr_servce_config}"
199
+ end
200
+ end
201
+
202
+ task :create_solr_chroot do
203
+ on roles(fetch(:solr_roles))[0] do |host|
204
+ zkcli = File.join(solr_install_dir, "server/scripts/cloud-scripts/zkcli.sh")
205
+ if capture("#{zkcli} -zkhost #{zookeeper_hosts.join(',')} -cmd list") =~ /\/solr/
206
+ info "Already create /solr in zookeeper"
207
+ else
208
+ info "Creating /solr node in zookeeper"
209
+ execute "#{zkcli} -zkhost #{zookeeper_hosts.join(',')} -cmd makepath /solr"
210
+ end
211
+ end
212
+ end
213
+
214
+ desc "Gets the status of the solr service"
215
+ task :solr_status do
216
+ on roles(fetch(:solr_roles)) do
217
+ puts capture(:sudo, "/etc/init.d/#{solr_service_name} status; true")
218
+ end
219
+ end
220
+
221
+ desc "Stops solr on all configured nodes"
222
+ task :stop_solr do
223
+ on roles(fetch(:solr_roles)) do |host|
224
+ execute :sudo, solr_service_script, "stop", raise_on_non_zero_exit: false
225
+ end
226
+ end
227
+
228
+ desc "Stops solr on all configured nodes"
229
+ task :start_solr do
230
+ on roles(fetch(:solr_roles)) do |host|
231
+ execute :sudo, solr_service_script, "start"
232
+ end
233
+ end
234
+
235
+ task :restart_solr do
236
+ invoke "solr:stop_solr"
237
+ invoke "solr:start_solr"
238
+ end
239
+
240
+ desc 'Sets up a solr instance'
241
+ task :install do
242
+ on roles(fetch(:solr_roles)) do |host|
243
+ info "Deploying solr on #{host} to #{download_dir}"
244
+
245
+ invoke 'solr:prepare_download_dir'
246
+ invoke 'solr:upload_java_install_script'
247
+ invoke 'solr:install_java'
248
+
249
+ invoke 'solr:create_install_dir'
250
+
251
+ invoke 'solr:download_zookeeper'
252
+ invoke 'solr:extract_zookeeper'
253
+ invoke 'solr:configure_zookeeper'
254
+ invoke 'solr:upstart_zookeeper'
255
+ invoke 'solr:start_zookeeper'
256
+
257
+ invoke 'solr:download_solr'
258
+ invoke 'solr:extract_solr'
259
+ invoke 'solr:configure_solr_service'
260
+ invoke 'solr:update_solr_service_config'
261
+ invoke 'solr:create_solr_chroot'
262
+ invoke 'solr:restart_solr'
263
+ end
264
+ end
265
+ end
266
+
@@ -0,0 +1,71 @@
1
+ #!/bin/bash
2
+ #
3
+ # Install Oracle Java on Ubuntu
4
+ # Based on http://www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html
5
+
6
+ set -e
7
+
8
+ function install_oracle_java() {
9
+ export DEBIAN_FRONTEND=noninteractive
10
+
11
+ apt-get --yes purge openjdk*
12
+
13
+ which add-apt-repository || apt-get --yes install python-software-properties software-properties-common
14
+
15
+ # to skip the license screen:
16
+ /usr/bin/debconf-set-selections <<EOM
17
+ debconf shared/accepted-oracle-license-v1-1 select true
18
+ debconf shared/accepted-oracle-license-v1-1 seen true
19
+ EOM
20
+
21
+ add-apt-repository --yes ppa:webupd8team/java
22
+ apt-get update
23
+ apt-get --yes install oracle-java8-installer
24
+ apt-get --yes install oracle-java8-set-default
25
+ }
26
+
27
+ function set_java_home() {
28
+
29
+ # determine JAVA_HOME
30
+ JAVA_HOME=`readlink /etc/alternatives/java | sed 's/\/bin\/java$//'`
31
+
32
+ # add to /etc/environment
33
+ if ! grep -q JAVA_HOME /etc/environment ; then
34
+ bash -c "echo JAVA_HOME=$JAVA_HOME >> /etc/environment"
35
+ fi
36
+
37
+ if ! grep -q 'env_keep+=JAVA_HOME' /etc/sudoers; then
38
+ ed /etc/sudoers <<EOM
39
+ /env_reset
40
+ a
41
+ Defaults env_keep+=JAVA_HOME
42
+ .
43
+ w
44
+ q
45
+ EOM
46
+ fi
47
+
48
+ # we do not need to add the JAVA_HOME to the sudoers path because
49
+ # we use /usr/bin/java
50
+ }
51
+
52
+ our_java=`which java||true`
53
+ if [ "x$our_java" = "x" ]; then
54
+ install_oracle_java
55
+ else
56
+ echo "our_java=$our_java"
57
+ if [ -x $our_java ]; then
58
+ file=`readlink -f $our_java`
59
+ if echo "$file" | grep oracle ; then
60
+ echo looks like you already have oracle java in $file
61
+ else
62
+ echo "not oracle java but $file"
63
+ install_oracle_java
64
+ fi
65
+ else
66
+ echo "no java"
67
+ install_oracle_java
68
+ fi
69
+ fi
70
+
71
+ set_java_home
@@ -0,0 +1,113 @@
1
+ # By default the script will use JAVA_HOME to determine which java
2
+ # to use, but you can set a specific path for Solr to use without
3
+ # affecting other Java applications on your server/workstation.
4
+ #SOLR_JAVA_HOME=""
5
+
6
+ # Increase Java Heap as needed to support your indexing / query needs
7
+ SOLR_HEAP="<%= heap_size %>"
8
+
9
+ # Expert: If you want finer control over memory options, specify them directly
10
+ # Comment out SOLR_HEAP if you are using this though, that takes precedence
11
+ #SOLR_JAVA_MEM="-Xms512m -Xmx512m"
12
+
13
+ # Enable verbose GC logging
14
+ GC_LOG_OPTS="-verbose:gc -XX:+PrintHeapAtGC -XX:+PrintGCDetails \
15
+ -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime"
16
+
17
+ # These GC settings have shown to work well for a number of common Solr workloads
18
+ GC_TUNE="-XX:NewRatio=3 \
19
+ -XX:SurvivorRatio=4 \
20
+ -XX:TargetSurvivorRatio=90 \
21
+ -XX:MaxTenuringThreshold=8 \
22
+ -XX:+UseConcMarkSweepGC \
23
+ -XX:+UseParNewGC \
24
+ -XX:ConcGCThreads=4 -XX:ParallelGCThreads=4 \
25
+ -XX:+CMSScavengeBeforeRemark \
26
+ -XX:PretenureSizeThreshold=64m \
27
+ -XX:+UseCMSInitiatingOccupancyOnly \
28
+ -XX:CMSInitiatingOccupancyFraction=50 \
29
+ -XX:CMSMaxAbortablePrecleanTime=6000 \
30
+ -XX:+CMSParallelRemarkEnabled \
31
+ -XX:+ParallelRefProcEnabled"
32
+
33
+ # Set the ZooKeeper connection string if using an external ZooKeeper ensemble
34
+ # e.g. host1:2181,host2:2181/chroot
35
+ # Leave empty if not using SolrCloud
36
+ #ZK_HOST=""
37
+ <%= zk_host %>
38
+
39
+ # Set the ZooKeeper client timeout (for SolrCloud mode)
40
+ #ZK_CLIENT_TIMEOUT="15000"
41
+ <%= zk_client_timeout %>
42
+
43
+ # By default the start script uses "localhost"; override the hostname here
44
+ # for production SolrCloud environments to control the hostname exposed to cluster state
45
+ #SOLR_HOST="192.168.1.1"
46
+
47
+ # By default the start script uses UTC; override the timezone if needed
48
+ #SOLR_TIMEZONE="UTC"
49
+
50
+ # Set to true to activate the JMX RMI connector to allow remote JMX client applications
51
+ # to monitor the JVM hosting Solr; set to "false" to disable that behavior
52
+ # (false is recommended in production environments)
53
+ ENABLE_REMOTE_JMX_OPTS="false"
54
+
55
+ # The script will use SOLR_PORT+10000 for the RMI_PORT or you can set it here
56
+ # RMI_PORT=18983
57
+
58
+ # Set the thread stack size
59
+ SOLR_OPTS="$SOLR_OPTS -Xss256k"
60
+
61
+ # Anything you add to the SOLR_OPTS variable will be included in the java
62
+ # start command line as-is, in ADDITION to other options. If you specify the
63
+ # -a option on start script, those options will be appended as well. Examples:
64
+ #SOLR_OPTS="$SOLR_OPTS -Dsolr.autoSoftCommit.maxTime=3000"
65
+ #SOLR_OPTS="$SOLR_OPTS -Dsolr.autoCommit.maxTime=60000"
66
+ #SOLR_OPTS="$SOLR_OPTS -Dsolr.clustering.enabled=true"
67
+
68
+ # Location where the bin/solr script will save PID files for running instances
69
+ # If not set, the script will create PID files in $SOLR_TIP/bin
70
+ #SOLR_PID_DIR=
71
+
72
+ # Path to a directory for Solr to store cores and their data. By default, Solr will use server/solr
73
+ # If solr.xml is not stored in ZooKeeper, this directory needs to contain solr.xml
74
+ #SOLR_HOME=
75
+
76
+ # Solr provides a default Log4J configuration properties file in server/resources
77
+ # however, you may want to customize the log settings and file appender location
78
+ # so you can point the script to use a different log4j.properties file
79
+ #LOG4J_PROPS=/var/solr/log4j.properties
80
+
81
+ # Location where Solr should write logs to; should agree with the file appender
82
+ # settings in server/resources/log4j.properties
83
+ #SOLR_LOGS_DIR=
84
+
85
+ # Sets the port Solr binds to, default is 8983
86
+ #SOLR_PORT=8983
87
+
88
+ # Uncomment to set SSL-related system properties
89
+ # Be sure to update the paths to the correct keystore for your environment
90
+ #SOLR_SSL_KEY_STORE=etc/solr-ssl.keystore.jks
91
+ #SOLR_SSL_KEY_STORE_PASSWORD=secret
92
+ #SOLR_SSL_TRUST_STORE=etc/solr-ssl.keystore.jks
93
+ #SOLR_SSL_TRUST_STORE_PASSWORD=secret
94
+ #SOLR_SSL_NEED_CLIENT_AUTH=false
95
+ #SOLR_SSL_WANT_CLIENT_AUTH=false
96
+
97
+ # Uncomment if you want to override previously defined SSL values for HTTP client
98
+ # otherwise keep them commented and the above values will automatically be set for HTTP clients
99
+ #SOLR_SSL_CLIENT_KEY_STORE=
100
+ #SOLR_SSL_CLIENT_KEY_STORE_PASSWORD=
101
+ #SOLR_SSL_CLIENT_TRUST_STORE=
102
+ #SOLR_SSL_CLIENT_TRUST_STORE_PASSWORD=
103
+
104
+ # Settings for authentication
105
+ #SOLR_AUTHENTICATION_CLIENT_CONFIGURER=
106
+ #SOLR_AUTHENTICATION_OPTS=
107
+
108
+ SOLR_PID_DIR="/var/cap-solr"
109
+ SOLR_HOME="/var/cap-solr/data"
110
+ LOG4J_PROPS="/var/cap-solr/log4j.properties"
111
+ SOLR_LOGS_DIR="/var/cap-solr/logs"
112
+ SOLR_PORT="8983"
113
+
@@ -0,0 +1,38 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one or more
2
+ # contributor license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright ownership.
4
+ # The ASF licenses this file to You under the Apache License, Version 2.0
5
+ # (the "License"); you may not use this file except in compliance with
6
+ # the License. You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ maxClientCnxns=0
17
+ # The number of milliseconds of each tick
18
+ tickTime=10000
19
+ # The number of ticks that the initial&nbsp;
20
+ # synchronization phase can take
21
+ initLimit=10
22
+ # The number of ticks that can pass between&nbsp;
23
+ # sending a request and getting an acknowledgement
24
+ syncLimit=5
25
+
26
+ # the directory where the snapshot is stored.
27
+ #dataDir=/var/lib/zookeeper
28
+ dataDir=<%= "#{path}/data" %>
29
+
30
+ # the port at which the clients will connect
31
+ clientPort=2181
32
+ minSessionTimeout=100000
33
+ maxSessionTimeout=200000
34
+
35
+ <% hosts.each_with_index do |host, i| %>
36
+ <%= "server.#{i}=#{host}:2888:3888" %>
37
+ <% end %>
38
+
@@ -0,0 +1,22 @@
1
+ # Ubuntu upstart file at /etc/init/zookeeper.conf
2
+
3
+ description "ZooKeeper"
4
+
5
+ limit nofile 32768 32768
6
+
7
+ start on runlevel [2345]
8
+ stop on [!12345]
9
+
10
+ respawn
11
+ respawn limit 2 5
12
+
13
+ umask 007
14
+
15
+ kill timeout 300
16
+
17
+ setuid <%= user %>
18
+ setgid <%= group %>
19
+
20
+ script
21
+ exec <%= File.join(path, '/bin/zkServer.sh') %> start-foreground
22
+ end script
metadata ADDED
@@ -0,0 +1,144 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capistrano-solr
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - rainkinz
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-01-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: capistrano
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '3.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '3.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: tilt
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 2.0.2
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 2.0.2
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.10'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.10'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: pry
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: Capistrano deployment tasks for Solr
98
+ email:
99
+ - brendan.grainger@gmail.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".gitignore"
105
+ - ".rspec"
106
+ - ".travis.yml"
107
+ - Gemfile
108
+ - README.md
109
+ - Rakefile
110
+ - bin/console
111
+ - bin/setup
112
+ - capistrano-solr.gemspec
113
+ - lib/capistrano/dsl/solr_paths.rb
114
+ - lib/capistrano/solr.rb
115
+ - lib/capistrano/solr/version.rb
116
+ - lib/capistrano/tasks/solr.rake
117
+ - templates/java_install.sh
118
+ - templates/solr.in.sh.erb
119
+ - templates/zoo.cfg.erb
120
+ - templates/zookeeper_upstart.conf.erb
121
+ homepage: https://github.com/rainkinz/capistrano-solr
122
+ licenses: []
123
+ metadata: {}
124
+ post_install_message:
125
+ rdoc_options: []
126
+ require_paths:
127
+ - lib
128
+ required_ruby_version: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ required_rubygems_version: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - ">="
136
+ - !ruby/object:Gem::Version
137
+ version: '0'
138
+ requirements: []
139
+ rubyforge_project:
140
+ rubygems_version: 2.4.5
141
+ signing_key:
142
+ specification_version: 4
143
+ summary: Capistrano deployment tasks for Solr
144
+ test_files: []