Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

merge

  • Loading branch information...
commit b77b9e1bec48111156c524a2dd015924aa4714d7 2 parents d28b813 + aed5b83
@grosser authored
View
6 Capfile
@@ -24,14 +24,14 @@ ips.each do |ip|
role :web, ip
end
+
namespace :deploy do
task :start do
- run "cd #{current_path} && bundle exec thin start --daemonize --port 8701"
+ run "cd #{current_path} && ./manager.rb start"
end
task :stop do
- pid = 'tmp/pids/thin.pid'
- run "cd #{current_path} && (test -e #{pid} && cat #{pid} | xargs --no-run-if-empty kill) || echo 'not running'"
+ run "cd #{current_path} && ./manager.rb stop"
end
task :restart, :roles => :app do
View
3  Readme.md
@@ -11,4 +11,5 @@ Server-Setup
- Copy and customize config.example.yml into shared/config.yml
- add /srv/ha_plus/shared/pids
- add /srv/ha_plus/shared/log
- - add /srv/ha_plus/current/ha_switch to sudoers
+ - move sudoless_haproxy_switch to /usr/local/bin
+ - add `%users ALL=(ALL) NOPASSWD:/usr/local/bin/sudoless_haproxy_switch` to /etc/sudoers
View
2  app.rb
@@ -40,7 +40,7 @@
end
get '/set' do
- result = `sudo #{File.expand_path('../../current')}/ha_switch #{params[:todo]} #{params[:service]} #{params[:server]} 2>&1`
+ result = `sudo sudoless_haproxy_switch #{params[:todo]} #{params[:service]} #{params[:server]} 2>&1`
if $?.success? and not result.include?('ERROR')
redirect "/##{params[:service]}"
else
View
14 manager.rb
@@ -0,0 +1,14 @@
+#!/usr/bin/env ruby
+
+pid = File.expand_path('tmp/pids/thin.pid')
+
+case ARGV[0]
+when 'start'
+ exec "bundle exec thin start --daemonize --port 8701"
+when 'stop'
+ exec "(test -e #{pid} && cat #{pid} | xargs --no-run-if-empty kill) || echo 'not running'"
+when 'pid'
+ puts pid
+else
+ raise "Unknown first argument"
+end
View
0  ha_switch → sudoless_haproxy_switch
File renamed without changes
Please sign in to comment.
Something went wrong with that request. Please try again.