5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-16 18:26:21 +00:00

Merge branch 'issue-13171' into 'rails'
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed

Issue #13171

See merge request sutty/sutty!177
This commit is contained in:
fauno 2023-05-13 14:35:13 +00:00
commit 5cecb08907
5 changed files with 34 additions and 6 deletions

View file

@ -27,8 +27,4 @@ class DeployFullRsync < DeployRsync
result.present? && result.all?
end
def url
"https://#{user_host.last}/"
end
end

View file

@ -38,6 +38,7 @@ class DeployRsync < Deploy
#
# @return [Boolean]
def ssh?
return true if destination.start_with? 'rsync://'
user, host = user_host
ssh_available = false

View file

@ -15,7 +15,8 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do
add_role temporal: false, rol: 'usuarie'
site.deploys.build type: 'DeployLocal'
sync_nodes
# Los sitios de testing no se sincronizan
sync_nodes unless site.name.end_with? '.testing'
I18n.with_locale(usuarie.lang.to_sym || I18n.default_locale) do
# No se puede llamar a site.config antes de save porque el sitio
@ -215,7 +216,7 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do
# Crea los deploys necesarios para sincronizar a otros nodos de Sutty
def sync_nodes
Rails.application.nodes.each do |node|
site.deploys.build(type: 'DeployFullRsync', destination: "sutty@#{node}:")
site.deploys.build(type: 'DeployFullRsync', destination: "rsync://rsyncd.#{node}/deploys/", hostname: node)
end
end

View file

@ -0,0 +1,22 @@
# frozen_string_literal: true
# Envía los cambios a través de rsyncd
class ChangeFullRsyncDestination < ActiveRecord::Migration[6.1]
def up
DeployFullRsync.find_each do |deploy|
Rails.application.nodes.each do |node|
deploy.destination = "rsync://rsyncd.#{node}/deploys/"
deploy.save
end
end
end
def down
DeployFullRsync.find_each do |deploy|
Rails.application.nodes.each do |node|
deploy.destination = "sutty@#{node}:"
deploy.save
end
end
end
end

View file

@ -0,0 +1,8 @@
# frozen_string_literal: true
# Agrega la columna de nodo a los logs
class AddNodeToAccessLogs < ActiveRecord::Migration[6.1]
def change
add_column :access_logs, :node, :string, index: true
end
end