mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-26 19:36: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'
|
gem 'jbuilder', '~> 2.5'
|
||||||
# Use ActiveModel has_secure_password
|
# Use ActiveModel has_secure_password
|
||||||
gem 'bcrypt', '~> 3.1.7'
|
gem 'bcrypt', '~> 3.1.7'
|
||||||
|
gem 'safely_block', '~> 0.3.0'
|
||||||
gem 'blazer'
|
gem 'blazer'
|
||||||
gem 'chartkick'
|
gem 'chartkick'
|
||||||
gem 'commonmarker'
|
gem 'commonmarker'
|
||||||
|
|
|
@ -209,7 +209,9 @@ GEM
|
||||||
factory_bot_rails (6.2.0)
|
factory_bot_rails (6.2.0)
|
||||||
factory_bot (~> 6.2.0)
|
factory_bot (~> 6.2.0)
|
||||||
railties (>= 5.0.0)
|
railties (>= 5.0.0)
|
||||||
|
fast_blank (1.0.1)
|
||||||
fast_blank (1.0.1-x86_64-linux-musl)
|
fast_blank (1.0.1-x86_64-linux-musl)
|
||||||
|
fast_jsonparser (0.5.0)
|
||||||
fast_jsonparser (0.5.0-x86_64-linux-musl)
|
fast_jsonparser (0.5.0-x86_64-linux-musl)
|
||||||
ffi (1.15.5-x86_64-linux-musl)
|
ffi (1.15.5-x86_64-linux-musl)
|
||||||
flamegraph (0.9.5)
|
flamegraph (0.9.5)
|
||||||
|
@ -249,7 +251,9 @@ GEM
|
||||||
railties (>= 4.0.1)
|
railties (>= 4.0.1)
|
||||||
heapy (0.2.0)
|
heapy (0.2.0)
|
||||||
thor
|
thor
|
||||||
|
hiredis (0.6.3)
|
||||||
hiredis (0.6.3-x86_64-linux-musl)
|
hiredis (0.6.3-x86_64-linux-musl)
|
||||||
|
http_parser.rb (0.8.0)
|
||||||
http_parser.rb (0.8.0-x86_64-linux-musl)
|
http_parser.rb (0.8.0-x86_64-linux-musl)
|
||||||
httparty (0.21.0)
|
httparty (0.21.0)
|
||||||
mini_mime (>= 1.0.0)
|
mini_mime (>= 1.0.0)
|
||||||
|
@ -653,8 +657,9 @@ DEPENDENCIES
|
||||||
rubyzip
|
rubyzip
|
||||||
rugged
|
rugged
|
||||||
safe_yaml
|
safe_yaml
|
||||||
|
safely_block (~> 0.3.0)
|
||||||
sassc-rails
|
sassc-rails
|
||||||
selenium-webdriver
|
selenium-webdriver (~> 4.8.0)
|
||||||
sourcemap
|
sourcemap
|
||||||
spring
|
spring
|
||||||
spring-watcher-listen
|
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)-{}
|
date +%F | xargs -I {} git tag -f $(container)-{}
|
||||||
@echo -e "\a"
|
@echo -e "\a"
|
||||||
|
|
||||||
ota: assets ## Actualizar Rails en el nodo delegado
|
ota: ## Actualizar Rails en el nodo delegado
|
||||||
git push
|
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 pull
|
||||||
ssh $(delegate) git -C /srv/sutty/srv/http/panel.sutty.nl lfs prune
|
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) chown -R 1000:82 /srv/sutty/srv/http/panel.sutty.nl
|
||||||
ssh $(delegate) docker exec $(container) rails reload
|
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
|
# Correr un test en particular por ejemplo
|
||||||
# `make test/models/usuarie_test.rb`
|
# `make test/models/usuarie_test.rb`
|
||||||
tests := $(shell find test/ -name "*_test.rb")
|
tests := $(shell find test/ -name "*_test.rb")
|
||||||
|
|
|
@ -5,6 +5,7 @@ class EnvController < ActionController::Base
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@site = Site.find_by_name('panel')
|
@site = Site.find_by_name('panel')
|
||||||
stale? @site
|
|
||||||
|
stale? @site if @site
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,8 +8,6 @@ class Site
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
included do
|
included do
|
||||||
# TODO: Debería ser un Job?
|
|
||||||
after_create :index_posts!
|
|
||||||
has_many :indexed_posts, dependent: :destroy
|
has_many :indexed_posts, dependent: :destroy
|
||||||
|
|
||||||
def index_posts!
|
def index_posts!
|
||||||
|
|
|
@ -33,6 +33,7 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do
|
||||||
add_licencias &&
|
add_licencias &&
|
||||||
add_code_of_conduct &&
|
add_code_of_conduct &&
|
||||||
add_privacy_policy &&
|
add_privacy_policy &&
|
||||||
|
site.index_posts! &&
|
||||||
deploy
|
deploy
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
3
app/views/env/index.js.haml
vendored
3
app/views/env/index.js.haml
vendored
|
@ -1,4 +1,5 @@
|
||||||
= cache @site do
|
- if @site
|
||||||
|
= cache @site do
|
||||||
:plain
|
:plain
|
||||||
window.env = {
|
window.env = {
|
||||||
AIRBRAKE_SITE_ID: #{@site.id},
|
AIRBRAKE_SITE_ID: #{@site.id},
|
||||||
|
|
|
@ -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.dup || {}))
|
||||||
end
|
end
|
||||||
|
|
16
db/seeds.rb
16
db/seeds.rb
|
@ -16,12 +16,14 @@ licencias.each do |l|
|
||||||
licencia.update l
|
licencia.update l
|
||||||
end
|
end
|
||||||
|
|
||||||
unless Rails.env.test?
|
if CodeOfConduct.count.zero?
|
||||||
YAML.safe_load(File.read('db/seeds/sites.yml')).each do |site|
|
YAML.safe_load(File.read('db/seeds/codes_of_conduct.yml')).each do |coc|
|
||||||
site = Site.find_or_create_by name: site['name']
|
CodeOfConduct.new(**coc).save!
|
||||||
|
end
|
||||||
site.update licencia: Licencia.first, design: Design.first,
|
end
|
||||||
title: site.name, description: 'x' * 50,
|
|
||||||
deploys: site.deploys.empty? ? [DeployLocal.new] : site.deploys
|
if PrivacyPolicy.count.zero?
|
||||||
|
YAML.safe_load(File.read('db/seeds/privacy_policies.yml')).each do |pp|
|
||||||
|
PrivacyPolicy.new(**pp).save!
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue