mirror of
https://github.com/YunoHost-Apps/fab-manager_ynh.git
synced 2024-09-03 18:36:16 +02:00
commit
0a8519ffd9
16 changed files with 185 additions and 142 deletions
24
README.md
24
README.md
|
@ -5,7 +5,7 @@ It shall NOT be edited by hand.
|
|||
|
||||
# Fab-manager for YunoHost
|
||||
|
||||
[](https://dash.yunohost.org/appci/app/fab-manager)  
|
||||
[](https://dash.yunohost.org/appci/app/fab-manager)  
|
||||
[](https://install-app.yunohost.org/?app=fab-manager)
|
||||
|
||||
*[Lire ce readme en français.](./README_fr.md)*
|
||||
|
@ -15,33 +15,35 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
|
|||
|
||||
## Overview
|
||||
|
||||
Fab Lab management solution.
|
||||
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.3.12~ynh2
|
||||
|
||||
**Shipped version:** 5.4.0~ynh1
|
||||
|
||||
**Demo:** https://www.fab-manager.com/fr/demo
|
||||
|
||||
## Screenshots
|
||||
|
||||

|
||||

|
||||
|
||||
## Documentation and resources
|
||||
|
||||
* Official app website: https://www.fab-manager.com
|
||||
* Official admin documentation: http://doc.fab.mn
|
||||
* Upstream app code repository: https://github.com/sleede/fab-manager
|
||||
* YunoHost documentation for this app: https://yunohost.org/app_fab-manager
|
||||
* Report a bug: https://github.com/YunoHost-Apps/fab-manager_ynh/issues
|
||||
* Official app website: <https://www.fab-manager.com>
|
||||
* Official admin documentation: <http://doc.fab.mn>
|
||||
* Upstream app code repository: <https://github.com/sleede/fab-manager>
|
||||
* YunoHost documentation for this app: <https://yunohost.org/app_fab-manager>
|
||||
* Report a bug: <https://github.com/YunoHost-Apps/fab-manager_ynh/issues>
|
||||
|
||||
## Developer info
|
||||
|
||||
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/fab-manager_ynh/tree/testing).
|
||||
|
||||
To try the testing branch, please proceed like that.
|
||||
```
|
||||
|
||||
``` bash
|
||||
sudo yunohost app install https://github.com/YunoHost-Apps/fab-manager_ynh/tree/testing --debug
|
||||
or
|
||||
sudo yunohost app upgrade fab-manager -u https://github.com/YunoHost-Apps/fab-manager_ynh/tree/testing --debug
|
||||
```
|
||||
|
||||
**More info regarding app packaging:** https://yunohost.org/packaging_apps
|
||||
**More info regarding app packaging:** <https://yunohost.org/packaging_apps>
|
||||
|
|
28
README_fr.md
28
README_fr.md
|
@ -1,43 +1,49 @@
|
|||
<!--
|
||||
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator
|
||||
It shall NOT be edited by hand.
|
||||
-->
|
||||
|
||||
# Fab-manager pour YunoHost
|
||||
|
||||
[](https://dash.yunohost.org/appci/app/fab-manager)  
|
||||
[](https://dash.yunohost.org/appci/app/fab-manager)  
|
||||
[](https://install-app.yunohost.org/?app=fab-manager)
|
||||
|
||||
*[Read this readme in english.](./README.md)*
|
||||
*[Lire ce readme en français.](./README_fr.md)*
|
||||
|
||||
> *Ce package vous permet d'installer Fab-manager rapidement et simplement sur un serveur YunoHost.
|
||||
Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
|
||||
|
||||
## Vue d'ensemble
|
||||
|
||||
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.3.12~ynh2
|
||||
**Version incluse :** 5.4.0~ynh1
|
||||
|
||||
**Démo :** https://www.fab-manager.com/fr/demo
|
||||
|
||||
## Captures d'écran
|
||||
|
||||

|
||||

|
||||
|
||||
## Documentations et ressources
|
||||
|
||||
* Site officiel de l'app : https://www.fab-manager.com
|
||||
* Documentation officielle de l'admin : http://doc.fab.mn
|
||||
* Dépôt de code officiel de l'app : https://github.com/sleede/fab-manager
|
||||
* Documentation YunoHost pour cette app : https://yunohost.org/app_fab-manager
|
||||
* Signaler un bug : https://github.com/YunoHost-Apps/fab-manager_ynh/issues
|
||||
* Site officiel de l'app : <https://www.fab-manager.com>
|
||||
* Documentation officielle de l'admin : <http://doc.fab.mn>
|
||||
* Dépôt de code officiel de l'app : <https://github.com/sleede/fab-manager>
|
||||
* Documentation YunoHost pour cette app : <https://yunohost.org/app_fab-manager>
|
||||
* Signaler un bug : <https://github.com/YunoHost-Apps/fab-manager_ynh/issues>
|
||||
|
||||
## Informations pour les développeurs
|
||||
|
||||
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/fab-manager_ynh/tree/testing).
|
||||
|
||||
Pour essayer la branche testing, procédez comme suit.
|
||||
```
|
||||
|
||||
``` bash
|
||||
sudo yunohost app install https://github.com/YunoHost-Apps/fab-manager_ynh/tree/testing --debug
|
||||
ou
|
||||
sudo yunohost app upgrade fab-manager -u https://github.com/YunoHost-Apps/fab-manager_ynh/tree/testing --debug
|
||||
```
|
||||
|
||||
**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps
|
||||
**Plus d'infos sur le packaging d'applications :** <https://yunohost.org/packaging_apps>
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
upgrade=1
|
||||
# 5.3.12~ynh1
|
||||
upgrade=1 from_commit=b5305cfd99c5d0d356cf64e9d490e91d9b0cbae0
|
||||
# 5.3.12~ynh2
|
||||
upgrade=1 from_commit=de58f811f3bc27205ba2b1fbaed250253b1f13c8
|
||||
backup_restore=1
|
||||
multi_instance=0
|
||||
port_already_use=0
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
SOURCE_URL=https://github.com/sleede/fab-manager/archive/refs/tags/v5.3.12.tar.gz
|
||||
SOURCE_SUM=317046f8ef64745a50ed72df23e8b0060de0d4227fbc011ee9d837fca0527aa8
|
||||
SOURCE_URL=https://api.github.com/repos/sleede/fab-manager/tarball/v5.4.0
|
||||
SOURCE_SUM=3cc9ca5e26678c80e7169fe295d77f9dd3e0e6b9656f78d1e5e469f94104864d
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=tar.gz
|
||||
SOURCE_IN_SUBDIR=true
|
||||
|
|
20
conf/fab-manager-app.service
Normal file
20
conf/fab-manager-app.service
Normal file
|
@ -0,0 +1,20 @@
|
|||
[Unit]
|
||||
Description=__APP__-app
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=__APP__
|
||||
WorkingDirectory=__FINALPATH__
|
||||
Environment="__LD_PRELOAD__"
|
||||
Environment="__YNH_RUBY_LOAD_PATH__"
|
||||
Environment="RAILS_ENV=production"
|
||||
ExecStartPre=-/bin/bash -c 'rm -f __FINAL_PATH__/tmp/pids/server.pid'
|
||||
ExecStart=__FINALPATH__/bin/bundle exec rails s puma -p __PORT__ -b 0.0.0.0
|
||||
ExecReload=/bin/kill -SIGUSR1 $MAINPID
|
||||
TimeoutSec=15
|
||||
Restart=always
|
||||
StandardError=syslog
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
18
conf/fab-manager-worker.service
Normal file
18
conf/fab-manager-worker.service
Normal file
|
@ -0,0 +1,18 @@
|
|||
[Unit]
|
||||
Description=__APP__-worker
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=__APP__
|
||||
WorkingDirectory=__FINALPATH__
|
||||
Environment="__LD_PRELOAD__"
|
||||
Environment="__YNH_RUBY_LOAD_PATH__"
|
||||
Environment="RAILS_ENV=production"
|
||||
ExecStart=__FINALPATH__/bin/bundle exec sidekiq -C __FINALPATH__/config/sidekiq.yml
|
||||
TimeoutSec=15
|
||||
Restart=always
|
||||
StandardError=syslog
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -1,15 +0,0 @@
|
|||
[program:__APP__-app]
|
||||
command=__RBENV_ROOT__/versions/__APP__/bin/bundle exec rails s puma -p __PORT__ -b 0.0.0.0
|
||||
directory=__FINALPATH__/
|
||||
environment=RAILS_ENV=production,RACK_ENV=production,__YNH_NODE_LOAD_PATH__
|
||||
stderr_logfile=/var/log/supervisor/__APP__-app-stderr.log
|
||||
stdout_logfile=/var/log/supervisor/__APP__-app-stdout.log
|
||||
stdout_logfile_maxbytes=50MB
|
||||
stdout_logfile_backups=100
|
||||
|
||||
[program:__APP__-worker]
|
||||
command=__RBENV_ROOT__/versions/__APP__/bin/bundle exec sidekiq -C __FINALPATH__/config/sidekiq.yml
|
||||
directory=__FINALPATH__/
|
||||
environment=RAILS_ENV=production,RACK_ENV=production,__YNH_NODE_LOAD_PATH__
|
||||
stderr_logfile=/var/log/supervisor/__APP__-worker-stderr.log
|
||||
stdout_logfile=/var/log/supervisor/__APP__-worker-stdout.log
|
|
@ -0,0 +1 @@
|
|||
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,7 +5,7 @@
|
|||
"description": {
|
||||
"en": "Fab Lab management solution."
|
||||
},
|
||||
"version": "5.3.12~ynh2",
|
||||
"version": "5.4.0~ynh1",
|
||||
"url": "https://www.fab-manager.com",
|
||||
"upstream": {
|
||||
"license": "AGPL-3.0-or-later",
|
||||
|
@ -44,7 +44,10 @@
|
|||
"en": "Choose the application language",
|
||||
"fr": "Choisissez la langue de l'application"
|
||||
},
|
||||
"choices": ["fr", "en"],
|
||||
"choices": [
|
||||
"fr",
|
||||
"en"
|
||||
],
|
||||
"default": "fr"
|
||||
},
|
||||
{
|
||||
|
|
|
@ -5,13 +5,35 @@
|
|||
#=================================================
|
||||
|
||||
# dependencies used by the app
|
||||
pkg_dependencies="ntp ntpdate tzdata curl git imagemagick supervisor tzdata libc-dev zlib1g-dev xz-utils postgresql postgresql-common postgresql-client libidn11-dev redis-server"
|
||||
pkg_dependencies="ntp ntpdate tzdata curl git imagemagick tzdata libc-dev zlib1g-dev xz-utils postgresql postgresql-common postgresql-client libidn11-dev redis-server"
|
||||
|
||||
build_pkg_dependencies="build-essential patch libpq-dev"
|
||||
|
||||
ruby_version=2.6
|
||||
ruby_version="2.6.9"
|
||||
|
||||
nodejs_version=12
|
||||
nodejs_version="12"
|
||||
|
||||
# Workaround for Mastodon on Bullseye
|
||||
# See https://github.com/mastodon/mastodon/issues/15751#issuecomment-873594463
|
||||
if [ "$(lsb_release --codename --short)" = "bullseye" ]; then
|
||||
case $YNH_ARCH in
|
||||
amd64)
|
||||
arch="x86_64"
|
||||
;;
|
||||
arm64)
|
||||
arch="aarch64"
|
||||
;;
|
||||
armel|armhf)
|
||||
arch="arm"
|
||||
;;
|
||||
i386)
|
||||
arch="i386"
|
||||
;;
|
||||
esac
|
||||
ld_preload="LD_PRELOAD=/usr/lib/$arch-linux-gnu/libjemalloc.so"
|
||||
else
|
||||
ld_preload=""
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# PERSONAL HELPERS
|
||||
|
|
|
@ -57,17 +57,12 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
|||
|
||||
#=================================================
|
||||
# SPECIFIC BACKUP
|
||||
#=================================================
|
||||
# BACKUP LOGROTATE
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="/etc/logrotate.d/$app"
|
||||
|
||||
#=================================================
|
||||
# BACKUP SYSTEMD
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="/etc/supervisor/conf.d/$app.conf"
|
||||
ynh_backup --src_path="/etc/systemd/system/$app-app.service"
|
||||
ynh_backup --src_path="/etc/systemd/system/$app-worker.service"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE POSTGRESQL DATABASE
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source ynh_supervisor
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
|
@ -79,7 +78,8 @@ fi
|
|||
#=================================================
|
||||
ynh_script_progression --message="Stopping a systemd service..."
|
||||
|
||||
ynh_supervisor_action --service_name=$app --action="stop" --log_path="/var/log/supervisor/$app-app-stdout.log"
|
||||
ynh_systemd_action --service_name=${app}-app --action="stop" --log_path=systemd --line_match="Stopped"
|
||||
ynh_systemd_action --service_name=${app}-worker --action="stop" --log_path=systemd --line_match="Stopped"
|
||||
|
||||
#=================================================
|
||||
# MODIFY URL IN NGINX CONF
|
||||
|
@ -131,7 +131,8 @@ chown $app:$app "$final_path/config/secrets.yml"
|
|||
ynh_script_progression --message="Starting a systemd service..."
|
||||
|
||||
# Start a systemd service
|
||||
ynh_supervisor_action --service_name=$app --action="start" --log_path="/var/log/supervisor/$app-app-stdout.log" --line_match="Listening on"
|
||||
ynh_systemd_action --service_name=${app}-app --action="start" --log_path=systemd --line_match="Listening on"
|
||||
ynh_systemd_action --service_name=${app}-worker --action="start" --log_path=systemd --line_match="Schedules Loaded"
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
|
||||
source _common.sh
|
||||
source ynh_install_ruby__2
|
||||
source ynh_supervisor
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
|
@ -75,10 +74,10 @@ ynh_app_setting_set --app=$app --key=port --value=$port
|
|||
#=================================================
|
||||
ynh_script_progression --message="Installing dependencies..."
|
||||
|
||||
ynh_install_app_dependencies $pkg_dependencies $build_pkg_dependencies
|
||||
ynh_install_ruby --ruby_version=$ruby_version
|
||||
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies $build_pkg_dependencies
|
||||
ynh_exec_warn_less ynh_install_ruby --ruby_version=$ruby_version
|
||||
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||
ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
|
||||
ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
|
@ -86,22 +85,23 @@ ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ st
|
|||
ynh_script_progression --message="Configuring system user..."
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path" --use_shell
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# CREATE A POSTGRESQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Creating a PostgreSQL database..."
|
||||
|
||||
ynh_psql_test_if_first_run
|
||||
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||
db_user=$db_name
|
||||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||
ynh_psql_test_if_first_run
|
||||
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name
|
||||
ynh_psql_execute_as_root --sql="ALTER USER $db_user WITH SUPERUSER;" --database="$db_name"
|
||||
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS unaccent;" --database=$db_name
|
||||
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --database=$db_name
|
||||
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS fuzzystrmatch;" --database=$db_name
|
||||
ynh_psql_execute_as_root --sql="ALTER USER $db_user WITH NOSUPERUSER;" --database="$db_name"
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
||||
|
||||
#=================================================
|
||||
|
@ -150,13 +150,18 @@ pushd $final_path
|
|||
ynh_exec_warn_less $ynh_gem install bundler
|
||||
ynh_exec_warn_less bin/bundle config --global frozen 1
|
||||
ynh_exec_warn_less bin/bundle config set --local without 'development test doc'
|
||||
ynh_exec_warn_less bin/bundle install --binstubs
|
||||
ynh_exec_warn_less bin/bundle install
|
||||
ynh_exec_warn_less bin/bundle binstubs --all
|
||||
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 cache clean
|
||||
ynh_exec_warn_less ynh_exec_as $app env RAILS_ENV=production RACK_ENV=production $ynh_ruby_load_path bin/bundle exec rake db:migrate
|
||||
ynh_exec_warn_less ynh_exec_as $app env RAILS_ENV=production RACK_ENV=production $ynh_ruby_load_path bin/bundle exec rake db:seed ADMIN_EMAIL="$admin_mail" ADMIN_PASSWORD="$password"
|
||||
ynh_exec_warn_less ynh_exec_as $app env RAILS_ENV=production RACK_ENV=production $ynh_ruby_load_path bin/bundle exec rake assets:precompile
|
||||
ynh_psql_execute_as_root --sql="ALTER USER $db_user WITH SUPERUSER;" --database="$db_name"
|
||||
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 --sql="ALTER USER $db_user WITH NOSUPERUSER;" --database="$db_name"
|
||||
ynh_replace_string --match_string="DateTime.current" --replace_string="DateTime.current - 1.days" --target_file="$final_path/db/seeds.rb"
|
||||
ynh_exec_warn_less ynh_exec_as $app env RAILS_ENV=production $ynh_ruby_load_path $ld_preload bin/bundle exec rake db:seed ADMIN_EMAIL="$admin_mail" ADMIN_PASSWORD="$password"
|
||||
#ynh_exec_warn_less ynh_exec_as $app env RAILS_ENV=production $ynh_ruby_load_path $ld_preload yarn install
|
||||
#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 )
|
||||
popd
|
||||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
@ -183,32 +188,26 @@ chown -R $app:www-data "$datadir"
|
|||
ynh_script_progression --message="Configuring a systemd service..."
|
||||
|
||||
# Create a dedicated systemd config
|
||||
ynh_add_supervisor_config
|
||||
ynh_add_systemd_config --service="$app-app" --template="fab-manager-app.service"
|
||||
ynh_add_systemd_config --service="$app-worker" --template="fab-manager-worker.service"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# SETUP LOGROTATE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring log rotation..."
|
||||
|
||||
# Use logrotate to manage application logfile(s)
|
||||
ynh_use_logrotate
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||
|
||||
yunohost service add $app --log="/var/log/supervisor/$app-app-stdout.log /var/log/supervisor/$app-worker-stdout.log"
|
||||
yunohost service add "$app-app" --description="$app app service"
|
||||
yunohost service add "$app-worker" --description="$app worker service"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..."
|
||||
|
||||
# Start a systemd service
|
||||
ynh_supervisor_action --service_name=$app --action="start" --log_path="/var/log/supervisor/$app-app-stdout.log" --line_match="Listening on"
|
||||
ynh_systemd_action --service_name=${app}-app --action="start" --log_path=systemd --line_match="Listening on"
|
||||
ynh_systemd_action --service_name=${app}-worker --action="start" --log_path=systemd --line_match="Schedules Loaded"
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
|
||||
source _common.sh
|
||||
source ynh_install_ruby__2
|
||||
source ynh_supervisor
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
|
@ -19,7 +18,6 @@ ynh_script_progression --message="Loading installation settings..."
|
|||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$db_name
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
|
@ -32,10 +30,16 @@ datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
|||
#=================================================
|
||||
|
||||
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
||||
if ynh_exec_warn_less yunohost service status $app >/dev/null
|
||||
if ynh_exec_warn_less yunohost service status "$app-app" >/dev/null
|
||||
then
|
||||
ynh_script_progression --message="Removing $app service integration..."
|
||||
yunohost service remove $app
|
||||
ynh_script_progression --message="Removing $app-app service integration..."
|
||||
yunohost service remove "$app-app"
|
||||
fi
|
||||
|
||||
if ynh_exec_warn_less yunohost service status "$app-worker" >/dev/null
|
||||
then
|
||||
ynh_script_progression --message="Removing $app-worker service integration..."
|
||||
yunohost service remove "$app-worker"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
@ -44,15 +48,8 @@ fi
|
|||
ynh_script_progression --message="Stopping and removing the systemd service..."
|
||||
|
||||
# Remove the dedicated systemd config
|
||||
ynh_remove_supervisor_config
|
||||
|
||||
#=================================================
|
||||
# REMOVE LOGROTATE CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing logrotate configuration..."
|
||||
|
||||
# Remove the app-specific logrotate config
|
||||
ynh_remove_logrotate
|
||||
ynh_remove_systemd_config --service="$app-app"
|
||||
ynh_remove_systemd_config --service="$app-worker"
|
||||
|
||||
#=================================================
|
||||
# REMOVE THE POSTGRESQL DATABASE
|
||||
|
@ -99,19 +96,6 @@ ynh_remove_ruby
|
|||
ynh_remove_nodejs
|
||||
ynh_remove_app_dependencies
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC REMOVE
|
||||
#=================================================
|
||||
# REMOVE VARIOUS FILES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing various files..."
|
||||
|
||||
# Remove the log files
|
||||
ynh_secure_remove --file="/var/log/supervisor/$app-app-stderr.log"
|
||||
ynh_secure_remove --file="/var/log/supervisor/$app-app-stdout.log"
|
||||
ynh_secure_remove --file="/var/log/supervisor/$app-worker-stderr.log"
|
||||
ynh_secure_remove --file="/var/log/supervisor/$app-worker-stdout.log"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||
source ../settings/scripts/_common.sh
|
||||
source ../settings/scripts/ynh_install_ruby__2
|
||||
source ../settings/scripts/ynh_supervisor
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
|
@ -94,10 +93,10 @@ chown -R $app:www-data "$datadir"
|
|||
ynh_script_progression --message="Reinstalling dependencies..."
|
||||
|
||||
# Define and install dependencies
|
||||
ynh_install_app_dependencies $pkg_dependencies $build_pkg_dependencies
|
||||
ynh_install_ruby --ruby_version=$ruby_version
|
||||
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies $build_pkg_dependencies
|
||||
ynh_exec_warn_less ynh_install_ruby --ruby_version=$ruby_version
|
||||
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||
ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
|
||||
ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE POSTGRESQL DATABASE
|
||||
|
@ -124,11 +123,11 @@ pushd $final_path
|
|||
ynh_exec_warn_less $ynh_gem install bundler
|
||||
ynh_exec_warn_less bin/bundle config --global frozen 1
|
||||
ynh_exec_warn_less bin/bundle config set --local without 'development test doc'
|
||||
ynh_exec_warn_less bin/bundle install --binstubs
|
||||
ynh_exec_warn_less bin/bundle install
|
||||
ynh_exec_warn_less bin/bundle binstubs --all
|
||||
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 cache clean
|
||||
ynh_exec_warn_less ynh_exec_as $app env RAILS_ENV=production RACK_ENV=production $ynh_ruby_load_path 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/bundle exec rake assets:precompile
|
||||
popd
|
||||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
@ -139,30 +138,25 @@ ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ st
|
|||
#=================================================
|
||||
ynh_script_progression --message="Restoring the systemd configuration..."
|
||||
|
||||
ynh_restore_file --origin_path="/etc/supervisor/conf.d/$app.conf"
|
||||
ynh_add_supervisor_config
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE LOGROTATE CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the logrotate configuration..."
|
||||
|
||||
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||
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" "$app-worker" --quiet
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||
|
||||
yunohost service add $app --log="/var/log/supervisor/$app-app-stdout.log /var/log/supervisor/$app-worker-stdout.log"
|
||||
yunohost service add "$app-app" --description="$app app service"
|
||||
yunohost service add "$app-worker" --description="$app worker service"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..."
|
||||
|
||||
# Start a systemd service
|
||||
ynh_supervisor_action --service_name=$app --action="start" --log_path="/var/log/supervisor/$app-app-stdout.log" --line_match="Listening on"
|
||||
ynh_systemd_action --service_name=${app}-app --action="start" --log_path=systemd --line_match="Listening on"
|
||||
ynh_systemd_action --service_name=${app}-worker --action="start" --log_path=systemd --line_match="Schedules Loaded"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
|
|
|
@ -59,7 +59,8 @@ ynh_abort_if_errors
|
|||
#=================================================
|
||||
ynh_script_progression --message="Stopping a systemd service..."
|
||||
|
||||
ynh_supervisor_action --service_name=$app --action="stop" --log_path="/var/log/supervisor/$app-app-stdout.log"
|
||||
ynh_systemd_action --service_name=${app}-app --action="stop" --log_path=systemd --line_match="Stopped"
|
||||
ynh_systemd_action --service_name=${app}-worker --action="stop" --log_path=systemd --line_match="Stopped"
|
||||
|
||||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
|
@ -73,6 +74,21 @@ if ynh_legacy_permissions_exists; then
|
|||
ynh_app_setting_delete --app=$app --key=is_public
|
||||
fi
|
||||
|
||||
if ynh_exec_warn_less yunohost service status $app >/dev/null
|
||||
then
|
||||
ynh_script_progression --message="Removing $app service integration..."
|
||||
yunohost service remove $app
|
||||
fi
|
||||
|
||||
ynh_remove_logrotate
|
||||
|
||||
ynh_remove_supervisor_config
|
||||
|
||||
ynh_secure_remove --file="/var/log/supervisor/$app-app-stderr.log"
|
||||
ynh_secure_remove --file="/var/log/supervisor/$app-app-stdout.log"
|
||||
ynh_secure_remove --file="/var/log/supervisor/$app-worker-stderr.log"
|
||||
ynh_secure_remove --file="/var/log/supervisor/$app-worker-stdout.log"
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
|
@ -110,10 +126,10 @@ ynh_add_nginx_config
|
|||
#=================================================
|
||||
ynh_script_progression --message="Upgrading dependencies..."
|
||||
|
||||
ynh_install_app_dependencies $pkg_dependencies $build_pkg_dependencies
|
||||
ynh_install_ruby --ruby_version=$ruby_version
|
||||
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies $build_pkg_dependencies
|
||||
ynh_exec_warn_less ynh_install_ruby --ruby_version=$ruby_version
|
||||
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||
ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
|
||||
ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC UPGRADE
|
||||
|
@ -142,14 +158,14 @@ then
|
|||
ynh_exec_warn_less $ynh_gem install bundler
|
||||
ynh_exec_warn_less bin/bundle config --global frozen 1
|
||||
ynh_exec_warn_less bin/bundle config set --local without 'development test doc'
|
||||
ynh_exec_warn_less bin/bundle install --binstubs
|
||||
ynh_exec_warn_less bin/bundle install
|
||||
ynh_exec_warn_less bin/bundle binstubs --all
|
||||
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 cache clean
|
||||
ynh_psql_execute_as_root --sql="ALTER USER $db_user WITH SUPERUSER;" --database="$db_name"
|
||||
ynh_exec_warn_less ynh_exec_as $app env RAILS_ENV=production RACK_ENV=production $ynh_ruby_load_path bin/bundle exec rake db:migrate
|
||||
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 --sql="ALTER USER $db_user WITH NOSUPERUSER;" --database="$db_name"
|
||||
ynh_exec_warn_less ynh_exec_as $app env RAILS_ENV=production RACK_ENV=production $ynh_ruby_load_path 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/bundle exec rake assets:precompile
|
||||
popd
|
||||
fi
|
||||
|
||||
|
@ -162,31 +178,26 @@ ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ st
|
|||
ynh_script_progression --message="Upgrading systemd configuration..."
|
||||
|
||||
# Create a dedicated systemd config
|
||||
ynh_add_supervisor_config
|
||||
ynh_add_systemd_config --service="$app-app" --template="fab-manager-app.service"
|
||||
ynh_add_systemd_config --service="$app-worker" --template="fab-manager-worker.service"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# SETUP LOGROTATE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading logrotate configuration..."
|
||||
|
||||
# Use logrotate to manage app-specific logfile(s)
|
||||
ynh_use_logrotate --non-append
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||
|
||||
yunohost service add $app --log="/var/log/supervisor/$app-app-stdout.log /var/log/supervisor/$app-worker-stdout.log"
|
||||
yunohost service add "$app-app" --description="$app app service"
|
||||
yunohost service add "$app-worker" --description="$app worker service"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..."
|
||||
|
||||
ynh_supervisor_action --service_name=$app --action="start" --log_path="/var/log/supervisor/$app-app-stdout.log" --line_match="Listening on"
|
||||
ynh_systemd_action --service_name=${app}-app --action="start" --log_path=systemd --line_match="Listening on"
|
||||
ynh_systemd_action --service_name=${app}-worker --action="start" --log_path=systemd --line_match="Schedules Loaded"
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
|
|
Loading…
Add table
Reference in a new issue