1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/fab-manager_ynh.git synced 2024-09-03 18:36:16 +02:00
This commit is contained in:
Salamandar 2024-08-23 15:31:44 +00:00 committed by GitHub
commit b31c530866
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 281 additions and 71 deletions

View file

@ -5,4 +5,6 @@
- [Irakurri README euskaraz](README_eu.md) - [Irakurri README euskaraz](README_eu.md)
- [Lire le README en français](README_fr.md) - [Lire le README en français](README_fr.md)
- [Le o README en galego](README_gl.md) - [Le o README en galego](README_gl.md)
- [Baca README dalam bahasa bahasa Indonesia](README_id.md)
- [Прочитать README на русский](README_ru.md)
- [阅读中文(简体)的 README](README_zh_Hans.md) - [阅读中文(简体)的 README](README_zh_Hans.md)

View file

@ -19,7 +19,7 @@ It shall NOT be edited by hand.
Fab-manager is the Fab Lab management solution. It provides a comprehensive, web-based, open-source tool to simplify your administrative tasks, and document your marker's projects. Fab-manager is the Fab Lab management solution. It provides a comprehensive, web-based, open-source tool to simplify your administrative tasks, and document your marker's projects.
**Shipped version:** 5.6.5~ynh2 **Shipped version:** 6.3.31~ynh1
**Demo:** <https://www.fab-manager.com/fr/demo> **Demo:** <https://www.fab-manager.com/fr/demo>

View file

@ -19,7 +19,7 @@ No se debe editar a mano.
Fab-manager is the Fab Lab management solution. It provides a comprehensive, web-based, open-source tool to simplify your administrative tasks, and document your marker's projects. Fab-manager is the Fab Lab management solution. It provides a comprehensive, web-based, open-source tool to simplify your administrative tasks, and document your marker's projects.
**Versión actual:** 5.6.5~ynh2 **Versión actual:** 6.3.31~ynh1
**Demo:** <https://www.fab-manager.com/fr/demo> **Demo:** <https://www.fab-manager.com/fr/demo>

View file

@ -19,7 +19,7 @@ EZ editatu eskuz.
Fab-manager is the Fab Lab management solution. It provides a comprehensive, web-based, open-source tool to simplify your administrative tasks, and document your marker's projects. Fab-manager is the Fab Lab management solution. It provides a comprehensive, web-based, open-source tool to simplify your administrative tasks, and document your marker's projects.
**Paketatutako bertsioa:** 5.6.5~ynh2 **Paketatutako bertsioa:** 6.3.31~ynh1
**Demoa:** <https://www.fab-manager.com/fr/demo> **Demoa:** <https://www.fab-manager.com/fr/demo>

View file

@ -19,7 +19,7 @@ Il NE doit PAS être modifié à la main.
Fab-manager is the Fab Lab management solution. It provides a comprehensive, web-based, open-source tool to simplify your administrative tasks, and document your marker's projects. Fab-manager is the Fab Lab management solution. It provides a comprehensive, web-based, open-source tool to simplify your administrative tasks, and document your marker's projects.
**Version incluse:** 5.6.5~ynh2 **Version incluse:** 6.3.31~ynh1
**Démo:** <https://www.fab-manager.com/fr/demo> **Démo:** <https://www.fab-manager.com/fr/demo>

View file

@ -19,7 +19,7 @@ NON debe editarse manualmente.
Fab-manager is the Fab Lab management solution. It provides a comprehensive, web-based, open-source tool to simplify your administrative tasks, and document your marker's projects. Fab-manager is the Fab Lab management solution. It provides a comprehensive, web-based, open-source tool to simplify your administrative tasks, and document your marker's projects.
**Versión proporcionada:** 5.6.5~ynh2 **Versión proporcionada:** 6.3.31~ynh1
**Demo:** <https://www.fab-manager.com/fr/demo> **Demo:** <https://www.fab-manager.com/fr/demo>

50
README_id.md Normal file
View file

