5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-25 23:16:22 +00:00

Merge branch 'issue-12958' into panel.sutty.nl
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
f 2023-04-10 16:44:59 -03:00
commit 60cbcffac6
6 changed files with 43 additions and 32 deletions

View file

@ -4,11 +4,22 @@
class DeployJob < ApplicationJob class DeployJob < ApplicationJob
class DeployException < StandardError; end class DeployException < StandardError; end
class DeployTimedOutException < DeployException; end class DeployTimedOutException < DeployException; end
class DeployAlreadyRunningException < DeployException; end
discard_on ActiveRecord::RecordNotFound discard_on ActiveRecord::RecordNotFound
# Lanzar lo antes posible # Lanzar lo antes posible
self.priority = 10 self.priority = 10
# Intentar dentro de un minuto
self.retry_interval = 60
def handle_error(error)
case error
when DeployAlreadyRunningException then retry_in 1.minute
when DeployTimedOutException then expire
else super
end
end
# rubocop:disable Metrics/MethodLength # rubocop:disable Metrics/MethodLength
def perform(site, notify: true, time: Time.now, output: false) def perform(site, notify: true, time: Time.now, output: false)
@ -23,14 +34,14 @@ class DeployJob < ApplicationJob
# Como el trabajo actual se aplaza al siguiente, arrastrar la # Como el trabajo actual se aplaza al siguiente, arrastrar la
# hora original para poder ir haciendo timeouts. # hora original para poder ir haciendo timeouts.
if @site.building? if @site.building?
notify = false
if 10.minutes.ago >= time if 10.minutes.ago >= time
notify = false
raise DeployTimedOutException, raise DeployTimedOutException,
"#{@site.name} la tarea estuvo más de 10 minutos esperando, volviendo al estado original" "#{@site.name} la tarea estuvo más de 10 minutos esperando, volviendo al estado original"
else
raise DeployAlreadyRunningException
end end
DeployJob.perform_in(60, site, notify: notify, time: time, output: output)
return
end end
@deployed = {} @deployed = {}

View file

@ -105,10 +105,6 @@ class DeployLocal < Deploy
File.exist? yarn_lock File.exist? yarn_lock
end end
def gem(output: false)
run %(gem install bundler --no-document), output: output
end
def pnpm_lock def pnpm_lock
File.join(site.path, 'pnpm-lock.yaml') File.join(site.path, 'pnpm-lock.yaml')
end end
@ -124,6 +120,10 @@ class DeployLocal < Deploy
run 'pnpm install --production', output: output run 'pnpm install --production', output: output
end end
def gem(output: false)
run %(gem install bundler --no-document), output: output
end
# Corre yarn dentro del repositorio # Corre yarn dentro del repositorio
def yarn(output: false) def yarn(output: false)
return true unless yarn_lock? return true unless yarn_lock?

View file

@ -4,5 +4,5 @@ ActiveJob::Serializers.add_serializers ActiveJob::Serializers::ExceptionSerializ
# Notificar los errores # Notificar los errores
Que.error_notifier = proc do |error, job| Que.error_notifier = proc do |error, job|
ExceptionNotifier.notify_exception(error, data: job) ExceptionNotifier.notify_exception(error, data: (job || {}))
end end

View file

