From 15354c284879c734ca9bd87450d715dcdbe8aec2 Mon Sep 17 00:00:00 2001 From: Azul Date: Thu, 20 Sep 2012 13:02:18 +0200 Subject: capified and moved bin to own dir --- Capfile | 3 +++ bin/leap_ca | 25 +++++++++++++++++++++++++ config/deploy.rb.example | 23 +++++++++++++++++++++++ leap_ca.rb | 25 ------------------------- 4 files changed, 51 insertions(+), 25 deletions(-) create mode 100644 Capfile create mode 100755 bin/leap_ca create mode 100644 config/deploy.rb.example delete mode 100755 leap_ca.rb diff --git a/Capfile b/Capfile new file mode 100644 index 0000000..f3e7334 --- /dev/null +++ b/Capfile @@ -0,0 +1,3 @@ +load 'rubygems' +load 'railsless-deploy' +load 'config/deploy' diff --git a/bin/leap_ca b/bin/leap_ca new file mode 100755 index 0000000..baefff2 --- /dev/null +++ b/bin/leap_ca @@ -0,0 +1,25 @@ +#!/usr/bin/ruby + +require 'rubygems' +require 'daemons' +require 'yajl/http_stream' + +require 'lib/cert' +require 'lib/couch_stream' +require 'lib/couch_changes' +require 'lib/pool' + + +puts "Tracking #{Cert.database.root}" +couch = CouchStream.new(Cert.database.root) +changes = CouchChanges.new(couch) +pool = LeapCA::Pool.new(File.expand_path("../config/pool.yml", __FILE__)) +pool.fill +Daemons.run_proc('leap_ca.rb') do + changes.follow do |hash| + p hash + if hash[:deleted] + pool.fill + end + end +end diff --git a/config/deploy.rb.example b/config/deploy.rb.example new file mode 100644 index 0000000..5fb18ed --- /dev/null +++ b/config/deploy.rb.example @@ -0,0 +1,23 @@ +require "bundler/capistrano" + +set :application, "leap_ca" + +set :scm, :git +set :repository, "git://leap.se/leap_ca" + +role :app, "YOUR SERVER GOES HERE" + +# if you want to clean up old releases on each deploy uncomment this: +# after "deploy:restart", "deploy:cleanup" + +namespace :deploy do + task :start, :roles => :app do + run "#{File.join(current_path,'bin','leap_ca')} start" + end + task :stop, :roles => :app do + run "#{File.join(current_path,'bin','leap_ca')} stop" + end + task :restart, :roles => :app, :except => { :no_release => true } do + run "#{File.join(current_path,'bin','leap_ca')} restart" + end +end diff --git a/leap_ca.rb b/leap_ca.rb deleted file mode 100755 index baefff2..0000000 --- a/leap_ca.rb +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/ruby - -require 'rubygems' -require 'daemons' -require 'yajl/http_stream' - -require 'lib/cert' -require 'lib/couch_stream' -require 'lib/couch_changes' -require 'lib/pool' - - -puts "Tracking #{Cert.database.root}" -couch = CouchStream.new(Cert.database.root) -changes = CouchChanges.new(couch) -pool = LeapCA::Pool.new(File.expand_path("../config/pool.yml", __FILE__)) -pool.fill -Daemons.run_proc('leap_ca.rb') do - changes.follow do |hash| - p hash - if hash[:deleted] - pool.fill - end - end -end -- cgit v1.2.3