Skip to content

Instantly share code, notes, and snippets.

@Kroid
Forked from trushkevich/deploy.rb
Last active August 29, 2015 14:23
Show Gist options
  • Select an option

  • Save Kroid/2dcffa90759d56e3ad87 to your computer and use it in GitHub Desktop.

Select an option

Save Kroid/2dcffa90759d56e3ad87 to your computer and use it in GitHub Desktop.

Revisions

  1. @trushkevich trushkevich revised this gist May 20, 2014. 1 changed file with 21 additions and 5 deletions.
    26 changes: 21 additions & 5 deletions deploy.rb
    Original file line number Diff line number Diff line change
    @@ -1,17 +1,33 @@
    set :private_pub_pid, -> { "#{current_path}/tmp/pids/private_pub.pid" }

    namespace :private_pub do
    desc "Start private_pub server"
    task :start do
    run "cd #{current_path};RAILS_ENV=production bundle exec rackup private_pub.ru -s thin -E production -D -P tmp/pids/private_pub.pid"
    on roles(:app) do
    within release_path do
    with rails_env: fetch(:stage) do
    execute :bundle, "exec thin -C config/private_pub/thin_#{fetch(:stage)}.yml -d -P #{fetch(:private_pub_pid)} start"
    end
    end
    end
    end

    desc "Stop private_pub server"
    task :stop do
    run "cd #{current_path};if [ -f tmp/pids/private_pub.pid ] && [ -e /proc/$(cat tmp/pids/private_pub.pid) ]; then kill -9 `cat tmp/pids/private_pub.pid`; fi"
    on roles(:app) do
    within release_path do
    execute "if [ -f #{fetch(:private_pub_pid)} ] && [ -e /proc/$(cat #{fetch(:private_pub_pid)}) ]; then kill -9 `cat #{fetch(:private_pub_pid)}`; fi"
    end
    end
    end

    desc "Restart private_pub server"
    task :restart do
    find_and_execute_task("private_pub:stop")
    find_and_execute_task("private_pub:start")
    on roles(:app) do
    invoke 'private_pub:stop'
    invoke 'private_pub:start'
    end
    end
    end
    end

    after 'deploy:restart', 'private_pub:restart'
  2. @alec-c4 alec-c4 revised this gist Aug 7, 2012. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions deploy.rb
    Original file line number Diff line number Diff line change
    @@ -1,12 +1,12 @@
    namespace :private_pub do
    desc "Start private_pub server"
    task :start do
    run "cd #{current_path};bundle exec rackup private_pub.ru -s thin -E production -D -P tmp/pids/private-pub.pid"
    run "cd #{current_path};RAILS_ENV=production bundle exec rackup private_pub.ru -s thin -E production -D -P tmp/pids/private_pub.pid"
    end

    desc "Stop private_pub server"
    task :stop do
    run "cd #{current_path};kill -9 `cat tmp/pids/private-pub.pid`; rm tmp/pids/private-pub.pid"
    run "cd #{current_path};if [ -f tmp/pids/private_pub.pid ] && [ -e /proc/$(cat tmp/pids/private_pub.pid) ]; then kill -9 `cat tmp/pids/private_pub.pid`; fi"
    end

    desc "Restart private_pub server"
  3. @alec-c4 alec-c4 renamed this gist Jul 29, 2012. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  4. @alec-c4 alec-c4 created this gist Jul 29, 2012.
    17 changes: 17 additions & 0 deletions gistfile1.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    namespace :private_pub do
    desc "Start private_pub server"
    task :start do
    run "cd #{current_path};bundle exec rackup private_pub.ru -s thin -E production -D -P tmp/pids/private-pub.pid"
    end

    desc "Stop private_pub server"
    task :stop do
    run "cd #{current_path};kill -9 `cat tmp/pids/private-pub.pid`; rm tmp/pids/private-pub.pid"
    end

    desc "Restart private_pub server"
    task :restart do
    find_and_execute_task("private_pub:stop")
    find_and_execute_task("private_pub:start")
    end
    end