@ -15,6 +15,9 @@ en:
ar: ar:
name: Arabic name: Arabic
dir: rtl dir: rtl
ur:
name: Urdu
dir: rtl
zh: zh:
name: Chinese name: Chinese
dir: ltr dir: ltr
@ -24,9 +27,6 @@ en:
fr: fr:
name: French name: French
dir: ltr dir: ltr
ur:
name: Urdu
dir: rtl
login: login:
email: E-mail address email: E-mail address
password: Password password: Password
@ -119,6 +119,14 @@ en:
title: Alternative domain name title: Alternative domain name
success: Success! success: Success!
error: Error error: Error
deploy_distributed_press:
title: Distributed Web
success: Success!
error: Error
deploy_reindex:
title: Reindex
success: Success!
error: Error
deploy_localized_domain: deploy_localized_domain:
title: Domain name by language title: Domain name by language
success: Success! success: Success!
@ -127,18 +135,10 @@ en:
title: Synchronize to backup server title: Synchronize to backup server
success: Success! success: Success!
error: Error error: Error
deploy_reindex:
title: Reindex
success: Success!
error: Error
deploy_full_rsync: deploy_full_rsync:
title: Synchronize to another Sutty node title: Synchronize to another Sutty node
success: Success! success: Success!
error: Error error: Error
deploy_distributed_press:
title: Distributed Web
success: Success!
error: Error
help: You can contact us by replying to this e-mail help: You can contact us by replying to this e-mail
maintenance_mailer: maintenance_mailer:
notice: notice:

View file

@ -15,6 +15,9 @@ es:
ar: ar:
name: Árabe name: Árabe
dir: rtl dir: rtl
ur:
name: Urdu
dir: rtl
zh: zh:
name: Chino name: Chino
dir: ltr dir: ltr
@ -24,9 +27,6 @@ es:
fr: fr:
name: Francés name: Francés
dir: ltr dir: ltr
ur:
name: Urdu
dir: rtl
login: login:
email: Correo electrónico email: Correo electrónico
password: Contraseña password: Contraseña
@ -119,6 +119,10 @@ es:
title: Dominio alternativo title: Dominio alternativo
success: ¡Éxito! success: ¡Éxito!
error: Hubo un error error: Hubo un error
deploy_distributed_press:
title: Web distribuida
success: ¡Éxito!
error: Hubo un error
deploy_localized_domain: deploy_localized_domain:
title: Dominio según idioma title: Dominio según idioma
success: ¡Éxito! success: ¡Éxito!
@ -135,10 +139,6 @@ es:
title: Sincronizar a otro nodo de Sutty title: Sincronizar a otro nodo de Sutty
success: ¡Éxito! success: ¡Éxito!
error: Hubo un error error: Hubo un error
deploy_distributed_press:
title: Web distribuida
success: ¡Éxito!
error: Hubo un error
help: Por cualquier duda, responde este correo para contactarte con nosotres. help: Por cualquier duda, responde este correo para contactarte con nosotres.
maintenance_mailer: maintenance_mailer:
notice: notice:

View file

@ -4,6 +4,11 @@ check program cleanup
every "0 3 1 * *" every "0 3 1 * *"
if status != 0 then alert if status != 0 then alert
check program distributed_press_tokens_renew
with path "/usr/bin/foreman run -f /srv/Procfile -d /srv distributed_press_tokens_renew" as uid "rails" gid "www-data"
every "0 3 * * *"
if status != 0 then alert
check program access_logs check program access_logs
with path "/srv/bin/access_logs" as uid "rails" and gid "www-data" with path "/srv/bin/access_logs" as uid "rails" and gid "www-data"
every "0 0 * * *" every "0 0 * * *"
@ -14,11 +19,6 @@ check program stats
every "0 1 * * *" every "0 1 * * *"
if status != 0 then alert if status != 0 then alert
check program distributed_press_tokens_renew
with path "/usr/bin/foreman run -f /srv/Procfile -d /srv distributed_press_tokens_renew" as uid "rails" gid "www-data"
every "0 3 * * *"
if status != 0 then alert
check process que with pidfile /srv/tmp/que.pid check process que with pidfile /srv/tmp/que.pid
start program = "/usr/bin/foreman run -f /srv/Procfile -d /srv que" start program = "/usr/bin/foreman run -f /srv/Procfile -d /srv que"
stop program = "/bin/sh -c 'cat /srv/tmp/que.pid | xargs -r kill'" stop program = "/bin/sh -c 'cat /srv/tmp/que.pid | xargs -r kill'"