Skip to content

Instantly share code, notes, and snippets.

@sdogruyol
Last active August 29, 2016 07:23
Show Gist options
  • Save sdogruyol/d19361ffa9115454064f9379e8dc7e40 to your computer and use it in GitHub Desktop.
Save sdogruyol/d19361ffa9115454064f9379e8dc7e40 to your computer and use it in GitHub Desktop.
lock '3.5.0'
set :application, 'your-app'
set :repo_url, 'https://github.com/your/app'
set :deploy_to, '/home/deploy/apps/your-app/'
namespace :deploy do
after :updated, :build do
on roles(:web) do
execute "cd '#{release_path}' && shards install"
execute "cd '#{release_path}' && crystal build --release src/app.cr"
end
end
end
namespace :kemal do
task :start do
on roles(:web) do
execute "#{release_path}/app >> #{shared_path}/kemal.log & echo $! > #{shared_path}/kemal.pid"
end
end
task :restart do
on roles(:web) do
invoke "kemal:stop"
invoke "kemal:start"
end
end
task :stop do
on roles(:web) do
execute "kill -INT $(cat #{shared_path}/kemal.pid) && rm #{shared_path}/kemal.pid"
end
end
end
after 'deploy:publishing', 'kemal:restart'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment