mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-26 17:26:22 +00:00
Merge branch 'issue-13612' into 17.3.alpine.panel.sutty.nl
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
commit
552b6675e0
9 changed files with 30 additions and 27 deletions
1
Gemfile
1
Gemfile
|
@ -36,6 +36,7 @@ gem 'turbolinks', '~> 5'
|
|||
gem 'jbuilder', '~> 2.5'
|
||||
# Use ActiveModel has_secure_password
|
||||
gem 'bcrypt', '~> 3.1.7'
|
||||
gem 'safely_block', '~> 0.3.0'
|
||||
gem 'blazer'
|
||||
gem 'chartkick'
|
||||
gem 'commonmarker'
|
||||
|
|
|
@ -209,7 +209,9 @@ GEM
|
|||
factory_bot_rails (6.2.0)
|
||||
factory_bot (~> 6.2.0)
|
||||
railties (>= 5.0.0)
|
||||
fast_blank (1.0.1)
|
||||
fast_blank (1.0.1-x86_64-linux-musl)
|
||||
fast_jsonparser (0.5.0)
|
||||
fast_jsonparser (0.5.0-x86_64-linux-musl)
|
||||
ffi (1.15.5-x86_64-linux-musl)
|
||||
flamegraph (0.9.5)
|
||||
|
@ -249,7 +251,9 @@ GEM
|
|||
railties (>= 4.0.1)
|
||||
heapy (0.2.0)
|
||||
thor
|
||||
hiredis (0.6.3)
|
||||
hiredis (0.6.3-x86_64-linux-musl)
|
||||
http_parser.rb (0.8.0)
|
||||
http_parser.rb (0.8.0-x86_64-linux-musl)
|
||||
httparty (0.21.0)
|
||||
mini_mime (>= 1.0.0)
|
||||
|
@ -653,8 +657,9 @@ DEPENDENCIES
|
|||
rubyzip
|
||||
rugged
|
||||
safe_yaml
|
||||
safely_block (~> 0.3.0)
|
||||
sassc-rails
|
||||
selenium-webdriver
|
||||
selenium-webdriver (~> 4.8.0)
|
||||
sourcemap
|
||||
spring
|
||||
spring-watcher-listen
|
||||
|
|
8
Makefile
8
Makefile
|
@ -111,19 +111,13 @@ save: ## Subir la imagen Docker al nodo delegado
|
|||
date +%F | xargs -I {} git tag -f $(container)-{}
|
||||
@echo -e "\a"
|
||||
|
||||
ota: assets ## Actualizar Rails en el nodo delegado
|
||||
ota: ## Actualizar Rails en el nodo delegado
|
||||
git push
|
||||
ssh $(delegate) git -C /srv/sutty/srv/http/panel.sutty.nl pull
|
||||
ssh $(delegate) git -C /srv/sutty/srv/http/panel.sutty.nl lfs prune
|
||||
ssh $(delegate) chown -R 1000:82 /srv/sutty/srv/http/panel.sutty.nl
|
||||
ssh $(delegate) docker exec $(container) rails reload
|
||||
|
||||
# Todos los archivos de assets. Si alguno cambia, se van a recompilar
|
||||
# los assets que luego se suben al nodo delegado.
|
||||
assets := package.json yarn.lock $(shell find app/assets/ app/javascript/ -type f)
|
||||
public/packs/manifest.json.br: $(assets)
|
||||
$(hain) 'PANEL_URL=https://panel.sutty.nl RAILS_ENV=production NODE_ENV=production bundle exec rake assets:precompile assets:clean'
|
||||
|
||||
# Correr un test en particular por ejemplo
|
||||
# `make test/models/usuarie_test.rb`
|
||||
tests := $(shell find test/ -name "*_test.rb")
|
||||
|
|
|
@ -5,6 +5,7 @@ class EnvController < ActionController::Base
|
|||
|
||||
def index
|
||||
@site = Site.find_by_name('panel')
|
||||
stale? @site
|
||||
|
||||
stale? @site if @site
|
||||
end
|
||||
end
|
||||
|
|
|
@ -8,8 +8,6 @@ class Site
|
|||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
# TODO: Debería ser un Job?
|
||||
after_create :index_posts!
|
||||
has_many :indexed_posts, dependent: :destroy
|
||||
|
||||
def index_posts!
|
||||
|
|
|
@ -33,6 +33,7 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do
|
|||
add_licencias &&
|
||||
add_code_of_conduct &&
|
||||
add_privacy_policy &&
|
||||
site.index_posts! &&
|
||||
deploy
|
||||
end
|
||||
|
||||
|
|
15
app/views/env/index.js.haml
vendored
15
app/views/env/index.js.haml
vendored
|
@ -1,7 +1,8 @@
|
|||
= cache @site do
|
||||
:plain
|
||||
window.env = {
|
||||
AIRBRAKE_SITE_ID: #{@site.id},
|
||||
AIRBRAKE_API_KEY: "#{@site.airbrake_api_key}",
|
||||
PANEL_URL: "#{ENV['PANEL_URL']}"
|
||||
}
|
||||
- if @site
|
||||
= cache @site do
|
||||
:plain
|
||||
window.env = {
|
||||
AIRBRAKE_SITE_ID: #{@site.id},
|
||||
AIRBRAKE_API_KEY: "#{@site.airbrake_api_key}",
|
||||
PANEL_URL: "#{ENV['PANEL_URL']}"
|
||||
}
|
||||
|
|
|
@ -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.dup || {}))
|
||||
end
|
||||
|
|
18
db/seeds.rb
18
db/seeds.rb
|
@ -16,12 +16,14 @@ licencias.each do |l|
|
|||
licencia.update l
|
||||
end
|
||||
|
||||
unless Rails.env.test?
|
||||
YAML.safe_load(File.read('db/seeds/sites.yml')).each do |site|
|
||||
site = Site.find_or_create_by name: site['name']
|
||||
|
||||
site.update licencia: Licencia.first, design: Design.first,
|
||||
title: site.name, description: 'x' * 50,
|
||||
deploys: site.deploys.empty? ? [DeployLocal.new] : site.deploys
|
||||
if CodeOfConduct.count.zero?
|
||||
YAML.safe_load(File.read('db/seeds/codes_of_conduct.yml')).each do |coc|
|
||||
CodeOfConduct.new(**coc).save!
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if PrivacyPolicy.count.zero?
|
||||
YAML.safe_load(File.read('db/seeds/privacy_policies.yml')).each do |pp|
|
||||
PrivacyPolicy.new(**pp).save!
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue