first mina deploy working, still services missing
This commit is contained in:
parent
1c36e5140f
commit
e70c65219a
104
config/deploy.rb
104
config/deploy.rb
|
@ -1,35 +1,91 @@
|
|||
# frozen_string_literal: true
|
||||
require 'mina/rails'
|
||||
require 'mina/git'
|
||||
require 'mina/rbenv' # for rbenv support. (https://rbenv.org)
|
||||
|
||||
lock '3.17.2'
|
||||
# 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)
|
||||
|
||||
set :repo_url, ENV.fetch('REPO', 'https://github.com/mastodon/mastodon.git')
|
||||
set :branch, ENV.fetch('BRANCH', 'main')
|
||||
set :application_name, 'mastadon'
|
||||
#set :domain, 'www.rubydesign.fi'
|
||||
set :domain, '95.217.60.123'
|
||||
set :deploy_to, '/home/feenix/mastadon'
|
||||
set :repository, "https://github.com/FeenixMakers/mastodon.git"
|
||||
set :branch, 'feenix'
|
||||
|
||||
set :application, 'mastodon'
|
||||
set :rbenv_type, :user
|
||||
set :rbenv_ruby, File.read('.ruby-version').strip
|
||||
set :migration_role, :app
|
||||
# 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.
|
||||
|
||||
append :linked_files, '.env.production', 'public/robots.txt'
|
||||
append :linked_dirs, 'vendor/bundle', 'node_modules', 'public/system'
|
||||
# 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`
|
||||
set :shared_dirs, fetch(:shared_dirs, []).push('tmp/pids' , 'tmp/sockets' , 'public/uploads')
|
||||
set :shared_files, fetch(:shared_files, []).push('.env.production')
|
||||
|
||||
SYSTEMD_SERVICES = %i[sidekiq streaming web].freeze
|
||||
SERVICE_ACTIONS = %i[reload restart status].freeze
|
||||
set :force_migrate , true
|
||||
|
||||
namespace :systemd do
|
||||
SYSTEMD_SERVICES.each do |service|
|
||||
SERVICE_ACTIONS.each do |action|
|
||||
desc "Perform a #{action} on #{service} service"
|
||||
task "#{service}:#{action}".to_sym do
|
||||
on roles(:app) do
|
||||
# runs e.g. "sudo restart mastodon-sidekiq.service"
|
||||
sudo :systemctl, action, "#{fetch(:application)}-#{service}.service"
|
||||
end
|
||||
# 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.
|
||||
invoke :'rbenv:load'
|
||||
|
||||
end
|
||||
|
||||
# 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
|
||||
|
||||
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 :'yarn:install'
|
||||
invoke :'rails:assets_precompile'
|
||||
invoke :'rails:db_migrate'
|
||||
invoke :'deploy:cleanup'
|
||||
|
||||
on :launch do
|
||||
in_path(fetch(:current_path)) do
|
||||
invoke :'passenger:restart'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# you can use `run :local` to run tasks on local machine before of after the deploy scripts
|
||||
# run(:local){ say 'done' }
|
||||
end
|
||||
|
||||
after 'deploy:publishing', 'systemd:web:reload'
|
||||
after 'deploy:publishing', 'systemd:sidekiq:restart'
|
||||
after 'deploy:publishing', 'systemd:streaming:restart'
|
||||
namespace :yarn do
|
||||
desc "Install yarn"
|
||||
task :install do
|
||||
command %{
|
||||
echo "-----> Install yarn"
|
||||
#{echo_cmd %[yarn install]}
|
||||
}
|
||||
end
|
||||
end
|
||||
namespace :passenger do
|
||||
desc "Restart Passenger"
|
||||
task :restart do
|
||||
command %{
|
||||
echo "-----> Restarting passenger"
|
||||
#{echo_cmd %[touch tmp/restart.txt]}
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue