Browse Source

Merge branch 'feature/deploy' into develop

* feature/deploy:
  Ignore log dir as generated by capistrano
  Reload the webapp after deploying
  Ensure nested classes are loaded on production in right order
  Use puma in production
  Configure capistrano to run on our app server
  Add capistrano.
tags/0.3.6^2
Bèr Kessels 1 month ago
parent
commit
93ce0a481b

+ 1
- 0
.gitignore View File

@@ -8,6 +8,7 @@
/test/tmp/
/test/version_tmp/
/tmp/
/log/

# Used by dotenv library to load environment variables.
.env

+ 13
- 0
Capfile View File

@@ -0,0 +1,13 @@
# Load DSL and set up stages
require "capistrano/setup"

# Include default deployment tasks
require "capistrano/deploy"

require "capistrano/scm/git"
install_plugin Capistrano::SCM::Git

require "capistrano/bundler"

# Load custom tasks from `lib/capistrano/tasks` if you have any defined
Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r }

+ 5
- 1
Gemfile View File

@@ -17,6 +17,7 @@ gem 'offline_geocoder', path: '../libs/offline_geocoder'
gem 'open-location-code', require: 'plus_code'
gem 'opening_hours_converter', path: '../libs/opening_hours_converter'
gem 'pagy'
gem 'puma'
gem 'rake'
gem 'rgeo-geojson'
gem 'semver'
@@ -41,7 +42,6 @@ group :development, :test do
gem 'minitest'
gem 'minitest-have_tag'
gem 'nokogiri'
gem 'puma' # Used by Capybara to run the web thread
gem 'rack-test'
gem 'rubocop'
gem 'selenium-webdriver'
@@ -52,6 +52,10 @@ group :development, :test do
gem 'better_errors'
gem 'byebug'
gem 'pry'
end

group :development do
gem 'capistrano'
gem 'capistrano-bundler'
gem 'foreman'
end

+ 17
- 0
Gemfile.lock View File

@@ -41,6 +41,8 @@ GEM
tzinfo (~> 1.1)
addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0)
airbrussh (1.4.0)
sshkit (>= 1.6.1, != 1.7.0)
ast (2.4.0)
autoprefixer-rails (9.6.1.1)
execjs
@@ -57,6 +59,13 @@ GEM
sassc-rails (>= 2.0.0)
builder (3.2.3)
byebug (10.0.2)
capistrano (3.14.1)
airbrussh (>= 1.0.0)
i18n
rake (>= 10.0.0)
sshkit (>= 1.9.0)
capistrano-bundler (1.6.0)
capistrano (~> 3.1)
capybara (3.29.0)
addressable
mini_mime (>= 0.1.3)
@@ -115,6 +124,9 @@ GEM
multi_json (1.13.1)
multipart-post (2.1.1)
mustermann (1.0.3)
net-scp (3.0.0)
net-ssh (>= 2.6.5, < 7.0.0)
net-ssh (6.1.0)
nio4r (2.5.2)
nokogiri (1.8.5)
mini_portile2 (~> 2.3.0)
@@ -208,6 +220,9 @@ GEM
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
sshkit (1.21.0)
net-scp (>= 1.1.2)
net-ssh (>= 2.8.0)
therubyracer (0.12.3)
libv8 (~> 3.16.14.15)
ref
@@ -236,6 +251,8 @@ DEPENDENCIES
better_errors
bootstrap (~> 4.3)
byebug
capistrano
capistrano-bundler
capybara
database_cleaner
dotenv (~> 2.6)

+ 1
- 0
app/models/search_result.rb View File

@@ -1,6 +1,7 @@
# frozen_string_literal: true

require_relative 'base.rb'
require_relative 'place.rb'

module Hours
module Models

+ 68
- 0
config/deploy.rb View File

@@ -0,0 +1,68 @@
# config valid for current version and patch releases of Capistrano
lock '~> 3.14.1'

set :application, 'webapp'
set :repo_url, 'ssh://gitea@git.webschuur.com:2222/placebazaar/hours.git'

# Default branch is :master
ask :branch, `git rev-parse --abbrev-ref HEAD`.chomp

# Default deploy_to directory is /var/www/my_app_name
set :deploy_to, "/u/apps/webapp"

# Default value for :format is :airbrussh.
# set :format, :airbrussh

# You can configure the Airbrussh format using :format_options.
# These are the defaults.
# set :format_options, command_output: true, log_file: "log/capistrano.log", color: :auto, truncate: :auto

# Default value for :pty is false
set :pty, true

# Default value for :linked_files is []
# append :linked_files, "config/database.yml"

# Default value for linked_dirs is []
# append :linked_dirs, "log", "tmp/pids", "tmp/cache", "tmp/sockets", "public/system"
append :linked_dirs, '.bundle'

# Default value for default_env is {}
# set :default_env, { path: "/opt/ruby/bin:$PATH" }

# Default value for local_user is ENV['USER']
# set :local_user, -> { `git config user.name`.chomp }

# Default value for keep_releases is 5
# set :keep_releases, 5

# Uncomment the following to require manually verifying the host key before first deploy.
# set :ssh_options, verify_host_key: :secure
#
namespace :systemd do
desc 'Reload service'
task :reload do
on roles(:app) do
systemctl :reload
end
end

desc 'Restart service'
task :restart do
on roles(:app) do
systemctl :restart
end
end
desc 'Show the status of service'
task :status do
on roles(:app) do
systemctl :status
end
end

def systemctl(action)
sudo :systemctl, action, "#{fetch(:application)}.service"
end
end

after 'deploy:publishing', 'systemd:restart'

+ 1
- 0
config/deploy/production.rb View File

@@ -0,0 +1 @@
server "toekomstige.tijden.org", user: "deploy", roles: %w{app web}

BIN
vendor/cache/airbrussh-1.4.0.gem View File


BIN
vendor/cache/capistrano-3.14.1.gem View File


BIN
vendor/cache/capistrano-bundler-1.6.0.gem View File


BIN
vendor/cache/net-scp-3.0.0.gem View File


BIN
vendor/cache/net-ssh-6.1.0.gem View File


BIN
vendor/cache/sshkit-1.21.0.gem View File


Loading…
Cancel
Save