From 9df119459d4a391dda23e1dce8a9db12535e2570 Mon Sep 17 00:00:00 2001 From: Torsten Date: Sun, 10 Apr 2022 14:37:03 +0300 Subject: [PATCH] mina config --- Gemfile.lock | 92 ++++++++++++++++++------------------- config/deploy.rb | 86 ++++++++++++++++++++++++++++------ config/deploy/production.rb | 44 ------------------ config/deploy/staging.rb | 61 ------------------------ 4 files changed, 117 insertions(+), 166 deletions(-) delete mode 100644 config/deploy/production.rb delete mode 100644 config/deploy/staging.rb diff --git a/Gemfile.lock b/Gemfile.lock index 4a1f8af..4854d34 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -21,43 +21,43 @@ GIT GEM remote: https://rubygems.org/ specs: - actioncable (5.2.6) - actionpack (= 5.2.6) + actioncable (5.2.7) + actionpack (= 5.2.7) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailer (5.2.6) - actionpack (= 5.2.6) - actionview (= 5.2.6) - activejob (= 5.2.6) + actionmailer (5.2.7) + actionpack (= 5.2.7) + actionview (= 5.2.7) + activejob (= 5.2.7) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.2.6) - actionview (= 5.2.6) - activesupport (= 5.2.6) + actionpack (5.2.7) + actionview (= 5.2.7) + activesupport (= 5.2.7) rack (~> 2.0, >= 2.0.8) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.2.6) - activesupport (= 5.2.6) + actionview (5.2.7) + activesupport (= 5.2.7) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (5.2.6) - activesupport (= 5.2.6) + activejob (5.2.7) + activesupport (= 5.2.7) globalid (>= 0.3.6) - activemodel (5.2.6) - activesupport (= 5.2.6) - activerecord (5.2.6) - activemodel (= 5.2.6) - activesupport (= 5.2.6) + activemodel (5.2.7) + activesupport (= 5.2.7) + activerecord (5.2.7) + activemodel (= 5.2.7) + activesupport (= 5.2.7) arel (>= 9.0) - activestorage (5.2.6) - actionpack (= 5.2.6) - activerecord (= 5.2.6) + activestorage (5.2.7) + actionpack (= 5.2.7) + activerecord (= 5.2.7) marcel (~> 1.0.0) - activesupport (5.2.6) + activesupport (5.2.7) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) @@ -81,14 +81,14 @@ GEM capybara (>= 1.0, < 4) launchy coderay (1.1.2) - concurrent-ruby (1.1.9) + concurrent-ruby (1.1.10) crass (1.0.6) diff-lcs (1.3) erubi (1.10.0) erubis (2.7.0) execjs (2.7.0) ffi (1.10.0) - globalid (0.5.2) + globalid (1.0.0) activesupport (>= 5.0) haml (5.0.4) temple (>= 0.8.0) @@ -109,7 +109,7 @@ GEM haml (>= 4.0, < 6) nokogiri (>= 1.6.0) ruby_parser (~> 3.5) - i18n (1.8.11) + i18n (1.10.0) concurrent-ruby (~> 1.0) jquery-rails (4.3.3) rails-dom-testing (>= 1, < 3) @@ -122,7 +122,7 @@ GEM rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) ruby_dep (~> 1.2) - loofah (2.12.0) + loofah (2.16.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) @@ -133,13 +133,13 @@ GEM open4 (~> 1.3.4) rake mini_mime (1.1.2) - mini_portile2 (2.6.1) + mini_portile2 (2.8.0) mini_racer (0.2.6) libv8 (>= 6.9.411) - minitest (5.14.4) + minitest (5.15.0) nio4r (2.5.8) - nokogiri (1.12.5) - mini_portile2 (~> 2.6.1) + nokogiri (1.13.3) + mini_portile2 (~> 2.8.0) racc (~> 1.4) opal (0.11.4) ast (>= 2.3.0) @@ -177,27 +177,27 @@ GEM rack (2.2.3) rack-test (1.1.0) rack (>= 1.0, < 3) - rails (5.2.6) - actioncable (= 5.2.6) - actionmailer (= 5.2.6) - actionpack (= 5.2.6) - actionview (= 5.2.6) - activejob (= 5.2.6) - activemodel (= 5.2.6) - activerecord (= 5.2.6) - activestorage (= 5.2.6) - activesupport (= 5.2.6) + rails (5.2.7) + actioncable (= 5.2.7) + actionmailer (= 5.2.7) + actionpack (= 5.2.7) + actionview (= 5.2.7) + activejob (= 5.2.7) + activemodel (= 5.2.7) + activerecord (= 5.2.7) + activestorage (= 5.2.7) + activesupport (= 5.2.7) bundler (>= 1.3.0) - railties (= 5.2.6) + railties (= 5.2.7) sprockets-rails (>= 2.0.0) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) rails-html-sanitizer (1.4.2) loofah (~> 2.3) - railties (5.2.6) - actionpack (= 5.2.6) - activesupport (= 5.2.6) + railties (5.2.7) + actionpack (= 5.2.7) + activesupport (= 5.2.7) method_source rake (>= 0.8.7) thor (>= 0.19.0, < 2.0) @@ -243,14 +243,14 @@ GEM sprockets (3.7.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) - sprockets-rails (3.4.0) + sprockets-rails (3.4.2) actionpack (>= 5.2) activesupport (>= 5.2) sprockets (>= 3.0.0) susy (2.2.12) sass (>= 3.3.0, < 3.5) temple (0.8.0) - thor (1.1.0) + thor (1.2.1) thread_safe (0.3.6) tilt (2.0.9) tzinfo (1.2.9) diff --git a/config/deploy.rb b/config/deploy.rb index 685403e..c9e94fd 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -1,21 +1,77 @@ -# config valid for current version and patch releases of Capistrano -lock "~> 3.11.0" +require 'mina/rails' +require 'mina/git' +require 'mina/rbenv' # for rbenv support. (https://rbenv.org) -set :application, "ruby-x" -set :repo_url, "https://github.com/ruby-x/ruby-x.github.io.git" -#set :repo_url, "git@github.com:ruby-x/ruby-x.github.io.git" +# 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) -# Default deploy_to directory is /var/www/my_app_name -set :deploy_to, '/var/www/vhosts/rubydesign.fi/ruby-x.org' +set :application_name, 'ruby-x' +set :domain, '192.168.128.100' +set :deploy_to, '/home/feenix/ruby-x' +set :repository, "https://github.com/ruby-x/ruby-x.github.io.git" +set :branch, 'master' -# Default value for :linked_files is [] -#append :linked_files, "config/database.yml" +# 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. -# Default value for linked_dirs is [] -append :linked_dirs, "log", "tmp/pids", "tmp/cache", "tmp/sockets", "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') +set :shared_files, fetch(:shared_files, []).push('config/master.key') -# Default value for default_env is {} -# set :default_env, { path: "/opt/ruby/bin:$PATH" } +# 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' -# Default value for local_user is ENV['USER'] -set :local_user, -> { 'rubydesign' } +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 :'rails:assets_precompile' + 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 + +namespace :passenger do + desc "Restart Passenger" + task :restart do + command %{ + echo "-----> Restarting passenger" + #{echo_cmd %[touch tmp/restart.txt]} + } + end +end diff --git a/config/deploy/production.rb b/config/deploy/production.rb deleted file mode 100644 index 17dfee7..0000000 --- a/config/deploy/production.rb +++ /dev/null @@ -1,44 +0,0 @@ -# server-based syntax -# ====================== -# Defines a single server with a list of roles and multiple properties. -# You can define all roles on a single server, or split them: - -server 'ruby-x.org', user: 'rubydesign', roles: %w{app db web} - - -# Configuration -# ============= -# You can set any configuration variable like in config/deploy.rb -# These variables are then only loaded and set in this stage. -# For available Capistrano configuration variables see the documentation page. -# http://capistranorb.com/documentation/getting-started/configuration/ -# Feel free to add new variables to customise your setup. - - - -# Custom SSH Options -# ================== -# You may pass any option but keep in mind that net/ssh understands a -# limited set of options, consult the Net::SSH documentation. -# http://net-ssh.github.io/net-ssh/classes/Net/SSH.html#method-c-start -# -# Global options -# -------------- -# set :ssh_options, { -# keys: %w(/home/rlisowski/.ssh/id_rsa), -# forward_agent: false, -# auth_methods: %w(password) -# } -# -# The server-based syntax can be used to override options: -# ------------------------------------ -# server "example.com", -# user: "user_name", -# roles: %w{web app}, -# ssh_options: { -# user: "user_name", # overrides user setting above -# keys: %w(/home/user_name/.ssh/id_rsa), -# forward_agent: false, -# auth_methods: %w(publickey password) -# # password: "please use keys" -# } diff --git a/config/deploy/staging.rb b/config/deploy/staging.rb deleted file mode 100644 index 4bb7a71..0000000 --- a/config/deploy/staging.rb +++ /dev/null @@ -1,61 +0,0 @@ -# server-based syntax -# ====================== -# Defines a single server with a list of roles and multiple properties. -# You can define all roles on a single server, or split them: - -# server "example.com", user: "deploy", roles: %w{app db web}, my_property: :my_value -# server "example.com", user: "deploy", roles: %w{app web}, other_property: :other_value -# server "db.example.com", user: "deploy", roles: %w{db} - - - -# role-based syntax -# ================== - -# Defines a role with one or multiple servers. The primary server in each -# group is considered to be the first unless any hosts have the primary -# property set. Specify the username and a domain or IP for the server. -# Don't use `:all`, it's a meta role. - -# role :app, %w{deploy@example.com}, my_property: :my_value -# role :web, %w{user1@primary.com user2@additional.com}, other_property: :other_value -# role :db, %w{deploy@example.com} - - - -# Configuration -# ============= -# You can set any configuration variable like in config/deploy.rb -# These variables are then only loaded and set in this stage. -# For available Capistrano configuration variables see the documentation page. -# http://capistranorb.com/documentation/getting-started/configuration/ -# Feel free to add new variables to customise your setup. - - - -# Custom SSH Options -# ================== -# You may pass any option but keep in mind that net/ssh understands a -# limited set of options, consult the Net::SSH documentation. -# http://net-ssh.github.io/net-ssh/classes/Net/SSH.html#method-c-start -# -# Global options -# -------------- -# set :ssh_options, { -# keys: %w(/home/rlisowski/.ssh/id_rsa), -# forward_agent: false, -# auth_methods: %w(password) -# } -# -# The server-based syntax can be used to override options: -# ------------------------------------ -# server "example.com", -# user: "user_name", -# roles: %w{web app}, -# ssh_options: { -# user: "user_name", # overrides user setting above -# keys: %w(/home/user_name/.ssh/id_rsa), -# forward_agent: false, -# auth_methods: %w(publickey password) -# # password: "please use keys" -# }