5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-07-03 10:36:07 +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 DeployException < StandardError; end
class DeployTimedOutException < DeployException; end
class DeployAlreadyRunningException < DeployException; end
discard_on ActiveRecord::RecordNotFound
# Lanzar lo antes posible
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
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
# hora original para poder ir haciendo timeouts.
if @site.building?
notify = false
if 10.minutes.ago >= time
notify = false
raise DeployTimedOutException,
"#{@site.name} la tarea estuvo más de 10 minutos esperando, volviendo al estado original"
else
raise DeployAlreadyRunningException
end
DeployJob.perform_in(60, site, notify: notify, time: time, output: output)
return
end
@deployed = {}

View file

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

View file

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

View file

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

View file

@ -15,6 +15,9 @@ es:
ar:
name: Árabe
dir: rtl
ur:
name: Urdu
dir: rtl
zh:
name: Chino
dir: ltr
@ -24,9 +27,6 @@ es:
fr:
name: Francés
dir: ltr
ur:
name: Urdu
dir: rtl
login:
email: Correo electrónico
password: Contraseña
@ -119,6 +119,10 @@ es:
title: Dominio alternativo
success: ¡Éxito!
error: Hubo un error
deploy_distributed_press:
title: Web distribuida
success: ¡Éxito!
error: Hubo un error
deploy_localized_domain:
title: Dominio según idioma
success: ¡Éxito!
@ -135,10 +139,6 @@ es:
title: Sincronizar a otro nodo de Sutty
success: ¡Éxito!
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.
maintenance_mailer:
notice:

View file

@ -4,6 +4,11 @@ check program cleanup
every "0 3 1 * *"
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
with path "/srv/bin/access_logs" as uid "rails" and gid "www-data"
every "0 0 * * *"
@ -14,11 +19,6 @@ check program stats
every "0 1 * * *"
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
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'"