diff --git a/Capfile b/Capfile new file mode 100644 index 0000000..521e8df --- /dev/null +++ b/Capfile @@ -0,0 +1,40 @@ +# frozen_string_literal: true + +# Load DSL and set up stages +require 'capistrano/setup' + +# Include default deployment tasks +require 'capistrano/deploy' + +# Load the SCM plugin appropriate to your project: +# +# require "capistrano/scm/hg" +# install_plugin Capistrano::SCM::Hg +# or +# require "capistrano/scm/svn" +# install_plugin Capistrano::SCM::Svn +# or +require 'capistrano/scm/git' +install_plugin Capistrano::SCM::Git + +# Include tasks from other gems included in your Gemfile +# +# For documentation on these, see for example: +# +# https://github.com/capistrano/rvm +# https://github.com/capistrano/rbenv +# https://github.com/capistrano/chruby +# https://github.com/capistrano/bundler +# https://github.com/capistrano/rails +# https://github.com/capistrano/passenger +# +# require "capistrano/rvm" +# require "capistrano/rbenv" +# require "capistrano/chruby" +require 'capistrano/bundler' +# require "capistrano/rails/assets" +require 'capistrano/rails/migrations' +# require "capistrano/passenger" + +# Load custom tasks from `lib/capistrano/tasks` if you have any defined +Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r } diff --git a/Gemfile b/Gemfile index 25d84a5..084978c 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ # frozen_string_literal: true -source 'https://rubygems.org' +source 'https://gems.sutty.nl' git_source(:github) { |repo| "https://github.com/#{repo}.git" } ruby '2.6.5' @@ -40,6 +40,12 @@ group :development do gem 'listen', '>= 3.0.5', '< 3.2' # Spring speeds up development by keeping your application running in # the background. Read more: https://github.com/rails/spring + gem 'bcrypt_pbkdf' + gem 'capistrano', require: false + gem 'capistrano-bundler', require: false + gem 'capistrano-rails', require: false + gem 'capistrano-rbenv', require: false + gem 'ed25519' gem 'rubocop-rails' gem 'spring' gem 'spring-watcher-listen', '~> 2.0.0' diff --git a/Gemfile.lock b/Gemfile.lock index 8fda32d..c7ff27b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,5 +1,5 @@ GEM - remote: https://rubygems.org/ + remote: https://gems.sutty.nl/ specs: actioncable (5.2.4.1) actionpack (= 5.2.4.1) @@ -42,16 +42,33 @@ GEM i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) + airbrussh (1.4.0) + sshkit (>= 1.6.1, != 1.7.0) arel (9.0.0) ast (2.4.0) bcrypt (3.1.13) + bcrypt_pbkdf (1.0.1) bootsnap (1.4.5) msgpack (~> 1.0) builder (3.2.4) + capistrano (3.12.0) + airbrussh (>= 1.0.0) + i18n + rake (>= 10.0.0) + sshkit (>= 1.9.0) + capistrano-bundler (1.6.0) + capistrano (~> 3.1) + capistrano-rails (1.4.0) + capistrano (~> 3.1) + capistrano-bundler (~> 1.1) + capistrano-rbenv (2.1.6) + capistrano (~> 3.1) + sshkit (~> 1.3) coderay (1.1.2) concurrent-ruby (1.1.6) crass (1.0.6) database_cleaner (1.8.3) + ed25519 (1.2.4) erubi (1.9.0) factory_bot (5.1.1) activesupport (>= 4.2.0) @@ -85,6 +102,9 @@ GEM mini_portile2 (2.4.0) minitest (5.14.0) msgpack (1.3.3) + net-scp (2.0.0) + net-ssh (>= 2.6.5, < 6.0.0) + net-ssh (5.2.0) nio4r (2.5.2) nokogiri (1.10.8) mini_portile2 (~> 2.4.0) @@ -156,6 +176,9 @@ GEM activesupport (>= 4.0) sprockets (>= 3.0.0) sqlite3 (1.4.2) + sshkit (1.20.0) + net-scp (>= 1.1.2) + net-ssh (>= 2.8.0) thor (1.0.1) thread_safe (0.3.6) tzinfo (1.2.6) @@ -177,8 +200,14 @@ PLATFORMS DEPENDENCIES bcrypt (~> 3.1.7) + bcrypt_pbkdf bootsnap (>= 1.1.0) + capistrano + capistrano-bundler + capistrano-rails + capistrano-rbenv database_cleaner + ed25519 factory_bot_rails jbuilder (~> 2.5) listen (>= 3.0.5, < 3.2) diff --git a/config/deploy.rb b/config/deploy.rb new file mode 100644 index 0000000..8266c59 --- /dev/null +++ b/config/deploy.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +lock '~> 3.12.0' + +set :application, 'lumi' +set :repo_url, 'https://0xacab.org/pip/miniloom/api.git' +set :deploy_to, '/srv/http/api.lumi.partidopirata.com.ar/deploy' +append :linked_dirs, 'log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'public/system', 'data', '.bundle' +set :bundle_flags, '--deployment' +set :bundle_jobs, 1 +set :bundle_env_variables, { nokogiri_use_system_libraries: 1 } +set :keep_releases, 2 +set :ssh_options, verify_host_key: :always diff --git a/config/deploy/production.rb b/config/deploy/production.rb new file mode 100644 index 0000000..99bd770 --- /dev/null +++ b/config/deploy/production.rb @@ -0,0 +1,59 @@ +# frozen_string_literal: true + +# 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} + +server 'partidopirata.com.ar', user: 'lumi', roles: %w[db web] + +# 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" +# }