@ -0,0 +1,50 @@
<!--
N.B.: README ini dibuat secara otomatis oleh <https://github.com/YunoHost/apps/tree/master/tools/readme_generator>
Ini TIDAK boleh diedit dengan tangan.
-->
# Fab-manager untuk YunoHost
[![Tingkat integrasi](https://dash.yunohost.org/integration/fab-manager.svg)](https://ci-apps.yunohost.org/ci/apps/fab-manager/) ![Status kerja](https://ci-apps.yunohost.org/ci/badges/fab-manager.status.svg) ![Status pemeliharaan](https://ci-apps.yunohost.org/ci/badges/fab-manager.maintain.svg)
[![Pasang Fab-manager dengan YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=fab-manager)
*[Baca README ini dengan bahasa yang lain.](./ALL_README.md)*
> *Paket ini memperbolehkan Anda untuk memasang Fab-manager secara cepat dan mudah pada server YunoHost.*
> *Bila Anda tidak mempunyai YunoHost, silakan berkonsultasi dengan [panduan](https://yunohost.org/install) untuk mempelajari bagaimana untuk memasangnya.*
## Ringkasan
Fab-manager is the Fab Lab management solution. It provides a comprehensive, web-based, open-source tool to simplify your administrative tasks, and document your marker's projects.
**Versi terkirim:** 6.3.31~ynh1
**Demo:** <https://www.fab-manager.com/fr/demo>
## Tangkapan Layar
![Tangkapan Layar pada Fab-manager](./doc/screenshots/dashboard-mockup.webp)
## Dokumentasi dan sumber daya
- Website aplikasi resmi: <https://www.fab-manager.com>
- Dokumentasi admin resmi: <http://doc.fab.mn>
- Depot kode aplikasi hulu: <https://github.com/sleede/fab-manager>
- Gudang YunoHost: <https://apps.yunohost.org/app/fab-manager>
- Laporkan bug: <https://github.com/YunoHost-Apps/fab-manager_ynh/issues>
## Info developer
Silakan kirim pull request ke [`testing` branch](https://github.com/YunoHost-Apps/fab-manager_ynh/tree/testing).
Untuk mencoba branch `testing`, silakan dilanjutkan seperti:
```bash
sudo yunohost app install https://github.com/YunoHost-Apps/fab-manager_ynh/tree/testing --debug
atau
sudo yunohost app upgrade fab-manager -u https://github.com/YunoHost-Apps/fab-manager_ynh/tree/testing --debug
```
**Info lebih lanjut mengenai pemaketan aplikasi:** <https://yunohost.org/packaging_apps>

50
README_ru.md Normal file
View file

@ -0,0 +1,50 @@
<!--
Важно: этот README был автоматически сгенерирован <https://github.com/YunoHost/apps/tree/master/tools/readme_generator>
Он НЕ ДОЛЖЕН редактироваться вручную.
-->
# Fab-manager для YunoHost
[![Уровень интеграции](https://dash.yunohost.org/integration/fab-manager.svg)](https://ci-apps.yunohost.org/ci/apps/fab-manager/) ![Состояние работы](https://ci-apps.yunohost.org/ci/badges/fab-manager.status.svg) ![Состояние сопровождения](https://ci-apps.yunohost.org/ci/badges/fab-manager.maintain.svg)
[![Установите Fab-manager с YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=fab-manager)
*[Прочтите этот README на других языках.](./ALL_README.md)*
> *Этот пакет позволяет Вам установить Fab-manager быстро и просто на YunoHost-сервер.*
> *Если у Вас нет YunoHost, пожалуйста, посмотрите [инструкцию](https://yunohost.org/install), чтобы узнать, как установить его.*
## Обзор
Fab-manager is the Fab Lab management solution. It provides a comprehensive, web-based, open-source tool to simplify your administrative tasks, and document your marker's projects.
**Поставляемая версия:** 6.3.31~ynh1
**Демо-версия:** <https://www.fab-manager.com/fr/demo>
## Снимки экрана
![Снимок экрана Fab-manager](./doc/screenshots/dashboard-mockup.webp)
## Документация и ресурсы
- Официальный веб-сайт приложения: <https://www.fab-manager.com>
- Официальная документация администратора: <http://doc.fab.mn>
- Репозиторий кода главной ветки приложения: <https://github.com/sleede/fab-manager>
- Магазин YunoHost: <https://apps.yunohost.org/app/fab-manager>
- Сообщите об ошибке: <https://github.com/YunoHost-Apps/fab-manager_ynh/issues>
## Информация для разработчиков
Пришлите Ваш запрос на слияние в [ветку `testing`](https://github.com/YunoHost-Apps/fab-manager_ynh/tree/testing).
Чтобы попробовать ветку `testing`, пожалуйста, сделайте что-то вроде этого:
```bash
sudo yunohost app install https://github.com/YunoHost-Apps/fab-manager_ynh/tree/testing --debug
или
sudo yunohost app upgrade fab-manager -u https://github.com/YunoHost-Apps/fab-manager_ynh/tree/testing --debug
```
**Больше информации о пакетировании приложений:** <https://yunohost.org/packaging_apps>

View file

@ -19,7 +19,7 @@
Fab-manager is the Fab Lab management solution. It provides a comprehensive, web-based, open-source tool to simplify your administrative tasks, and document your marker's projects. Fab-manager is the Fab Lab management solution. It provides a comprehensive, web-based, open-source tool to simplify your administrative tasks, and document your marker's projects.
**分发版本:** 5.6.5~ynh2 **分发版本:** 6.3.31~ynh1
**演示:** <https://www.fab-manager.com/fr/demo> **演示:** <https://www.fab-manager.com/fr/demo>

77
conf/dot_env Normal file
View file

@ -0,0 +1,77 @@
# Add application configuration variables here, as shown below.
# This file is read by dotenv
# Databases
POSTGRES_HOST=localhost
POSTGRES_PASSWORD=__DB_PWD__
REDIS_HOST=localhost
ELASTICSEARCH_HOST=localhost
SECRET_KEY_BASE=__SECRET_KEY_BASE__
# Stripe keys for tests
STRIPE_API_KEY=
STRIPE_PUBLISHABLE_KEY=
# oAuth SSO keys for tests
OAUTH_CLIENT_ID=github-oauth-app-id
OAUTH_CLIENT_SECRET=github-oauth-app-secret
OIDC_CLIENT_ID=oidc-client-id
OIDC_CLIENT_SECRET=oidc-client-secret
# Configure carefully!
DEFAULT_HOST=__DOMAIN__
DEFAULT_PROTOCOL=https
# Email config
DELIVERY_METHOD=smtp
SMTP_ADDRESS=localhost
SMTP_PORT=25
SMTP_DOMAIN=__DOMAIN__
SMTP_USER_NAME=__APP__
SMTP_PASSWORD=__MAIL_PWD__
SMTP_AUTHENTICATION=plain
SMTP_ENABLE_STARTTLS_AUTO=false
SMTP_OPENSSL_VERIFY_MODE=none
SMTP_TLS=false
# I18N configuration
RAILS_LOCALE=fr
APP_LOCALE=fr
MOMENT_LOCALE=fr
SUMMERNOTE_LOCALE=fr-FR
ANGULAR_LOCALE=fr-fr
FULLCALENDAR_LOCALE=fr
INTL_LOCALE=fr-FR
INTL_CURRENCY=EUR
FORCE_VERSION_CHECK=false
ALLOW_INSECURE_HTTP=false
POSTGRESQL_LANGUAGE_ANALYZER=french
TIME_ZONE=Paris
WEEK_STARTING_DAY=monday
D3_DATE_FORMAT=%d/%m/%y
UIB_DATE_FORMAT=dd/MM/yyyy
EXCEL_DATE_FORMAT=dd/mm/yyyy
# OpenLab Projects
# do not change this URL
OPENLAB_BASE_URI=https://openprojects.fab-manager.com
OPENLAB_SSL_VERIFY=true
# System settings
LOG_LEVEL=debug
RAILS_LOG_TO_STDOUT=true
DISK_SPACE_MB_ALERT=1024
ADMINSYS_EMAIL=__ADMIN_MAIL__
ENABLE_SENTRY=false
# 5242880 = 5 megabytes
MAX_IMPORT_SIZE=5242880
# 10485760 = 10 megabytes
MAX_IMAGE_SIZE=10485760
# 20971520 = 20 megabytes
MAX_CAO_SIZE=20971520
# 5242880 = 5 megabytes
MAX_SUPPORTING_DOCUMENT_FILE_SIZE=5242880

View file

@ -8,9 +8,11 @@ User=__APP__
WorkingDirectory=__INSTALL_DIR__ WorkingDirectory=__INSTALL_DIR__
Environment="__LD_PRELOAD__" Environment="__LD_PRELOAD__"
Environment="__YNH_RUBY_LOAD_PATH__" Environment="__YNH_RUBY_LOAD_PATH__"
EnvironmentFile=__INSTALL_DIR__/.env
Environment="RAILS_ENV=production" Environment="RAILS_ENV=production"
ExecStartPre=-rm -f __INSTALL_DIR__/tmp/pids/server.pid ExecStartPre=-rm -f __INSTALL_DIR__/tmp/pids/server.pid
ExecStart=__INSTALL_DIR__/bin/bundle exec rails s puma -p __PORT__ -b 127.0.0.1 ExecStart=__INSTALL_DIR__/bin/bundle exec rails server -u puma -p __PORT__ -b 127.0.0.1
ExecReload=/bin/kill -SIGUSR1 $MAINPID ExecReload=/bin/kill -SIGUSR1 $MAINPID
TimeoutSec=15 TimeoutSec=15
Restart=always Restart=always

View file

@ -8,7 +8,9 @@ User=__APP__
WorkingDirectory=__INSTALL_DIR__ WorkingDirectory=__INSTALL_DIR__
Environment="__LD_PRELOAD__" Environment="__LD_PRELOAD__"
Environment="__YNH_RUBY_LOAD_PATH__" Environment="__YNH_RUBY_LOAD_PATH__"
EnvironmentFile=__INSTALL_DIR__/.env
Environment="RAILS_ENV=production" Environment="RAILS_ENV=production"
ExecStart=__INSTALL_DIR__/bin/bundle exec sidekiq -C __INSTALL_DIR__/config/sidekiq.yml ExecStart=__INSTALL_DIR__/bin/bundle exec sidekiq -C __INSTALL_DIR__/config/sidekiq.yml
TimeoutSec=15 TimeoutSec=15
Restart=always Restart=always

View file

@ -40,4 +40,3 @@ production:
disk_space_mb_alert: 1024 disk_space_mb_alert: 1024
adminsys_email: '__ADMIN_MAIL__' adminsys_email: '__ADMIN_MAIL__'
allow_insecure_http: false allow_insecure_http: false
locked_settings: <%= ENV.fetch("LOCKED_SETTINGS", 'uuid,origin').split(/,/) %>

View file

@ -7,7 +7,7 @@ name = "Fab-manager"
description.en = "Fab Lab management solution" description.en = "Fab Lab management solution"
description.fr = "Solution de gestion de Fab Lab" description.fr = "Solution de gestion de Fab Lab"
version = "5.6.5~ynh2" version = "6.3.31~ynh1"
maintainers = [] maintainers = []
@ -19,11 +19,13 @@ admindoc = "http://doc.fab.mn"
code = "https://github.com/sleede/fab-manager" code = "https://github.com/sleede/fab-manager"
[integration] [integration]
yunohost = ">= 11.2.12" yunohost = ">= 11.2.27"
architectures = "all" architectures = "all"
multi_instance = false multi_instance = false
ldap = false ldap = false
sso = false sso = false
disk = "50M" disk = "50M"
ram.build = "50M" ram.build = "50M"
ram.runtime = "50M" ram.runtime = "50M"
@ -46,8 +48,8 @@ ram.runtime = "50M"
[resources] [resources]
[resources.sources.main] [resources.sources.main]
url = "https://api.github.com/repos/sleede/fab-manager/tarball/v5.6.5" url = "https://github.com/sleede/fab-manager/archive/refs/tags/v6.3.31.tar.gz"
sha256 = "dc6ae9fefd893975ee2b70c5b327a37b3d585dcf223ddffe75cc0b570771102d" sha256 = "c6e51032b5b51f94ff1c48b263f791c86c83722aa5b000c39aadb55896b975b1"
autoupdate.strategy = "latest_github_tag" autoupdate.strategy = "latest_github_tag"
@ -83,6 +85,8 @@ ram.runtime = "50M"
# For Ruby # For Ruby
"libjemalloc-dev", "libjemalloc-dev",
"libffi-dev",
"libyaml-dev",
"curl", "curl",
"build-essential", "build-essential",
"libreadline-dev", "libreadline-dev",

View file

@ -4,10 +4,8 @@
# COMMON VARIABLES # COMMON VARIABLES
#================================================= #=================================================
ruby_version="2.6.10" ruby_version="3.2.2"
bundler_version=2.1.4 nodejs_version="18"
nodejs_version="14"
# Workaround for Mastodon on Bullseye # Workaround for Mastodon on Bullseye
# See https://github.com/mastodon/mastodon/issues/15751#issuecomment-873594463 # See https://github.com/mastodon/mastodon/issues/15751#issuecomment-873594463
@ -27,30 +25,44 @@ fi
# PERSONAL HELPERS # PERSONAL HELPERS
#================================================= #=================================================
check_password_policy() {
password="$1"
# 12 caractères minimum, au moins une lettre majuscule, une lettre minuscule, un chiffre et un caractère spécial
msg=""
if (( ${#password} < 10 )); then
msg="is too short"
elif [[ $password != *[[:digit:]]* ]]; then
msg="does not contain any digit"
elif [[ $password != *[[:lower:]]* ]]; then
msg="does not contain any lower case letter"
elif [[ $password != *[[:upper:]]* ]]; then
msg="does not contain any upper case letter"
elif [[ "$password" =~ ^[0-9a-zA-Z]*$ ]]; then
msg="does not contain any special character"
fi
if [ -n "$msg" ]; then
ynh_die "Password should have min 12 chars, at least one lowercase, one uppercase, one digit and one special character, but it $msg."
fi
}
env_ruby() {
ynh_exec_as "$app" "$ynh_ruby_load_path" "$@"
}
fabmanager_build_ruby() { fabmanager_build_ruby() {
pushd "$install_dir" pushd "$install_dir"
ynh_use_ruby ynh_use_ruby
ynh_exec_warn_less $ynh_gem install "bundler:$bundler_version" $ynh_gem update --system --no-document
ynh_exec_warn_less bin/bundle config --global frozen 1 $ynh_gem install bundler rake --no-document
ynh_exec_warn_less bin/bundle config set --local without 'development test doc'
ynh_exec_warn_less bin/bundle install
ynh_exec_warn_less bin/bundle binstubs --all
popd
}
fabmanager_seed_db() { env_ruby bin/bundle config --global frozen 1
pushd "$install_dir" env_ruby bin/bundle config set without 'development test doc'
ynh_replace_string --match_string="DateTime.current" --replace_string="DateTime.current - 1.days" --target_file="$install_dir/db/seeds.rb" env_ruby bin/bundle config set path 'vendor/bundle'
ynh_exec_warn_less ynh_exec_as "$app" env RAILS_ENV=production "$ynh_ruby_load_path" $ld_preload \ env_ruby bin/bundle install
bin/bundle exec rake db:seed ADMIN_EMAIL="$admin_mail" ADMIN_PASSWORD="$password" env_ruby bin/bundle binstubs --all
popd
}
fabmanager_migrate_db() {
pushd "$install_dir"
ynh_psql_execute_as_root --database="$db_name" --sql="ALTER USER $db_user WITH SUPERUSER;"
ynh_exec_warn_less ynh_exec_as "$app" env RAILS_ENV=production "$ynh_ruby_load_path" $ld_preload bin/bundle exec rake db:migrate
ynh_psql_execute_as_root --database="$db_name" --sql="ALTER USER $db_user WITH NOSUPERUSER;"
popd popd
} }
@ -58,13 +70,30 @@ fabmanager_build_ui() {
pushd "$install_dir" pushd "$install_dir"
ynh_use_nodejs ynh_use_nodejs
ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" yarn install ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" yarn install
#ynh_exec_warn_less ynh_exec_as "$app" env RAILS_ENV=production "$ynh_ruby_load_path" $ld_preload yarn install env_ruby bash -c "set -a; source '$install_dir/.env'; set +a ; RAILS_ENV=production bin/bundle exec rake assets:precompile"
#ynh_exec_warn_less ynh_exec_as "$app" env RAILS_ENV=production "$ynh_ruby_load_path" $ld_preload bin/webpack
ynh_exec_warn_less ynh_exec_as "$app" env RAILS_ENV=production "$ynh_ruby_load_path" $ld_preload bin/bundle exec rake assets:precompile
ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" yarn cache clean --all ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" yarn cache clean --all
popd popd
} }
fabmanager_seed_db() {
pushd "$install_dir"
ynh_replace_string --match_string="DateTime.current" --replace_string="DateTime.current - 1.days" --target_file="$install_dir/db/seeds.rb"
# Need superuser for the extensions configuration…
ynh_psql_execute_as_root --database="$db_name" --sql="ALTER USER $db_user WITH SUPERUSER;"
env_ruby bash -c "set -a; source '$install_dir/.env'; set +a ; RAILS_ENV=production ADMIN_EMAIL='$admin_mail' ADMIN_PASSWORD='$password' bin/bundle exec rails db:schema:load"
ynh_psql_execute_as_root --database="$db_name" --sql="ALTER USER $db_user WITH NOSUPERUSER;"
env_ruby bash -c "set -a; source '$install_dir/.env'; set +a ; RAILS_ENV=production ADMIN_EMAIL='$admin_mail' ADMIN_PASSWORD='$password' bin/bundle exec rails db:seed"
popd
}
fabmanager_migrate_db() {
pushd "$install_dir"
ynh_psql_execute_as_root --database="$db_name" --sql="ALTER USER $db_user WITH SUPERUSER;"
env_ruby bash -c "set -a; source '$install_dir/.env'; set +a ; RAILS_ENV=production bin/bundle exec rails db:migrate"
ynh_psql_execute_as_root --database="$db_name" --sql="ALTER USER $db_user WITH NOSUPERUSER;"
popd
}
#================================================= #=================================================
# EXPERIMENTAL HELPERS # EXPERIMENTAL HELPERS

View file

@ -16,6 +16,8 @@ admin_mail=$(ynh_user_get_info --username="$admin" --key=mail)
secret_key_base=$(ynh_string_random --length=30) secret_key_base=$(ynh_string_random --length=30)
ynh_app_setting_set --app="$app" --key="secret_key_base" --value="$secret_key_base" ynh_app_setting_set --app="$app" --key="secret_key_base" --value="$secret_key_base"
check_password_policy "$password"
#================================================= #=================================================
# INSTALL DEPENDENCIES # INSTALL DEPENDENCIES
#================================================= #=================================================
@ -25,17 +27,6 @@ ynh_exec_warn_less ynh_install_nodejs --nodejs_version="$nodejs_version"
ynh_script_progression --message="Installing Ruby..." --weight=4 ynh_script_progression --message="Installing Ruby..." --weight=4
ynh_exec_warn_less ynh_install_ruby --ruby_version="$ruby_version" ynh_exec_warn_less ynh_install_ruby --ruby_version="$ruby_version"
#=================================================
# CREATE A POSTGRESQL DATABASE
#=================================================
ynh_script_progression --message="Configuring $app's PostgreSQL database..." --weight=1
ynh_psql_execute_as_root --database="$db_name" --sql="ALTER USER $db_user WITH SUPERUSER;"
ynh_psql_execute_as_root --database="$db_name" --sql="CREATE EXTENSION IF NOT EXISTS unaccent;"
ynh_psql_execute_as_root --database="$db_name" --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;"
ynh_psql_execute_as_root --database="$db_name" --sql="CREATE EXTENSION IF NOT EXISTS fuzzystrmatch;"
ynh_psql_execute_as_root --database="$db_name" --sql="ALTER USER $db_user WITH NOSUPERUSER;"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
@ -55,9 +46,9 @@ chown -R "$app:www-data" "$data_dir"
#================================================= #=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1 ynh_script_progression --message="Adding a configuration file..." --weight=1
ynh_add_config --template="secrets.yml" --destination="$install_dir/config/secrets.yml" ynh_add_config --template="dot_env" --destination="$install_dir/.env"
chmod 400 "$install_dir/config/secrets.yml" chmod 400 "$install_dir/.env"
chown "$app:$app" "$install_dir/config/secrets.yml" chown "$app:$app" "$install_dir/.env"
ynh_add_config --template="database.yml" --destination="$install_dir/config/database.yml" ynh_add_config --template="database.yml" --destination="$install_dir/config/database.yml"
chmod 400 "$install_dir/config/database.yml" chmod 400 "$install_dir/config/database.yml"
@ -69,11 +60,8 @@ chown "$app:$app" "$install_dir/config/database.yml"
ynh_script_progression --message="Building app..." --weight=7 ynh_script_progression --message="Building app..." --weight=7
fabmanager_build_ruby fabmanager_build_ruby
fabmanager_migrate_db
fabmanager_seed_db
fabmanager_build_ui fabmanager_build_ui
fabmanager_seed_db
ynh_secure_remove --file="$install_dir/.cache" ynh_secure_remove --file="$install_dir/.cache"
@ -88,6 +76,7 @@ ynh_add_nginx_config
# Create a dedicated systemd config # Create a dedicated systemd config
ynh_add_systemd_config --service="$app-app" --template="fab-manager-app.service" ynh_add_systemd_config --service="$app-app" --template="fab-manager-app.service"
yunohost service add "$app-app" --description="$app app service" yunohost service add "$app-app" --description="$app app service"
ynh_add_systemd_config --service="$app-worker" --template="fab-manager-worker.service" ynh_add_systemd_config --service="$app-worker" --template="fab-manager-worker.service"
yunohost service add "$app-worker" --description="$app worker service" yunohost service add "$app-worker" --description="$app worker service"

View file

@ -11,10 +11,10 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# INSTALL DEPENDENCIES # INSTALL DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Reinstalling NodeJS..." --weight=1 ynh_script_progression --message="Reinstalling NodeJS and Ruby..." --weight=1
ynh_exec_warn_less ynh_install_nodejs --nodejs_version="$nodejs_version" ynh_exec_warn_less ynh_install_nodejs --nodejs_version="$nodejs_version"
ynh_script_progression --message="Reinstalling Ruby..." --weight=4
ynh_exec_warn_less ynh_install_ruby --ruby_version="$ruby_version" ynh_exec_warn_less ynh_install_ruby --ruby_version="$ruby_version"
#================================================= #=================================================
@ -46,9 +46,8 @@ ynh_psql_execute_as_root --database="$db_name" --sql="ALTER USER $db_user WITH S
ynh_psql_execute_as_root --database="$db_name" --sql="CREATE EXTENSION IF NOT EXISTS unaccent;" ynh_psql_execute_as_root --database="$db_name" --sql="CREATE EXTENSION IF NOT EXISTS unaccent;"
ynh_psql_execute_as_root --database="$db_name" --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" ynh_psql_execute_as_root --database="$db_name" --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;"
ynh_psql_execute_as_root --database="$db_name" --sql="CREATE EXTENSION IF NOT EXISTS fuzzystrmatch;" ynh_psql_execute_as_root --database="$db_name" --sql="CREATE EXTENSION IF NOT EXISTS fuzzystrmatch;"
ynh_psql_execute_as_root --database="$db_name" --sql="ALTER USER $db_user WITH NOSUPERUSER;"
ynh_psql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" < ./db.sql ynh_psql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" < ./db.sql
ynh_psql_execute_as_root --database="$db_name" --sql="ALTER USER $db_user WITH NOSUPERUSER;"
#================================================= #=================================================
# BUILD APP # BUILD APP
@ -56,7 +55,6 @@ ynh_psql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name"
ynh_script_progression --message="Building app..." --weight=7 ynh_script_progression --message="Building app..." --weight=7
fabmanager_build_ruby fabmanager_build_ruby
fabmanager_build_ui fabmanager_build_ui
#================================================= #=================================================
@ -67,9 +65,11 @@ ynh_script_progression --message="Restoring system configurations related to $ap
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_restore_file --origin_path="/etc/systemd/system/$app-app.service" ynh_restore_file --origin_path="/etc/systemd/system/$app-app.service"
ynh_restore_file --origin_path="/etc/systemd/system/$app-worker.service" systemctl enable "$app-app" --quiet
systemctl enable "$app-app" "$app-worker" --quiet
yunohost service add "$app-app" --description="$app app service" yunohost service add "$app-app" --description="$app app service"
ynh_restore_file --origin_path="/etc/systemd/system/$app-worker.service"
systemctl enable "$app-worker" --quiet
yunohost service add "$app-worker" --description="$app worker service" yunohost service add "$app-worker" --description="$app worker service"
#================================================= #=================================================

View file

@ -54,7 +54,13 @@ ynh_exec_warn_less ynh_install_ruby --ruby_version="$ruby_version"
ynh_script_progression --message="Upgrading source files..." --weight=1 ynh_script_progression --message="Upgrading source files..." --weight=1
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir" --full_replace=1 --keep="config/secrets.yml config/database.yml" to_keep=(
# Basically inspired from the docker-compose.yml
.env config/database.yml config/auth_provider.yml public/packs public/uploads
invoices payment_schedules exports imports supporting_document_files plugins accounting
)
ynh_setup_source --dest_dir="$install_dir" --full_replace=1 --keep="${to_keep[*]}"
chmod -R o-rwx "$install_dir" chmod -R o-rwx "$install_dir"
chown -R "$app:www-data" "$install_dir" chown -R "$app:www-data" "$install_dir"
@ -64,9 +70,9 @@ chown -R "$app:www-data" "$install_dir"
#================================================= #=================================================
ynh_script_progression --message="Updating a configuration file..." --weight=1 ynh_script_progression --message="Updating a configuration file..." --weight=1
ynh_add_config --template="secrets.yml" --destination="$install_dir/config/secrets.yml" ynh_add_config --template="dot_env" --destination="$install_dir/.env"
chmod 400 "$install_dir/config/secrets.yml" chmod 400 "$install_dir/.env"
chown "$app:$app" "$install_dir/config/secrets.yml" chown "$app:$app" "$install_dir/.env"
ynh_add_config --template="database.yml" --destination="$install_dir/config/database.yml" ynh_add_config --template="database.yml" --destination="$install_dir/config/database.yml"
chmod 400 "$install_dir/config/database.yml" chmod 400 "$install_dir/config/database.yml"
@ -82,11 +88,10 @@ ynh_secure_remove --file="$install_dir/node_modules"
ynh_secure_remove --file="$install_dir/tmp/cache" ynh_secure_remove --file="$install_dir/tmp/cache"
fabmanager_build_ruby fabmanager_build_ruby
fabmanager_build_ui
fabmanager_migrate_db fabmanager_migrate_db
fabmanager_build_ui
#================================================= #=================================================
# REAPPLY SYSTEM CONFIGURATIONS # REAPPLY SYSTEM CONFIGURATIONS
#================================================= #=================================================
@ -97,8 +102,9 @@ ynh_add_nginx_config
# Create a dedicated systemd config # Create a dedicated systemd config
ynh_add_systemd_config --service="$app-app" --template="fab-manager-app.service" ynh_add_systemd_config --service="$app-app" --template="fab-manager-app.service"
ynh_add_systemd_config --service="$app-worker" --template="fab-manager-worker.service"
yunohost service add "$app-app" --description="$app app service" yunohost service add "$app-app" --description="$app app service"
ynh_add_systemd_config --service="$app-worker" --template="fab-manager-worker.service"
yunohost service add "$app-worker" --description="$app worker service" yunohost service add "$app-worker" --description="$app worker service"
#================================================= #=================================================