picky 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/lib/deployment.rb CHANGED
@@ -126,7 +126,7 @@ module Picky
126
126
  # link database-config files
127
127
  run "ln -sf #{shared_path}/app/db.yml #{current_path}/app/db.yml"
128
128
  # link unicorn.ru
129
- run "ln -sf #{shared_path}/app/unicorn.ru #{current_path}/app/unicorn.ru"
129
+ run "ln -sf #{shared_path}/unicorn.ru #{current_path}/unicorn.ru"
130
130
  end
131
131
 
132
132
  namespace :rollback do
@@ -1,48 +1,37 @@
1
1
  # TODO This file needs some love.
2
2
  #
3
3
  namespace :server do
4
+
4
5
  def chdir_to_root
5
6
  Dir.chdir SEARCH_ROOT
6
7
  end
8
+
7
9
  def current_pid
8
10
  pid = `cat #{File.join(SEARCH_ROOT, 'tmp/pids/unicorn.pid')}`
9
11
  pid.blank? ? nil : pid.chomp
10
12
  end
13
+
11
14
  desc "Start the unicorns. Weheee!"
12
- task :start => :application do
15
+ task :start => :framework do
13
16
  chdir_to_root
14
17
  # Rake::Task[:"solr:start"].invoke # TODO Move to better place.
15
- config = {}
16
- config['production'] = {
17
- :port => 6000,
18
- :daemonize => true
19
- }
20
- config['development'] = {
21
- :port => 4000,
22
- :daemonize => false
23
- }
24
- # TODO Move port configuration!
25
- port = SEARCH_ENVIRONMENT == 'production' ? 6000 : 4000
26
- `export SEARCH_ENV=#{SEARCH_ENVIRONMENT}; unicorn -p #{config[SEARCH_ENVIRONMENT][:port]} -c #{File.join(SEARCH_ROOT, 'app/unicorn.ru')} #{config[SEARCH_ENVIRONMENT][:daemonize] ? '-D' : ''} #{File.join(SEARCH_ROOT, 'app/application.ru')}`
27
- end
28
- desc "Restart the unicorns!"
29
- task :restart do
30
- Rake::Task[:"server:stop"].invoke
31
- sleep 15
32
- Rake::Task[:"server:start"].invoke
18
+ daemonize = SEARCH_ENVIRONMENT == 'production' ? '-D' : ''
19
+ command = "export SEARCH_ENV=#{SEARCH_ENVIRONMENT}; unicorn -c unicorn.ru #{daemonize}".strip
20
+ puts "Running \`#{command}\`."
21
+ exec command
33
22
  end
23
+
34
24
  desc "Stop the unicorns. Blam!"
35
- task :stop => :application do
36
- chdir_to_root
25
+ task :stop => :framework do
37
26
  `kill -QUIT #{current_pid}` if current_pid
38
27
  # Rake::Task[:"solr:stop"].invoke # TODO Move to better place.
39
28
  end
40
-
41
- # TODO
42
- #
43
- desc 'send the USR1 signal to the thin server'
44
- task :usr1 => :ruby_version do
45
- puts "Sending USR1 signal to the thin server."
46
- `pidof thin#{RUBY_VERSION_APPENDIX}`.split.each { |pid| Process.kill('USR1', pid.to_i) }
29
+
30
+ desc "Restart the unicorns!"
31
+ task :restart do
32
+ Rake::Task[:"server:stop"].invoke
33
+ sleep 5
34
+ Rake::Task[:"server:start"].invoke
47
35
  end
36
+
48
37
  end
@@ -1,21 +1,18 @@
1
- # This file has been generated by Picky.
2
- #
3
-
4
1
  # Require the gem. This loads the search framework.
5
2
  #
6
3
  require 'picky'
7
4
 
8
5
  # Load your application. This requires the following files in
9
6
  #
10
- # * /lib/initializers/*.rb
11
- # * /lib/tokenizers/*.rb
12
- # * /lib/indexers/*.rb
13
- # * /lib/query/*.rb
7
+ # * lib/initializers/*.rb
8
+ # * lib/tokenizers/*.rb
9
+ # * lib/indexers/*.rb
10
+ # * lib/query/*.rb
14
11
  #
15
- # * /app/logging.rb
16
- # * /app/application.rb
12
+ # * app/logging.rb
13
+ # * app/application.rb
17
14
  #
18
- # to be required (in that order).
15
+ # (in that order).
19
16
  #
20
17
  Loader.load_application
21
18
 
@@ -34,6 +31,6 @@ use Rack::Harakiri
34
31
 
35
32
  # Start the application and start accepting requests.
36
33
  #
37
- # Note: Needs to be the same name as in application.rb.
34
+ # Note: Needs to be the same name as in app/application.rb.
38
35
  #
39
36
  run PickySearch
@@ -0,0 +1,11 @@
1
+ listen '0.0.0.0:8080'
2
+ pid 'tmp/pids/unicorn.pid'
3
+ preload_app true
4
+ stderr_path 'log/unicorn.stderr.log'
5
+ stdout_path 'log/unicorn.stdout.log'
6
+ timeout 10
7
+ worker_processes 2
8
+
9
+ after_fork do |_, _|
10
+ GC.disable
11
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 4
9
- version: 0.0.4
8
+ - 5
9
+ version: 0.0.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - Florian Hanke
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-10-02 00:00:00 +02:00
17
+ date: 2010-10-03 00:00:00 +02:00
18
18
  default_executable: picky
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -268,17 +268,17 @@ files:
268
268
  - lib/tasks/try.rake
269
269
  - lib/picky/ext/ruby19/performant.c
270
270
  - prototype_project/app/application.rb
271
- - prototype_project/app/application.ru
272
271
  - prototype_project/app/db.yml
273
272
  - prototype_project/app/logging.rb
274
273
  - prototype_project/app/README
275
- - prototype_project/app/unicorn.ru
274
+ - prototype_project/config.ru
276
275
  - prototype_project/Gemfile
277
276
  - prototype_project/log/README
278
277
  - prototype_project/Rakefile
279
278
  - prototype_project/script/console
280
279
  - prototype_project/tmp/pids/README
281
280
  - prototype_project/tmp/README
281
+ - prototype_project/unicorn.ru
282
282
  - spec/ext/performant_spec.rb
283
283
  - spec/lib/application_spec.rb
284
284
  - spec/lib/cacher/partial/subtoken_spec.rb
@@ -1,10 +0,0 @@
1
- worker_processes 2
2
- listen '/tmp/unicorn.sock', :backlog => 1
3
- listen 9292, :tcp_nopush => true
4
- timeout 10
5
- pid 'tmp/pids/unicorn.pid'
6
- preload_app true
7
-
8
- after_fork do |_, _|
9
- GC.disable
10
- end