mirror of
https://0xacab.org/sutty/sutty
synced 2025-02-21 11:01:47 +00:00
feat: crear temporalmente los dominios en njalla
el problema es que no podemos delegar `_dnslink.*.sutty.nl` hacia distributed press, con lo que es necesario crear un subdominio por cada sitio que lo active.
This commit is contained in:
parent
7ff284d547
commit
3f7b2484d0
4 changed files with 30 additions and 0 deletions
1
Gemfile
1
Gemfile
|
@ -39,6 +39,7 @@ gem 'devise'
|
||||||
gem 'devise-i18n'
|
gem 'devise-i18n'
|
||||||
gem 'devise_invitable'
|
gem 'devise_invitable'
|
||||||
gem 'distributed-press-api-client', '~> 0.2.2'
|
gem 'distributed-press-api-client', '~> 0.2.2'
|
||||||
|
gem 'njalla-api-client'
|
||||||
gem 'email_address', git: 'https://github.com/fauno/email_address', branch: 'i18n'
|
gem 'email_address', git: 'https://github.com/fauno/email_address', branch: 'i18n'
|
||||||
gem 'exception_notification'
|
gem 'exception_notification'
|
||||||
gem 'fast_blank'
|
gem 'fast_blank'
|
||||||
|
|
|
@ -419,6 +419,9 @@ GEM
|
||||||
nokogiri (1.12.5-x86_64-linux-musl)
|
nokogiri (1.12.5-x86_64-linux-musl)
|
||||||
mini_portile2 (~> 2.6.1)
|
mini_portile2 (~> 2.6.1)
|
||||||
racc (~> 1.4)
|
racc (~> 1.4)
|
||||||
|
njalla-api-client (0.1.0)
|
||||||
|
dry-schema
|
||||||
|
httparty (~> 0.18)
|
||||||
orm_adapter (0.5.0)
|
orm_adapter (0.5.0)
|
||||||
parallel (1.21.0)
|
parallel (1.21.0)
|
||||||
parser (3.0.2.0)
|
parser (3.0.2.0)
|
||||||
|
@ -741,6 +744,7 @@ DEPENDENCIES
|
||||||
minima
|
minima
|
||||||
mobility
|
mobility
|
||||||
net-ssh
|
net-ssh
|
||||||
|
njalla-api-client
|
||||||
nokogiri
|
nokogiri
|
||||||
pg
|
pg
|
||||||
pg_search
|
pg_search
|
||||||
|
|
|
@ -111,6 +111,12 @@ class DeployDistributedPress < Deploy
|
||||||
self.remote_site_id = created_site[:id]
|
self.remote_site_id = created_site[:id]
|
||||||
self.remote_info = created_site.to_h
|
self.remote_info = created_site.to_h
|
||||||
|
|
||||||
|
# XXX: Esto depende de nuestro DNS actual, cuando lo migremos hay
|
||||||
|
# que eliminarlo.
|
||||||
|
self.remote_info['njalla'] = {}
|
||||||
|
self.remote_info['njalla']['a'] = njalla.add_record(name: site.name, type: 'CNAME', content: "#{Site.domain}.").to_h
|
||||||
|
self.remote_info['njalla']['ns'] = njalla.add_record(name: "_dnslink.#{site.name}", type: 'NS', content: "#{publisher.hostname}.").to_h
|
||||||
|
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -123,4 +129,16 @@ class DeployDistributedPress < Deploy
|
||||||
build_stats.create action: publisher.to_s,log: log, seconds: time_spent_in_seconds, bytes: size, status: status
|
build_stats.create action: publisher.to_s,log: log, seconds: time_spent_in_seconds, bytes: size, status: status
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Actualizar registros en Njalla
|
||||||
|
#
|
||||||
|
# @return [Njalla::V1::Domain]
|
||||||
|
def njalla
|
||||||
|
@njalla ||=
|
||||||
|
begin
|
||||||
|
client = Njalla::V1::Client.new(token: ENV['NJALLA_TOKEN'])
|
||||||
|
|
||||||
|
Njalla::V1::Domain.new(domain: Site.domain, client: client)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -40,6 +40,13 @@ class DistributedPressPublisher < ApplicationRecord
|
||||||
"Distributed Press <#{instance}>"
|
"Distributed Press <#{instance}>"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Devuelve el hostname de la instancia
|
||||||
|
#
|
||||||
|
# @return [String]
|
||||||
|
def hostname
|
||||||
|
@hostname ||= URI.parse(instance).hostname
|
||||||
|
end
|
||||||
|
|
||||||
# @return [Logger]
|
# @return [Logger]
|
||||||
def logger
|
def logger
|
||||||
@logger ||=
|
@logger ||=
|
||||||
|
|
Loading…
Reference in a new issue