mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-22 09:46:22 +00:00
Merge branch 'issue-14944' into 'rails'
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
entorno de trabajo funcional See merge request sutty/sutty!235
This commit is contained in:
commit
012e8f0f19
60 changed files with 1793 additions and 1402 deletions
|
@ -1,8 +1,8 @@
|
|||
NODE_OPTIONS=--openssl-legacy-provider
|
||||
# pwgen -1 32
|
||||
RAILS_MASTER_KEY=11111111111111111111111111111111
|
||||
RAILS_GROUPS=assets
|
||||
DELEGATE=athshe.sutty.nl
|
||||
HAINISH=../haini.sh/haini.sh
|
||||
DELEGATE=panel.sutty.nl
|
||||
DATABASE_URL=postgres://suttier@postgresql.sutty.local/sutty
|
||||
RAILS_ENV=development
|
||||
IMAP_SERVER=
|
||||
|
@ -37,3 +37,5 @@ AIRBRAKE_API_KEY=
|
|||
GITLAB_URI=https://0xacab.org
|
||||
GITLAB_PROJECT=
|
||||
GITLAB_TOKEN=
|
||||
PGVER=15
|
||||
PGPID=/run/postgresql.pid
|
1
.env.development
Normal file
1
.env.development
Normal file
|
@ -0,0 +1 @@
|
|||
HAINISH=../haini.sh/haini.sh
|
6
.gitignore
vendored
6
.gitignore
vendored
|
@ -28,7 +28,7 @@
|
|||
/data/*
|
||||
/_storage/*
|
||||
|
||||
.env*
|
||||
.env.*
|
||||
|
||||
# Ignore master key for decrypting credentials and more.
|
||||
/config/master.key
|
||||
|
@ -48,3 +48,7 @@ yarn-debug.log*
|
|||
/yarn-error.log
|
||||
yarn-debug.log*
|
||||
.yarn-integrity
|
||||
|
||||
/.task
|
||||
/.yardoc
|
||||
/public/doc/
|
||||
|
|
103
.gitlab-ci.yml
103
.gitlab-ci.yml
|
@ -1,33 +1,96 @@
|
|||
image: "gitea.nulo.in/sutty/panel:3.14.10-2.7.8-panel.sutty.nl"
|
||||
.apk-add: &apk-add
|
||||
- "apk add go-task diffutils"
|
||||
.disable-hainish: &disable-hainish
|
||||
- "rm -f .env.development"
|
||||
.cache-ruby: &cache-ruby
|
||||
- paths:
|
||||
- "vendor/ruby"
|
||||
.cache-node: &cache-node
|
||||
- paths:
|
||||
- "node_modules"
|
||||
.cache-task: &cache-task
|
||||
- paths:
|
||||
- ".task"
|
||||
image: "registry.0xacab.org/sutty/sutty:3.17.3-3.1.4-rails"
|
||||
variables:
|
||||
RAILS_ENV: "production"
|
||||
LC_ALL: "C.UTF-8"
|
||||
HAINISH: ""
|
||||
cache:
|
||||
paths:
|
||||
- "vendor/ruby"
|
||||
assets:
|
||||
stage: "build"
|
||||
rules:
|
||||
- if: "$CI_COMMIT_BRANCH == \"panel.sutty.nl\""
|
||||
- if: "$CI_COMMIT_BRANCH"
|
||||
changes:
|
||||
compare_to: "refs/heads/rails"
|
||||
paths:
|
||||
- "package.json"
|
||||
- "app/javascript/**/*"
|
||||
- "app/assets/**/*"
|
||||
stage: "deploy"
|
||||
only:
|
||||
- "rails"
|
||||
cache:
|
||||
- *cache-ruby
|
||||
- *cache-node
|
||||
- *cache-task
|
||||
before_script:
|
||||
- "git config --global user.email \"${GIT_USER_EMAIL:-$GITLAB_USER_EMAIL}\""
|
||||
- "git config --global user.name \"${GIT_USER_NAME:-$GITLAB_USER_NAME}\""
|
||||
- "git remote set-url --push origin \"https://${GITLAB_USERNAME}:${GITLAB_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git\""
|
||||
- "apk add python2 dotenv brotli"
|
||||
- "mv config/credentials.yml.enc.ci config/credentials.yml.enc"
|
||||
- "cp .env.example .env"
|
||||
- "dotenv bundle install --path=vendor"
|
||||
- "apk add brotli"
|
||||
- *apk-add
|
||||
- *disable-hainish
|
||||
script:
|
||||
- "dotenv RAILS_ENV=production bundle exec rails webpacker:clobber"
|
||||
- "dotenv RAILS_ENV=production bundle exec rails assets:precompile"
|
||||
- "dotenv RAILS_ENV=production bundle exec rails assets:clean"
|
||||
- "go-task assets"
|
||||
after_script:
|
||||
- "git add public && git commit -m \"ci: assets [skip ci]\""
|
||||
- "git push -o ci.skip"
|
||||
gem-audit:
|
||||
stage: "test"
|
||||
only:
|
||||
- "schedules"
|
||||
cache:
|
||||
- *cache-ruby
|
||||
before_script:
|
||||
- "gem install bundler-audit"
|
||||
- *apk-add
|
||||
- *disable-hainish
|
||||
script:
|
||||
- "go-task gem-audit"
|
||||
node-audit:
|
||||
stage: "test"
|
||||
only:
|
||||
- "schedules"
|
||||
cache:
|
||||
- *cache-node
|
||||
before_script:
|
||||
- *apk-add
|
||||
- *disable-hainish
|
||||
script:
|
||||
- "apk add go-task"
|
||||
- "go-task node-audit"
|
||||
brakeman:
|
||||
stage: "test"
|
||||
cache:
|
||||
- *cache-ruby
|
||||
rules:
|
||||
- if: "$CI_PIPELINE_SOURCE == 'merge_request_event'"
|
||||
before_script:
|
||||
- *apk-add
|
||||
- *disable-hainish
|
||||
script:
|
||||
- "go-task bundle -- exec brakeman"
|
||||
rubocop:
|
||||
stage: "test"
|
||||
cache:
|
||||
- *cache-ruby
|
||||
rules:
|
||||
- if: "$CI_PIPELINE_SOURCE == 'merge_request_event'"
|
||||
before_script:
|
||||
- *apk-add
|
||||
- *disable-hainish
|
||||
script:
|
||||
- "./bin/modified_files | ./bin/with_extension rb | xargs -r go-task bundle -- exec rubocop"
|
||||
haml:
|
||||
stage: "test"
|
||||
cache:
|
||||
- *cache-ruby
|
||||
rules:
|
||||
- if: "$CI_PIPELINE_SOURCE == 'merge_request_event'"
|
||||
before_script:
|
||||
- *apk-add
|
||||
- *disable-hainish
|
||||
script:
|
||||
- "./bin/modified_files | ./bin/with_extension haml | xargs -r go-task bundle -- exec haml-lint"
|
||||
|
|
|
@ -19,7 +19,6 @@ pipeline:
|
|||
when:
|
||||
branch:
|
||||
- "rails"
|
||||
- "panel.sutty.nl"
|
||||
- "17.3.alpine.panel.sutty.nl"
|
||||
event: "push"
|
||||
path:
|
||||
|
@ -27,57 +26,8 @@ pipeline:
|
|||
- "Dockerfile"
|
||||
- ".dockerignore"
|
||||
- ".woodpecker.yml"
|
||||
assets:
|
||||
image: "gitea.nulo.in/sutty/panel:3.14.10-2.7.8"
|
||||
commands:
|
||||
- "apk add python2 dotenv openssh-client brotli"
|
||||
- "install -d -m 700 ~/.ssh/"
|
||||
- "echo \"$${KNOWN_HOSTS}\" | base64 -d >> ~/.ssh/known_hosts"
|
||||
- "chmod 600 ~/.ssh/known_hosts"
|
||||
- "eval $(ssh-agent -s)"
|
||||
- "echo \"$${SSH_KEY}\" | base64 -d | ssh-add -"
|
||||
- "ssh $${ORIGIN%:*}"
|
||||
- "git config user.name Woodpecker"
|
||||
- "git config user.email ci@sutty.coop.ar"
|
||||
- "git remote add upstream $${ORIGIN}"
|
||||
- "git checkout -B ${CI_COMMIT_BRANCH}"
|
||||
- "mv config/credentials.yml.enc.ci config/credentials.yml.enc"
|
||||
- "yarn"
|
||||
- "cp .env.example .env"
|
||||
- "dotenv bundle install --path=vendor"
|
||||
- "dotenv RAILS_ENV=production bundle exec rails webpacker:clobber"
|
||||
- "dotenv RAILS_ENV=production bundle exec rails assets:precompile"
|
||||
- "dotenv RAILS_ENV=production bundle exec rails assets:clean"
|
||||
- "find public -type f -print0 | xargs -r0 brotli -k9f"
|
||||
- "git add public && git commit -m \"ci: assets [skip ci]\""
|
||||
- "git pull upstream ${CI_COMMIT_BRANCH}"
|
||||
- "git push upstream ${CI_COMMIT_BRANCH}"
|
||||
environment:
|
||||
- "RUBY_VERSION=${RUBY_VERSION}"
|
||||
- "GEMS_SOURCE=https://14.3.alpine.gems.sutty.nl"
|
||||
secrets:
|
||||
- "SSH_KEY"
|
||||
- "KNOWN_HOSTS"
|
||||
- "ORIGIN"
|
||||
when:
|
||||
branch:
|
||||
- "rails"
|
||||
- "panel.sutty.nl"
|
||||
path:
|
||||
include:
|
||||
- "app/assets/**/*"
|
||||
- "app/javascript/**/*"
|
||||
- "package.json"
|
||||
- "yarn.lock"
|
||||
matrix:
|
||||
ALPINE_VERSION: "3.14.10"
|
||||
RUBY_VERSION: "2.7"
|
||||
RUBY_PATCH: "8"
|
||||
matrix:
|
||||
include:
|
||||
- ALPINE_VERSION: "3.17.3"
|
||||
RUBY_VERSION: "3.1"
|
||||
RUBY_PATCH: "4"
|
||||
- ALPINE_VERSION: "3.14.10"
|
||||
RUBY_VERSION: "2.7"
|
||||
RUBY_PATCH: "8"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
ARG RUBY_VERSION=2.7
|
||||
ARG RUBY_PATCH=6
|
||||
ARG ALPINE_VERSION=3.13.10
|
||||
ARG RUBY_VERSION=3.1
|
||||
ARG RUBY_PATCH=4
|
||||
ARG ALPINE_VERSION=3.17.3
|
||||
ARG BASE_IMAGE=registry.nulo.in/sutty/rails
|
||||
FROM ${BASE_IMAGE}:${ALPINE_VERSION}-${RUBY_VERSION}.${RUBY_PATCH}
|
||||
ARG PANDOC_VERSION=2.18
|
||||
|
|
4
Gemfile
4
Gemfile
|
@ -4,8 +4,6 @@ source ENV.fetch('GEMS_SOURCE', 'https://17.3.alpine.gems.sutty.nl')
|
|||
|
||||
ruby "~> #{ENV.fetch('RUBY_VERSION', '3.1')}"
|
||||
|
||||
gem 'dotenv-rails', require: 'dotenv/rails-now'
|
||||
|
||||
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
||||
gem 'rails', '~> 6.1.0'
|
||||
# Use Puma as the app server
|
||||
|
@ -108,6 +106,7 @@ end
|
|||
|
||||
group :development, :test do
|
||||
gem 'derailed_benchmarks'
|
||||
gem 'dotenv-rails'
|
||||
gem 'pry'
|
||||
# Adds support for Capybara system testing and selenium driver
|
||||
gem 'capybara', '~> 2.13'
|
||||
|
@ -116,6 +115,7 @@ group :development, :test do
|
|||
end
|
||||
|
||||
group :development do
|
||||
gem 'yard'
|
||||
gem 'brakeman'
|
||||
gem 'haml-lint', require: false
|
||||
gem 'letter_opener'
|
||||
|
|
|
@ -574,6 +574,7 @@ GEM
|
|||
websocket-extensions (0.1.5)
|
||||
xpath (3.2.0)
|
||||
nokogiri (~> 1.8)
|
||||
yard (0.9.34)
|
||||
zeitwerk (2.6.8)
|
||||
|
||||
PLATFORMS
|
||||
|
@ -669,6 +670,7 @@ DEPENDENCIES
|
|||
web-console
|
||||
webpacker
|
||||
yaml_db!
|
||||
yard
|
||||
|
||||
RUBY VERSION
|
||||
ruby 3.1.4p223
|
||||
|
|
140
Makefile
140
Makefile
|
@ -1,140 +0,0 @@
|
|||
SHELL := /bin/bash
|
||||
.DEFAULT_GOAL := help
|
||||
|
||||
# Copiar el archivo de configuración y avisar cuando hay que
|
||||
# actualizarlo.
|
||||
.env: .env.example
|
||||
@test -f $@ || cp -v $< $@
|
||||
@test -f $@ && echo "Revisa $@ para actualizarlo con respecto a $<"
|
||||
@test -f $@ && diff -auN --color $@ $<
|
||||
|
||||
include .env
|
||||
|
||||
export
|
||||
|
||||
# XXX: El espacio antes del comentario cuenta como espacio
|
||||
args ?=## Argumentos para Hain
|
||||
commit ?= origin/rails## Commit desde el que actualizar
|
||||
env ?= staging## Entorno del nodo delegado
|
||||
sutty ?= $(SUTTY)## Dirección local
|
||||
delegate ?= $(DELEGATE)## Cambia el nodo delegado
|
||||
hain ?= ENV_FILE=.env $(HAINISH)## Ubicación de Hainish
|
||||
|
||||
# El nodo delegado tiene dos entornos, production y staging.
|
||||
# Dependiendo del entorno que elijamos, se van a generar los assets y el
|
||||
# contenedor y subirse a un servidor u otro. No utilizamos CI/CD (aún).
|
||||
#
|
||||
# Production es el entorno de panel.sutty.nl
|
||||
ifeq ($(env),production)
|
||||
container ?= panel
|
||||
## TODO: Cambiar a otra cosa
|
||||
branch ?= rails
|
||||
public ?= public
|
||||
endif
|
||||
|
||||
# Staging es el entorno de panel.staging.sutty.nl
|
||||
ifeq ($(env),staging)
|
||||
container := staging
|
||||
branch := staging
|
||||
public := staging
|
||||
endif
|
||||
|
||||
help: always ## Ayuda
|
||||
@echo -e "Sutty\n" | sed -re "s/^.*/\x1B[38;5;197m&\x1B[0m/"
|
||||
@echo -e "Servidor: https://panel.$(SUTTY_WITH_PORT)/\n"
|
||||
@echo -e "Uso: make TAREA args=\"ARGUMENTOS\"\n"
|
||||
@echo -e "Tareas:\n"
|
||||
@grep -E "^[a-z\-]+:.*##" Makefile | sed -re "s/(.*):.*##(.*)/\1;\2/" | column -s ";" -t | sed -re "s/^([^ ]+) /\x1B[38;5;197m\1\x1B[0m/"
|
||||
@echo -e "\nArgumentos:\n"
|
||||
@grep -E "^[a-z\-]+ \?=.*##" Makefile | sed -re "s/(.*) \?=.*##(.*)/\1;\2/" | column -s ";" -t | sed -re "s/^([^ ]+) /\x1B[38;5;197m\1\x1B[0m/"
|
||||
|
||||
test: always ## Ejecutar los tests
|
||||
$(MAKE) rake args="test RAILS_ENV=test $(args)"
|
||||
|
||||
postgresql: /etc/hosts ## Iniciar la base de datos
|
||||
pgrep postgres >/dev/null || $(hain) postgresql
|
||||
|
||||
serve-js: /etc/hosts node_modules ## Iniciar el servidor de desarrollo de Javascript
|
||||
$(hain) 'bundle exec ./bin/webpack-dev-server'
|
||||
|
||||
serve: /etc/hosts postgresql Gemfile.lock ## Iniciar el servidor de desarrollo de Rails
|
||||
$(MAKE) rails args=server
|
||||
|
||||
rails: ## Corre rails dentro del entorno de desarrollo (pasar argumentos con args=).
|
||||
$(MAKE) bundle args="exec rails $(args)"
|
||||
|
||||
rake: ## Corre rake dentro del entorno de desarrollo (pasar argumentos con args=).
|
||||
$(MAKE) bundle args="exec rake $(args)"
|
||||
|
||||
bundle: ## Corre bundle dentro del entorno de desarrollo (pasar argumentos con args=).
|
||||
$(hain) 'bundle $(args)'
|
||||
|
||||
psql := psql $(DATABASE_URL)
|
||||
copy-table:
|
||||
test -n "$(table)"
|
||||
echo "truncate $(table) $(cascade);" | $(psql)
|
||||
ssh $(delegate) docker exec postgresql pg_dump -U sutty -d sutty -t $(table) | $(psql)
|
||||
|
||||
psql:
|
||||
$(hain) $(psql)
|
||||
|
||||
rubocop: ## Yutea el código que está por ser commiteado
|
||||
git status --porcelain \
|
||||
| grep -E "^(A|M)" \
|
||||
| sed "s/^...//" \
|
||||
| grep ".rb$$" \
|
||||
| ../haini.sh/haini.sh "xargs -r ./bin/rubocop --auto-correct"
|
||||
|
||||
audit: ## Encuentra dependencias con vulnerabilidades
|
||||
$(hain) 'gem install bundler-audit'
|
||||
$(hain) 'bundle audit --update'
|
||||
|
||||
brakeman: ## Busca posibles vulnerabilidades en Sutty
|
||||
$(MAKE) bundle args='exec brakeman'
|
||||
|
||||
yarn: ## Tareas de yarn
|
||||
$(hain) 'yarn $(args)'
|
||||
|
||||
clean: ## Limpieza
|
||||
rm -rf _sites/test-* _deploy/test-* log/*.log tmp/cache tmp/letter_opener tmp/miniprofiler tmp/storage
|
||||
|
||||
build: Gemfile.lock ## Generar la imagen Docker
|
||||
time docker build --build-arg="BRANCH=$(branch)" --build-arg="RAILS_MASTER_KEY=`cat config/master.key`" -t sutty/$(container) .
|
||||
docker tag sutty/$(container):latest sutty:keep
|
||||
@echo -e "\a"
|
||||
|
||||
save: ## Subir la imagen Docker al nodo delegado
|
||||
time docker save sutty/$(container):latest | ssh root@$(delegate) docker load
|
||||
date +%F | xargs -I {} git tag -f $(container)-{}
|
||||
@echo -e "\a"
|
||||
|
||||
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
|
||||
|
||||
# Correr un test en particular por ejemplo
|
||||
# `make test/models/usuarie_test.rb`
|
||||
tests := $(shell find test/ -name "*_test.rb")
|
||||
$(tests): always
|
||||
$(MAKE) test args="TEST=$@"
|
||||
|
||||
# Agrega las direcciones locales al sistema
|
||||
/etc/hosts: always
|
||||
@echo "Chequeando si es necesario agregar el dominio local $(SUTTY)"
|
||||
@grep -q " $(SUTTY)$$" $@ || echo -e "127.0.0.1 $(SUTTY)\n::1 $(SUTTY)" | sudo tee -a $@
|
||||
@grep -q " api.$(SUTTY)$$" $@ || echo -e "127.0.0.1 api.$(SUTTY)\n::1 api.$(SUTTY)" | sudo tee -a $@
|
||||
@grep -q " panel.$(SUTTY)$$" $@ || echo -e "127.0.0.1 panel.$(SUTTY)\n::1 panel.$(SUTTY)" | sudo tee -a $@
|
||||
@grep -q " postgresql.$(SUTTY)$$" $@ || echo -e "127.0.0.1 postgresql.$(SUTTY)\n::1 postgresql.$(SUTTY)" | sudo tee -a $@
|
||||
|
||||
# Instala las dependencias de Javascript
|
||||
node_modules: package.json
|
||||
$(MAKE) yarn
|
||||
|
||||
# Instala las dependencias de Rails
|
||||
Gemfile.lock: Gemfile
|
||||
$(MAKE) bundle args=install
|
||||
|
||||
.PHONY: always
|
51
README.md
51
README.md
|
@ -17,14 +17,32 @@ Para más información visita el [sitio de Sutty](https://sutty.nl/).
|
|||
|
||||
### Desarrollar
|
||||
|
||||
Todas las tareas se gestionan con `make`, por favor instala GNU Make
|
||||
antes de comenzar.
|
||||
Para facilitar la gestión de dependencias y entorno de desarrollo,
|
||||
instala [haini.sh](https://0xacab.org/sutty/haini.sh)
|
||||
|
||||
|
||||
Todas las tareas se gestionan con `go-task`. [Instrucciones de
|
||||
instalación (en inglés)](https://taskfile.dev/installation/)
|
||||
|
||||
```bash
|
||||
make help
|
||||
go-task
|
||||
```
|
||||
|
||||
[Leer la documentación](https://docs.sutty.nl/)
|
||||
### Variables de entorno
|
||||
|
||||
Las variables de entorno por defecto se encuentran en el archivo `.env`.
|
||||
Para modificar las opciones, crear o modificar el archivo `.env.local`
|
||||
con valores distintos.
|
||||
|
||||
### Documentación
|
||||
|
||||
Para navegar la documentación del código usando YARD:
|
||||
|
||||
```bash
|
||||
go-task doc serve
|
||||
```
|
||||
|
||||
Y luego navegar a <https://panel.sutty.local:3000/doc/>
|
||||
|
||||
## English
|
||||
|
||||
|
@ -39,10 +57,29 @@ For more information, visit [Sutty's website](https://sutty.nl/en/).
|
|||
|
||||
### Development
|
||||
|
||||
Every task is run via `make`, please install GNU Make before developing.
|
||||
|
||||
To facilitate dependencies and dev environment, install
|
||||
[haini.sh](https://0xacab.org/sutty/haini.sh)
|
||||
|
||||
Every task is run via `go-task`. [Installation
|
||||
instructions](https://taskfile.dev/installation/).
|
||||
|
||||
```bash
|
||||
make help
|
||||
go-task
|
||||
```
|
||||
|
||||
[Read the documentation](https://docs.sutty.nl/en/)
|
||||
### Environment variables
|
||||
|
||||
Default env vars are store on `.env`. For local options, copy them to
|
||||
`.env.local`.
|
||||
|
||||
### Documentation
|
||||
|
||||
To browse documentation using YARD:
|
||||
|
||||
```bash
|
||||
go-task doc serve
|
||||
```
|
||||
|
||||
And then open <https://panel.sutty.local:3000/doc/>
|
||||
|
||||
|
|
182
Taskfile.yaml
Normal file
182
Taskfile.yaml
Normal file
|
@ -0,0 +1,182 @@
|
|||
---
|
||||
version: "3"
|
||||
vars:
|
||||
CURRENT_BRANCH:
|
||||
sh: "git rev-parse --abbrev-ref HEAD"
|
||||
shopt:
|
||||
- "globstar"
|
||||
dotenv:
|
||||
- ".env.development"
|
||||
- ".env"
|
||||
- ".env.local"
|
||||
- ".env.development.local"
|
||||
tasks:
|
||||
credentials:
|
||||
desc: "Generate credentials file"
|
||||
cmds:
|
||||
- "cp --no-clobber config/credentials.yml.enc.ci config/credentials.yml.enc"
|
||||
sources:
|
||||
- "config/credentials.yml.enc.ci"
|
||||
generates:
|
||||
- "config/credentials.yml.enc"
|
||||
gems:
|
||||
desc: "Install gems"
|
||||
deps:
|
||||
- "credentials"
|
||||
cmds:
|
||||
- task: "bundle"
|
||||
sources:
|
||||
- "Gemfile"
|
||||
generates:
|
||||
- "Gemfile.lock"
|
||||
clean:
|
||||
desc: "Clean"
|
||||
cmds:
|
||||
- "rm -rf _sites/test-* _deploy/test-* log/*.log tmp/cache tmp/letter_opener tmp/miniprofiler tmp/storage"
|
||||
node-modules:
|
||||
desc: "Install Node modules"
|
||||
cmds:
|
||||
- "{{.HAINISH}} yarn"
|
||||
sources:
|
||||
- "package.json"
|
||||
- "yarn.lock"
|
||||
status:
|
||||
- "test -d node_modules"
|
||||
assets:
|
||||
desc: "Generate assets"
|
||||
deps:
|
||||
- "node-modules"
|
||||
- "gems"
|
||||
cmds:
|
||||
- "git lfs fetch"
|
||||
- "git lfs checkout"
|
||||
- task: "rails"
|
||||
vars:
|
||||
CLI_ARGS: "webpacker:clobber RAILS_ENV=production"
|
||||
- task: "rails"
|
||||
vars:
|
||||
CLI_ARGS: "assets:precompile RAILS_ENV=production"
|
||||
- task: "rails"
|
||||
vars:
|
||||
CLI_ARGS: "assets:clean RAILS_ENV=production"
|
||||
sources:
|
||||
- "package.json"
|
||||
- "yarn.lock"
|
||||
- "app/assets/**/*"
|
||||
- "app/javascript/**/*"
|
||||
generates:
|
||||
- "public/packs/manifest.json"
|
||||
hosts:
|
||||
desc: "Local DNS resolution for hostnames"
|
||||
interactive: true
|
||||
cmds:
|
||||
- "echo -e \"127.0.0.1 panel.{{.SUTTY}} api.{{.SUTTY}} postgresql.{{.SUTTY}}\" | sudo tee -a /etc/hosts"
|
||||
- "echo -e \"::1 panel.{{.SUTTY}} api.{{.SUTTY}} postgresql.{{.SUTTY}}\" | sudo tee -a /etc/hosts"
|
||||
status:
|
||||
- "grep -q \" panel.{{.SUTTY}} \" /etc/hosts"
|
||||
database-init:
|
||||
desc: "Database install"
|
||||
cmds:
|
||||
- "{{.HAINISH}} /usr/bin/initdb --locale en_US.utf8 -E UTF8 -D /var/lib/postgresql/{{.PGVER}}/data"
|
||||
- "echo \"host all all samenet trust\" >> ../hain/var/lib/postgresql/{{.PGVER}}/data/pg_hba.conf"
|
||||
- "echo \"listen_addresses = '*'\" >> ../hain/var/lib/postgresql/{{.PGVER}}/data/postgresql.conf"
|
||||
- "echo \"external_pid_file = '{{.PGPID}}'\" >> ../hain/var/lib/postgresql/{{.PGVER}}/data/postgresql.conf"
|
||||
- "install -dm755 ../hain/run/postgresql"
|
||||
status:
|
||||
- "test -d ../hain/var/lib/postgresql/{{.PGVER}}/data"
|
||||
- "test -f ../hain/var/lib/postgresql/{{.PGVER}}/data/postgresql.conf"
|
||||
database:
|
||||
desc: "Database"
|
||||
deps:
|
||||
- "database-init"
|
||||
cmds:
|
||||
- "{{.HAINISH}} daemonize -c /var/lib/postgresql/{{.PGVER}}/data /usr/bin/postgres -D /var/lib/postgresql/{{.PGVER}}/data"
|
||||
status:
|
||||
- "test -f ../hain{{.PGPID}}"
|
||||
- "pgrep -F ../hain{{.PGPID}}"
|
||||
prepare:
|
||||
desc: "Create database or run pending migrations"
|
||||
deps:
|
||||
- "database"
|
||||
cmds:
|
||||
- task: "rails"
|
||||
vars:
|
||||
CLI_ARGS: "db:prepare"
|
||||
serve:
|
||||
desc: "Run Rails development server"
|
||||
deps:
|
||||
- "prepare"
|
||||
- "gems"
|
||||
cmds:
|
||||
- ": == Development server running at https://panel.{{.SUTTY_WITH_PORT}} =="
|
||||
- task: "rails"
|
||||
vars:
|
||||
CLI_ARGS: "server"
|
||||
status:
|
||||
- "test -f tmp/pids/server.pid"
|
||||
- "pgrep -F tmp/pids/server.pid"
|
||||
yarn:
|
||||
desc: "Yarn. Call with: go-task yarn -- arguments"
|
||||
deps:
|
||||
- "node-modules"
|
||||
cmds:
|
||||
- "{{.HAINISH}} yarn {{.CLI_ARGS}}"
|
||||
- defer:
|
||||
task: "notify"
|
||||
bundle:
|
||||
desc: "Bundle. Call with: go-task bundle -- arguments"
|
||||
interactive: true
|
||||
deps:
|
||||
- "gems"
|
||||
cmds:
|
||||
- "{{.HAINISH}} bundle {{.CLI_ARGS}}"
|
||||
- defer:
|
||||
task: "notify"
|
||||
rails:
|
||||
desc: "Rails. Call with: go-task rails -- arguments"
|
||||
cmds:
|
||||
- task: "bundle"
|
||||
vars:
|
||||
CLI_ARGS: "exec rails {{.CLI_ARGS}}"
|
||||
console:
|
||||
desc: "Rails console"
|
||||
interactive: true
|
||||
cmds:
|
||||
- task: "rails"
|
||||
vars:
|
||||
CLI_ARGS: "console"
|
||||
doc:
|
||||
desc: "Build documentation"
|
||||
deps:
|
||||
- "gems"
|
||||
cmds:
|
||||
- task: "bundle"
|
||||
vars:
|
||||
CLI_ARGS: "exec yardoc -o public/doc app lib config db"
|
||||
gem-audit:
|
||||
desc: "Audit Gem dependencies"
|
||||
deps:
|
||||
- "gems"
|
||||
- "bundler-audit"
|
||||
cmds:
|
||||
- task: "bundle"
|
||||
vars:
|
||||
CLI_ARGS: "audit --update"
|
||||
node-audit:
|
||||
desc: "Audit Node dependencies"
|
||||
deps:
|
||||
- "node-modules"
|
||||
cmds:
|
||||
- task: "yarn"
|
||||
vars:
|
||||
CLI_ARGS: "audit"
|
||||
notify:
|
||||
internal: true
|
||||
cmds:
|
||||
- "echo -e \"\a\""
|
||||
bundler-audit:
|
||||
internal: true
|
||||
cmds:
|
||||
- "{{.HAINISH}} gem install bundler-audit"
|
||||
status:
|
||||
- "test -f ../hain/usr/bin/bundler-audit"
|
|
@ -68,7 +68,7 @@ module Api
|
|||
|
||||
# respuesta de error a plataformas
|
||||
def platforms_answer(exception)
|
||||
ExceptionNotifier.notify_exception(exception, data: { headers: request.headers.to_h }
|
||||
ExceptionNotifier.notify_exception(exception, data: { headers: request.headers.to_h })
|
||||
|
||||
head :forbidden
|
||||
end
|
||||
|
|
8
bin/modified_files
Executable file
8
bin/modified_files
Executable file
|
@ -0,0 +1,8 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
test -n "${CI_MERGE_REQUEST_DIFF_BASE_SHA}"
|
||||
|
||||
git diff --name-status ${CI_MERGE_REQUEST_DIFF_BASE_SHA}...origin/rails \
|
||||
| grep -v "^D" \
|
||||
| cut -f 2
|
4
bin/with_extension
Executable file
4
bin/with_extension
Executable file
|
@ -0,0 +1,4 @@
|
|||
#!/bin/sh
|
||||
|
||||
grep "\.${1}$"
|
||||
exit 0
|
|
@ -21,6 +21,17 @@ require 'rails/test_unit/railtie'
|
|||
# you've limited to :test, :development, or :production.
|
||||
Bundler.require(*Rails.groups)
|
||||
|
||||
if %w[development test].include? ENV['RAILS_ENV']
|
||||
# https://github.com/bkeepers/dotenv/pull/453
|
||||
Dotenv::Railtie.class_eval do
|
||||
def overload
|
||||
Dotenv.overload(*dotenv_files.reverse)
|
||||
end
|
||||
end
|
||||
|
||||
Dotenv::Railtie.overload
|
||||
end
|
||||
|
||||
module Sutty
|
||||
# Sutty!
|
||||
class Application < Rails::Application
|
||||
|
|
|
@ -9,13 +9,6 @@ SET xmloption = content;
|
|||
SET client_min_messages = warning;
|
||||
SET row_security = off;
|
||||
|
||||
--
|
||||
-- Name: public; Type: SCHEMA; Schema: -; Owner: -
|
||||
--
|
||||
|
||||
-- *not* creating schema, since initdb creates it
|
||||
|
||||
|
||||
--
|
||||
-- Name: pg_trgm; Type: EXTENSION; Schema: -; Owner: -
|
||||
--
|
||||
|
@ -44,6 +37,35 @@ CREATE EXTENSION IF NOT EXISTS pgcrypto WITH SCHEMA public;
|
|||
COMMENT ON EXTENSION pgcrypto IS 'cryptographic functions';
|
||||
|
||||
|
||||
--
|
||||
-- Name: access_logs_before_insert_row_tr(); Type: FUNCTION; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE FUNCTION public.access_logs_before_insert_row_tr() RETURNS trigger
|
||||
LANGUAGE plpgsql
|
||||
AS $$
|
||||
BEGIN
|
||||
new.created_at := to_timestamp(new.msec);
|
||||
RETURN NEW;
|
||||
END;
|
||||
$$;
|
||||
|
||||
|
||||
--
|
||||
-- Name: indexed_posts_before_insert_update_row_tr(); Type: FUNCTION; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE FUNCTION public.indexed_posts_before_insert_update_row_tr() RETURNS trigger
|
||||
LANGUAGE plpgsql
|
||||
AS $$
|
||||
BEGIN
|
||||
new.indexed_content := to_tsvector(('pg_catalog.' || new.dictionary)::regconfig, coalesce(new.title, '') || '
|
||||
' || coalesce(new.content,''));
|
||||
RETURN NEW;
|
||||
END;
|
||||
$$;
|
||||
|
||||
|
||||
--
|
||||
-- Name: que_validate_tags(jsonb); Type: FUNCTION; Schema: public; Owner: -
|
||||
--
|
||||
|
@ -103,35 +125,6 @@ WITH (fillfactor='90');
|
|||
COMMENT ON TABLE public.que_jobs IS '7';
|
||||
|
||||
|
||||
--
|
||||
-- Name: access_logs_before_insert_row_tr(); Type: FUNCTION; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE FUNCTION public.access_logs_before_insert_row_tr() RETURNS trigger
|
||||
LANGUAGE plpgsql
|
||||
AS $$
|
||||
BEGIN
|
||||
new.created_at := to_timestamp(new.msec);
|
||||
RETURN NEW;
|
||||
END;
|
||||
$$;
|
||||
|
||||
|
||||
--
|
||||
-- Name: indexed_posts_before_insert_update_row_tr(); Type: FUNCTION; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE FUNCTION public.indexed_posts_before_insert_update_row_tr() RETURNS trigger
|
||||
LANGUAGE plpgsql
|
||||
AS $$
|
||||
BEGIN
|
||||
new.indexed_content := to_tsvector(('pg_catalog.' || new.dictionary)::regconfig, coalesce(new.title, '') || '
|
||||
' || coalesce(new.content,''));
|
||||
RETURN NEW;
|
||||
END;
|
||||
$$;
|
||||
|
||||
|
||||
--
|
||||
-- Name: que_determine_job_state(public.que_jobs); Type: FUNCTION; Schema: public; Owner: -
|
||||
--
|
||||
|
@ -1149,7 +1142,8 @@ CREATE TABLE public.roles (
|
|||
site_id integer,
|
||||
usuarie_id integer,
|
||||
rol character varying,
|
||||
temporal boolean
|
||||
temporal boolean,
|
||||
token character varying
|
||||
);
|
||||
|
||||
|
||||
|
@ -1236,7 +1230,9 @@ CREATE TABLE public.sites (
|
|||
tienda_url character varying DEFAULT ''::character varying,
|
||||
api_key_ciphertext character varying,
|
||||
slugify_mode character varying DEFAULT 'default'::character varying,
|
||||
pagination boolean DEFAULT false
|
||||
pagination boolean DEFAULT false,
|
||||
private_key_pem_ciphertext text,
|
||||
last_indexed_commit character varying
|
||||
);
|
||||
|
||||
|
||||
|
@ -2318,6 +2314,10 @@ INSERT INTO "schema_migrations" (version) VALUES
|
|||
('20230421182627'),
|
||||
('20230424174544'),
|
||||
('20230519143500'),
|
||||
('20230524190240');
|
||||
('20230524190240'),
|
||||
('20230731195050'),
|
||||
('20230829204127'),
|
||||
('20230921155401'),
|
||||
('20230927153926');
|
||||
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
"@rails/actiontext": "^6.0.0",
|
||||
"@rails/activestorage": "^6.1.3-1",
|
||||
"@rails/ujs": "^6.1.3-1",
|
||||
"@rails/webpacker": "5.2.1",
|
||||
"@rails/webpacker": "5.4.4",
|
||||
"@suttyweb/editor": "^0.1.25",
|
||||
"babel-loader": "^8.2.2",
|
||||
"chart.js": "^3.5.1",
|
||||
|
|
BIN
public/assets/.sprockets-manifest-c6294bb290dcb7473076f4de99ce9c00.json
(Stored with Git LFS)
BIN
public/assets/.sprockets-manifest-c6294bb290dcb7473076f4de99ce9c00.json
(Stored with Git LFS)
Binary file not shown.
BIN
public/packs/css/application-1224e21e.css
(Stored with Git LFS)
Normal file
BIN
public/packs/css/application-1224e21e.css
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
public/packs/css/application-1224e21e.css.br
(Stored with Git LFS)
Normal file
BIN
public/packs/css/application-1224e21e.css.br
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
public/packs/css/application-1224e21e.css.gz
(Stored with Git LFS)
Normal file
BIN
public/packs/css/application-1224e21e.css.gz
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
public/packs/css/application-7d15ae94.css
(Stored with Git LFS)
BIN
public/packs/css/application-7d15ae94.css
(Stored with Git LFS)
Binary file not shown.
BIN
public/packs/css/application-7d15ae94.css.br
(Stored with Git LFS)
BIN
public/packs/css/application-7d15ae94.css.br
(Stored with Git LFS)
Binary file not shown.
BIN
public/packs/css/application-7d15ae94.css.br.br
(Stored with Git LFS)
BIN
public/packs/css/application-7d15ae94.css.br.br
(Stored with Git LFS)
Binary file not shown.
BIN
public/packs/css/application-7d15ae94.css.gz
(Stored with Git LFS)
BIN
public/packs/css/application-7d15ae94.css.gz
(Stored with Git LFS)
Binary file not shown.
BIN
public/packs/js/application-d4a959210a82d3d1b10f.js
(Stored with Git LFS)
Normal file
BIN
public/packs/js/application-d4a959210a82d3d1b10f.js
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
public/packs/js/application-d4a959210a82d3d1b10f.js.LICENSE.txt
(Stored with Git LFS)
Normal file
BIN
public/packs/js/application-d4a959210a82d3d1b10f.js.LICENSE.txt
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
public/packs/js/application-d4a959210a82d3d1b10f.js.br
(Stored with Git LFS)
Normal file
BIN
public/packs/js/application-d4a959210a82d3d1b10f.js.br
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
public/packs/js/application-d4a959210a82d3d1b10f.js.gz
(Stored with Git LFS)
Normal file
BIN
public/packs/js/application-d4a959210a82d3d1b10f.js.gz
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
public/packs/js/application-d4a959210a82d3d1b10f.js.map
(Stored with Git LFS)
Normal file
BIN
public/packs/js/application-d4a959210a82d3d1b10f.js.map
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
public/packs/js/application-d4a959210a82d3d1b10f.js.map.br
(Stored with Git LFS)
Normal file
BIN
public/packs/js/application-d4a959210a82d3d1b10f.js.map.br
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
public/packs/js/application-d4a959210a82d3d1b10f.js.map.gz
(Stored with Git LFS)
Normal file
BIN
public/packs/js/application-d4a959210a82d3d1b10f.js.map.gz
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
public/packs/js/application-fd20cd4c95f90c1a3ecd.js
(Stored with Git LFS)
BIN
public/packs/js/application-fd20cd4c95f90c1a3ecd.js
(Stored with Git LFS)
Binary file not shown.
BIN
public/packs/js/application-fd20cd4c95f90c1a3ecd.js.LICENSE.txt
(Stored with Git LFS)
BIN
public/packs/js/application-fd20cd4c95f90c1a3ecd.js.LICENSE.txt
(Stored with Git LFS)
Binary file not shown.
BIN
public/packs/js/application-fd20cd4c95f90c1a3ecd.js.LICENSE.txt.br
(Stored with Git LFS)
BIN
public/packs/js/application-fd20cd4c95f90c1a3ecd.js.LICENSE.txt.br
(Stored with Git LFS)
Binary file not shown.
BIN
public/packs/js/application-fd20cd4c95f90c1a3ecd.js.br
(Stored with Git LFS)
BIN
public/packs/js/application-fd20cd4c95f90c1a3ecd.js.br
(Stored with Git LFS)
Binary file not shown.
BIN
public/packs/js/application-fd20cd4c95f90c1a3ecd.js.br.br
(Stored with Git LFS)
BIN
public/packs/js/application-fd20cd4c95f90c1a3ecd.js.br.br
(Stored with Git LFS)
Binary file not shown.
BIN
public/packs/js/application-fd20cd4c95f90c1a3ecd.js.gz
(Stored with Git LFS)
BIN
public/packs/js/application-fd20cd4c95f90c1a3ecd.js.gz
(Stored with Git LFS)
Binary file not shown.
BIN
public/packs/js/application-fd20cd4c95f90c1a3ecd.js.map
(Stored with Git LFS)
BIN
public/packs/js/application-fd20cd4c95f90c1a3ecd.js.map
(Stored with Git LFS)
Binary file not shown.
BIN
public/packs/js/application-fd20cd4c95f90c1a3ecd.js.map.br
(Stored with Git LFS)
BIN
public/packs/js/application-fd20cd4c95f90c1a3ecd.js.map.br
(Stored with Git LFS)
Binary file not shown.
BIN
public/packs/js/application-fd20cd4c95f90c1a3ecd.js.map.br.br
(Stored with Git LFS)
BIN
public/packs/js/application-fd20cd4c95f90c1a3ecd.js.map.br.br
(Stored with Git LFS)
Binary file not shown.
BIN
public/packs/js/application-fd20cd4c95f90c1a3ecd.js.map.gz
(Stored with Git LFS)
BIN
public/packs/js/application-fd20cd4c95f90c1a3ecd.js.map.gz
(Stored with Git LFS)
Binary file not shown.
BIN
public/packs/manifest.json
(Stored with Git LFS)
BIN
public/packs/manifest.json
(Stored with Git LFS)
Binary file not shown.
BIN
public/packs/manifest.json.br
(Stored with Git LFS)
BIN
public/packs/manifest.json.br
(Stored with Git LFS)
Binary file not shown.
BIN
public/packs/manifest.json.br.br
(Stored with Git LFS)
BIN
public/packs/manifest.json.br.br
(Stored with Git LFS)
Binary file not shown.
BIN
public/packs/manifest.json.gz
(Stored with Git LFS)
BIN
public/packs/manifest.json.gz
(Stored with Git LFS)
Binary file not shown.
BIN
public/packs/media/fonts/forkawesome-webfont-2dfb5f36.woff.br
(Stored with Git LFS)
BIN
public/packs/media/fonts/forkawesome-webfont-2dfb5f36.woff.br
(Stored with Git LFS)
Binary file not shown.
BIN
public/packs/media/fonts/forkawesome-webfont-7c20758e.woff2.br
(Stored with Git LFS)
BIN
public/packs/media/fonts/forkawesome-webfont-7c20758e.woff2.br
(Stored with Git LFS)
Binary file not shown.
BIN
public/packs/media/fonts/forkawesome-webfont-86541105.svg.br
(Stored with Git LFS)
BIN
public/packs/media/fonts/forkawesome-webfont-86541105.svg.br
(Stored with Git LFS)
Binary file not shown.
BIN
public/packs/media/fonts/forkawesome-webfont-86541105.svg.br.br
(Stored with Git LFS)
BIN
public/packs/media/fonts/forkawesome-webfont-86541105.svg.br.br
(Stored with Git LFS)
Binary file not shown.
BIN
public/packs/media/fonts/forkawesome-webfont-e182ad6d.eot.br
(Stored with Git LFS)
BIN
public/packs/media/fonts/forkawesome-webfont-e182ad6d.eot.br
(Stored with Git LFS)
Binary file not shown.
BIN
public/packs/media/fonts/forkawesome-webfont-e182ad6d.eot.br.br
(Stored with Git LFS)
BIN
public/packs/media/fonts/forkawesome-webfont-e182ad6d.eot.br.br
(Stored with Git LFS)
Binary file not shown.
BIN
public/packs/media/fonts/forkawesome-webfont-ee4d8bfd.ttf.br
(Stored with Git LFS)
BIN
public/packs/media/fonts/forkawesome-webfont-ee4d8bfd.ttf.br
(Stored with Git LFS)
Binary file not shown.
BIN
public/packs/media/fonts/forkawesome-webfont-ee4d8bfd.ttf.br.br
(Stored with Git LFS)
BIN
public/packs/media/fonts/forkawesome-webfont-ee4d8bfd.ttf.br.br
(Stored with Git LFS)
Binary file not shown.
BIN
public/packs/media/images/layers-2x-8f2c4d11.png.br
(Stored with Git LFS)
BIN
public/packs/media/images/layers-2x-8f2c4d11.png.br
(Stored with Git LFS)
Binary file not shown.
BIN
public/packs/media/images/layers-416d9136.png.br
(Stored with Git LFS)
BIN
public/packs/media/images/layers-416d9136.png.br
(Stored with Git LFS)
Binary file not shown.
BIN
public/packs/media/images/marker-icon-2b3e1faf.png.br
(Stored with Git LFS)
BIN
public/packs/media/images/marker-icon-2b3e1faf.png.br
(Stored with Git LFS)
Binary file not shown.
BIN
public/packs/media/images/marker-icon-2x-680f69f3.png.br
(Stored with Git LFS)
BIN
public/packs/media/images/marker-icon-2x-680f69f3.png.br
(Stored with Git LFS)
Binary file not shown.
BIN
public/packs/media/images/marker-shadow-a0c6cc14.png.br
(Stored with Git LFS)
BIN
public/packs/media/images/marker-shadow-a0c6cc14.png.br
(Stored with Git LFS)
Binary file not shown.
Loading…
Reference in a new issue