gateway/config/deploy.rb

81 lines
2.7 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-04-09 13:28:24 +02:00
require "mina/whenever"
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'
2022-04-09 10:49:54 +02:00
set :domain, '192.168.128.100'
2022-03-29 17:48:48 +02:00
set :deploy_to, '/home/feenix/gateway'
set :repository, "https://github.com/rubydesign/gateway.git"
2022-04-09 14:10:42 +02:00
set :branch, 'main'
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-04-09 16:49:55 +02:00
set :shared_files, fetch(:shared_files, []).push('config/master.key' , 'config/letsencrypt.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
invoke :'whenever:update'
2022-03-29 17:48:48 +02:00
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