GoSetup-bubble/confs/shop.yaml
2025-12-26 17:45:37 +05:00

314 lines
No EOL
12 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
name: "Shop"
version: 1.2
description: "Магазин приложений в котором собрана куча данных"
icon: "_public/icons/repository.png"
type: "other"
conf-files:
- file: "_public/files/config.ini"
type: "ini"
name: "ini config"
- file: "_public/files/.env"
type: "env"
name: "env config"
- file: "_public/files/repko.service"
type: "service"
name: "app service"
- file: "_public/files/separated.repko.conf"
type: "nginx"
name: "nginx separated config"
- file: "_public/files/united.repko.conf"
type: "nginx"
name: "nginx united config"
variables:
- name: "user_type"
type: "string"
default: "Create"
- name: "repko_user"
type: "string"
default: "repko-user"
- name: "api_domain"
type: "string"
default: "api.repko.com"
- name: "panel_domain"
type: "string"
default: "panel.repko.com"
- name: "cookie_domain"
type: "string"
default: "repko.com"
- name: "is_secure"
type: "bool"
default: false
- name: "server_address"
type: "string"
default: "127.0.0.1:9988"
- name: "trusted_proxy"
type: "string"
default: "127.0.0.1,::1"
- name: "nginx_port"
type: "string"
default: "80"
- name: "ssl_type"
type: "string"
default: "path now"
- name: "ssl_cert_path"
type: "string"
default: "/usr/share/ca-certificates/repko/repko.crt"
- name: "ssl_key_path"
type: "string"
#default: "/usr/share/ca-certificates/repko/repko.key"
default: "/repko.key"
- name: "database_type"
type: "string"
default: "sqlite"
- name: "database_host"
type: "string"
default: "localhost"
- name: "database_port"
type: "string"
default: "5435"
- name: "database_name"
type: "string"
default: "repkoDB"
- name: "database_user"
type: "string"
default: "root"
- name: "database_password"
type: "string"
default: "admin"
- name: "debian_root"
type: "string"
default: "/var/www/repko/debian"
- name: "archive_root"
type: "string"
default: "/var/www/repko/archive"
sections:
- name: "Repko about"
type: "about"
description: "Описание приложения"
paragraphs:
- "# Repko - собственный сервер репозитория для debian систем. "
- "## Возможности: \n - Встроенная система аутентификации (локальные пользователи или LDAP).\n - Подпись gpg ключом.\n - Удобный веб интерфейс"
- "## Бла бла бла. \n lorem ipsum прочее прочее прочее прочее"
- "### Бла бла бла бла. \n lorem ipsum прочее прочее прочее прочее"
- "## Бла бла бла бла. \n lorem ipsum прочее прочее прочее прочее"
- name: "user"
description: "Настройка данных пользователя"
fields:
- name: "choose_user"
variable-name: "user_type"
field-type: "select"
options:
- "Create"
- "Existing"
- name: "select_user"
variable-name: "repko_user"
field-type: "select"
special-value: "code:users"
description: "Выберите существующего пользователя"
condition: "user_type=='Existing'"
parent:
- "user_type"
- name: "new_user"
variable-name: "repko_user"
field-type: "input"
description: "Пользователь от которого будет запускаться программа"
condition: "user_type=='Create'"
parent:
- "user_type"
validate:
- rule: "regex_match(repko_user, `^[a-z][a-z0-9_-]*$`)"
message: "Только строчные латинские буквы, цифры, _, -"
- rule: "not user_exists(repko_user)"
message: "Пользователь существует"
actions:
- name: "create_user"
type: "command"
command: "echo 'adduser --system --group --no-create-home --disabled-password --shell /bin/false {{.repko_user}}'"
condition: "user_type=='Create'"
run-as: "root"
require-packages:
- "adduser"
error: "Ошибка при создании пользователя"
- name: "domain"
description: "Настройка используемых доменов"
fields:
- name: "api_domain"
variable-name: "api_domain"
field-type: "input"
description: "Домен на котором будет работать api"
- name: "panel_domain"
variable-name: "panel_domain"
field-type: "input"
description: "Домен на котором будет работать сайт"
- name: "cookie_domain"
variable-name: "cookie_domain"
description: "Домен для куки"
field-type: "compute"
parent:
- "panel_domain"
- "api_domain"
compute: |
api_domain == panel_domain ? api_domain :
regex(api_domain, `^.*\.([a-zA-Z0-9-]+\.[a-zA-Z]{2,})$`, '$1') !=
regex(panel_domain, `^.*\.([a-zA-Z0-9-]+\.[a-zA-Z]{2,})$`, '$1') ?
error("Разные корневые домены") :
regex(api_domain, `^.*\.([a-zA-Z0-9-]+\.[a-zA-Z]{2,})$`, '$1')
- name: "is_secure"
variable-name: "is_secure"
field-type: "check"
description: "Использовать SSL"
- name: "server_address"
variable-name: "server_address"
field-type: "input"
description: "Адрес сервера"
- name: "ssl"
description: "Настройка ssl"
condition: "is_secure == true"
parent:
- "is_secure"
fields:
- name: "ssl_type"
variable-name: "ssl_type"
field-type: "select"
options:
- "path later"
- "path now"
- "self-signed"
- "lets encrypt"
- name: "ssl_cert_path"
variable-name: "ssl_cert_path"
field-type: "file"
file-field-extensions:
- ".crt"
- ".cer"
- ".pem"
description: "Путь к ssl сертификату"
condition: "ssl_type=='path now'"
parent:
- "ssl_type"
- name: "ssl_key_path"
variable-name: "ssl_key_path"
field-type: "input"
file-field-extensions:
- ".key"
description: "Путь к ssl ключу"
condition: "ssl_type=='path now'"
parent:
- "ssl_type"
actions:
- name: "create_ssl_repko_dir"
type: "command"
command: "mkdir -p /usr/share/ca-certificates/repko"
condition: "ssl_type == 'self-signed'"
run-as: "root"
error: "Ошибка при создании директории для сертификатов"
- name: "generate_self_signed"
type: "command"
command: |
openssl req -x509 -nodes -days 365 \
-newkey rsa:2048 \
-keyout {{ssl_key_path}} \
-out {{ssl_cert_path}} \
-subj "/CN={{api_domain}}"
condition: "ssl_type == 'self-signed'"
run-as: "root"
error: "Ошибка при генерации самоподписанного сертификата"
- name: "run_certbot"
type: "command"
command: "certbot --nginx -d {{api_domain}} -d {{panel_domain}} --non-interactive --agree-tos -m admin@{{api_domain}}"
condition: "ssl_type == 'lets encrypt'"
require-packages:
- "nginx"
- "certbot"
run-as: "root"
error: "Ошибка при генерации сертификата через lets encrypt"
# - name: "update_ca_certificates"
# type: "command"
# command: "update_ca_certificates"
# run-as: "root"
# error: "Не удалось обновить сертификаты"
# condition: "ssl_type != 'path later'"
# require-packages:
# - "dont know what"
- name: "database"
description: "Настройка используемой базы данных"
fields:
- name: "database_type"
variable-name: "database_type"
field-type: "select"
options:
- "sqlite"
- "postgres"
description: "Используемая база данных"
- name: "database_host"
variable-name: "database_host"
field-type: "input"
description: "Адрес база данных"
condition: "database_type=='postgres'"
parent:
- "database_type"
- name: "database_port"
variable-name: "database_port"
field-type: "input"
description: "Порт база данных"
condition: "database_type=='postgres'"
parent:
- "database_type"
- name: "database_name"
variable-name: "database_name"
field-type: "input"
description: "Имя базы данных"
condition: "database_type=='postgres'"
parent:
- "database_type"
- name: "database_user"
variable-name: "database_user"
field-type: "input"
description: "Имя пользователя база данных"
condition: "database_type=='postgres'"
parent:
- "database_type"
- name: "database_password"
variable-name: "database_password"
field-type: "input"
description: "Пароль база данных"
condition: "database_type=='postgres'"
parent:
- "database_type"
- name: "paths"
description: "Настройка директорий"
fields:
- name: "debian_root"
variable-name: "debian_root"
field-type: "directory"
description: "Директория debian"
- name: "finale"
description: "Последний этап, проверьте правильность введенных данных"
type: "final"
actions:
- name: "update_united_nginx_conf"
type: "file_template"
condition: "api_domain==panel_domain"
file-source: "/home/test/Projects/Personal/GoSetup/_public/files/donor/united.repko.donor.conf"
file-target: "/home/test/Projects/Personal/GoSetup/_public/files/target/united.repko.needy.conf"
error: "Ошибка при создании файла united.repko.needy.conf"
- name: "update_separated_nginx_conf"
type: "file_template"
condition: "api_domain !=panel_domain"
file-source: "/home/test/Projects/Personal/GoSetup/_public/files/donor/separated.repko.donor.conf"
file-target: "/home/test/Projects/Personal/GoSetup/_public/files/target/separated.repko.needy.conf"
error: "Ошибка при создании файла separated.repko.needy.conf"
- name: "update_repko_service"
type: "file_template"
file-source: "/home/test/Projects/Personal/GoSetup/_public/files/donor/repko.donor.service"
file-target: "/home/test/Projects/Personal/GoSetup/_public/files/target/repko.target.service"
error: "Ошибка при создании файла repko.target.service"
- name: "update_repko_ini"
type: "file_template"
# file-source: "/home/test/Projects/Personal/GoSetup/_public/files/donor/config.donor.ini"
# file-target: "/home/test/Projects/Personal/GoSetup/_public/files/target/config.target.ini"
file-source: "http://gsg.site/_public/config.donor.ini"
file-target: "/home/test/Projects/Personal/GoSetup/_public/files/target/http.config.ini"
error: "Ошибка при создании файла repko.target.service"
root: true