set :application, "thirteen_tien_len_#{fetch(:stage)}" set :repo_url, 'gogs@git.quaff.top:Jesse/thirteen-tien-len.git' # If you want to import assets, you can change default asset dir (default = system) # This directory must be in your shared directory on the server set :assets_dir, %w(public/assets public/system) #set :local_assets_dir, %w(public/assets public/att) #set :branch, proc { `git rev-parse --abbrev-ref stash`.chomp } #ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp } set :deploy_to, "/home/jesse/srv/thirteen-tien-len_#{fetch(:stage)}" # set :scm, :git # set :format, :pretty # set :log_level, :debug # set :pty, true # set :linked_files, %w{config/database.yml .env} # append :linked_files, "puma.rb" # append :linked_files, "config/master.key" # append :linked_files, "config/database.yml" append :linked_files, ".env" set :linked_dirs, %w{log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system public/lift-calculator} set :rbenv_type, :user # or :system, depends on your rbenv setup # set :rbenv_ruby, '2.6.0' set :rbenv_ruby, File.read('.ruby-version').strip set :rbenv_map_bins, %w{rake gem bundle ruby rails} set :rbenv_roles, :all # default value # set :default_env, { path: "/opt/ruby/bin:$PATH" } set :default_env, { 'PATH' => 'PATH=$PATH:./bin:~/.rbenv/shims:~/.rbenv/bin:/home/jesse/.local/bin:/home/jesse/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/core_perl:$HOME/.rbenv/bin:$PATH' } # set :keep_releases, 5 set :rbenv_custom_path, "/home/jesse/.rbenv/" set :rbenv_prefix, "RBENV_ROOT=#{fetch(:rbenv_custom_path)} RBENV_VERSION=#{fetch(:rbenv_ruby)} #{fetch(:rbenv_custom_path)}/bin/rbenv exec" # set :nginx_path, '/etc/nginx' # directory containing sites-available and sites-enabled # set :nginx_template, 'config/deploy/nginx_conf.erb' # configuration template #set :nginx_server_name, 'example.com' # optional, defaults to :application #set :nginx_upstream, 'example-app' # optional, defaults to :application # set :nginx_listen, 80 # optional, default is not set # set :nginx_roles, :all ## postgresql set :pg_user, "thirteen_tien_len_#{fetch(:stage)}" set :pg_database, "thirteen_tien_len_#{fetch(:stage)}" namespace :db do desc 'Setup the database' task :setup do on roles(:app), in: :sequence, wait: 5 do within release_path do with rails_env: (fetch(:rails_env) || fetch(:stage)) do execute :rake, 'db:setup' end end end end end namespace :deploy do desc 'Restart application' task :restart do on roles(:app), in: :sequence, wait: 5 do # Your restart mechanism here, for example: # execute :touch, release_path.join('tmp/restart.txt') end end after :restart, :clear_cache do on roles(:web), in: :groups, limit: 3, wait: 10 do # Here we can do anything such as: # within release_path do # execute :rake, 'cache:clear' # end end end after :finishing, 'deploy:cleanup' end