gateway/config/deploy.rb

79 lines
2.6 KiB
Ruby
Raw Normal View History

2022-03-29 17:48:48 +02:00
require 'mina/rails'
require 'mina/git'
require 'mina/rbenv' # for rbenv support. (https://rbenv.org)
2022-03-29 11:41:48 +02:00
2022-03-29 17:48:48 +02:00
# Basic settings:
# domain - The hostname to SSH to.
# deploy_to - Path to deploy into.
# repository - Git repo to clone from. (needed by mina/git)
# branch - Branch name to deploy. (needed by mina/git)
2022-03-29 11:41:48 +02:00
2022-03-29 17:48:48 +02:00
set :application_name, 'gateway'
set :domain, 'web-server.local'
set :deploy_to, '/home/feenix/gateway'
set :repository, "https://github.com/rubydesign/gateway.git"
2022-03-31 10:54:31 +02:00
set :branch, 'passenger'
2022-03-29 11:41:48 +02:00
2022-03-29 17:48:48 +02:00
# Optional settings:
set :user, 'feenix' # Username in the server to SSH to.
# set :port, '30000' # SSH port number.
# set :forward_agent, true # SSH forward_agent.
2022-03-29 11:41:48 +02:00
2022-03-29 17:48:48 +02:00
# Shared dirs and files will be symlinked into the app-folder by the 'deploy:link_shared_paths' step.
# Some plugins already add folders to shared_dirs like `mina/rails` add `public/assets`, `vendor/bundle` and many more
# run `mina -d` to see all folders and files already included in `shared_dirs` and `shared_files`
2022-03-31 01:11:07 +02:00
set :shared_dirs, fetch(:shared_dirs, []).push('tmp/pids' , 'tmp/sockets')
2022-03-30 23:35:47 +02:00
set :shared_files, fetch(:shared_files, []).push('config/master.key')
2022-03-29 11:41:48 +02:00
2022-03-29 17:48:48 +02:00
# This task is the environment that is loaded for all remote run commands, such as
# `mina deploy` or `mina rake`.
task :remote_environment do
# If you're using rbenv, use this to load the rbenv environment.
# Be sure to commit your .ruby-version or .rbenv-version to your repository.
2022-03-30 14:36:11 +02:00
invoke :'rbenv:load'
2022-03-29 11:41:48 +02:00
2022-03-29 17:48:48 +02:00
end
2022-03-29 11:41:48 +02:00
2022-03-29 17:48:48 +02:00
# Put any custom commands you need to run at setup
# All paths in `shared_dirs` and `shared_paths` will be created on their own.
task :setup do
# command %{rbenv install 2.5.3 --skip-existing}
# command %{rvm install ruby-2.5.3}
# command %{gem install bundler}
end
2022-03-29 11:41:48 +02:00
2022-03-29 17:48:48 +02:00
desc "Deploys the current version to the server."
task :deploy do
# uncomment this line to make sure you pushed your local branch to the remote origin
# invoke :'git:ensure_pushed'
deploy do
# Put things that will set up an empty directory into a fully set-up
# instance of your project.
invoke :'git:clone'
invoke :'deploy:link_shared_paths'
invoke :'bundle:install'
invoke :'rails:db_migrate'
invoke :'rails:assets_precompile'
invoke :'deploy:cleanup'
2022-03-29 11:41:48 +02:00
2022-03-29 17:48:48 +02:00
on :launch do
in_path(fetch(:current_path)) do
2022-03-31 10:54:31 +02:00
invoke :'passenger:restart'
2022-03-29 17:48:48 +02:00
end
end
end
2022-03-29 11:41:48 +02:00
2022-03-29 17:48:48 +02:00
# you can use `run :local` to run tasks on local machine before of after the deploy scripts
# run(:local){ say 'done' }
end
2022-03-29 11:41:48 +02:00
2022-03-31 14:35:28 +02:00
namespace :passenger do
desc "Restart Passenger"
task :restart do
command %{
echo "-----> Restarting passenger"
#{echo_cmd %[touch tmp/restart.txt]}
}
end
end