mirror of
https://github.com/YunoHost-Apps/fab-manager_ynh.git
synced 2024-09-03 18:36:16 +02:00
Bump version, add email config, remove supervisor code - from eric_g
This commit is contained in:
parent
0a6515d2fc
commit
b128e8e28e
4 changed files with 20 additions and 185 deletions
|
@ -5,8 +5,8 @@ production:
|
||||||
delivery_method: 'smtp'
|
delivery_method: 'smtp'
|
||||||
smtp_address: 'localhost'
|
smtp_address: 'localhost'
|
||||||
smtp_port: 25
|
smtp_port: 25
|
||||||
smtp_user_name:
|
smtp_user_name: '__APP__'
|
||||||
smtp_password:
|
smtp_password: '__MAIL_PWD__'
|
||||||
time_zone: 'Paris'
|
time_zone: 'Paris'
|
||||||
smtp_authentication: 'none'
|
smtp_authentication: 'none'
|
||||||
smtp_enable_starttls_auto: false
|
smtp_enable_starttls_auto: false
|
||||||
|
|
|
@ -6,7 +6,7 @@ id = "fab-manager"
|
||||||
name = "Fab-manager"
|
name = "Fab-manager"
|
||||||
description.en = "Fab Lab management solution."
|
description.en = "Fab Lab management solution."
|
||||||
|
|
||||||
version = "5.6.5~ynh2"
|
version = "6.3.9~ynh1"
|
||||||
|
|
||||||
maintainers = []
|
maintainers = []
|
||||||
|
|
||||||
|
@ -21,11 +21,13 @@ code = "https://github.com/sleede/fab-manager"
|
||||||
yunohost = ">= 11.2"
|
yunohost = ">= 11.2"
|
||||||
architectures = "all"
|
architectures = "all"
|
||||||
multi_instance = false
|
multi_instance = false
|
||||||
|
|
||||||
ldap = false
|
ldap = false
|
||||||
sso = false
|
sso = false
|
||||||
disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ...
|
|
||||||
ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
|
disk = "50M"
|
||||||
ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
|
ram.build = "50M"
|
||||||
|
ram.runtime = "50M"
|
||||||
|
|
||||||
[install]
|
[install]
|
||||||
[install.domain]
|
[install.domain]
|
||||||
|
@ -45,12 +47,13 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen
|
||||||
|
|
||||||
[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.9.tar.gz"
|
||||||
sha256 = "dc6ae9fefd893975ee2b70c5b327a37b3d585dcf223ddffe75cc0b570771102d"
|
sha256 = "b6a68bf91009678a3a666cfd5cab8e3c636ac9fbb920e3e4e4bd29b093c7f43d"
|
||||||
|
|
||||||
autoupdate.strategy = "latest_github_tag"
|
autoupdate.strategy = "latest_github_tag"
|
||||||
|
|
||||||
[resources.system_user]
|
[resources.system_user]
|
||||||
|
allow_email = true
|
||||||
|
|
||||||
[resources.install_dir]
|
[resources.install_dir]
|
||||||
|
|
||||||
|
|
|
@ -4,10 +4,9 @@
|
||||||
# COMMON VARIABLES
|
# COMMON VARIABLES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ruby_version="2.6.10"
|
ruby_version="3.1"
|
||||||
bundler_version=2.1.4
|
|
||||||
|
|
||||||
nodejs_version="14"
|
nodejs_version="18"
|
||||||
|
|
||||||
# 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
|
||||||
|
|
|
@ -1,167 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Create a dedicated supervisor config
|
|
||||||
#
|
|
||||||
# usage: ynh_add_supervisor_config [--service=service] [--template=template]
|
|
||||||
# | arg: -s, --service= - Service name (optionnal, `$app` by default)
|
|
||||||
# | arg: -t, --template= - Name of template file (optionnal, this is 'supervisor' by default, meaning ./conf/supervisor.service will be used as template)
|
|
||||||
#
|
|
||||||
# This will use the template `../conf/<templatename>.service`.
|
|
||||||
#
|
|
||||||
# See the documentation of `ynh_add_config` for a description of the template
|
|
||||||
# format and how placeholders are replaced with actual variables.
|
|
||||||
#
|
|
||||||
# Requires YunoHost version 2.7.11 or higher.
|
|
||||||
ynh_add_supervisor_config () {
|
|
||||||
# Declare an array to define the options of this helper.
|
|
||||||
local legacy_args=stv
|
|
||||||
local -A args_array=( [s]=service= [t]=template= [v]=others_var=)
|
|
||||||
local service
|
|
||||||
local template
|
|
||||||
local others_var
|
|
||||||
# Manage arguments with getopts
|
|
||||||
ynh_handle_getopts_args "$@"
|
|
||||||
local service="${service:-$app}"
|
|
||||||
local template="${template:-supervisor.service}"
|
|
||||||
others_var="${others_var:-}"
|
|
||||||
|
|
||||||
[[ -z "$others_var" ]] || ynh_print_warn --message="Packagers: using --others_var is unecessary since Yunohost 4.2"
|
|
||||||
|
|
||||||
ynh_add_config --template="$YNH_APP_BASEDIR/conf/$template" --destination="/etc/supervisor/conf.d/$service.conf"
|
|
||||||
|
|
||||||
supervisorctl reread
|
|
||||||
supervisorctl update
|
|
||||||
}
|
|
||||||
|
|
||||||
# Remove the dedicated supervisor config
|
|
||||||
#
|
|
||||||
# usage: ynh_remove_supervisor_config [--service=service]
|
|
||||||
# | arg: -s, --service= - Service name (optionnal, $app by default)
|
|
||||||
#
|
|
||||||
# Requires YunoHost version 2.7.2 or higher.
|
|
||||||
ynh_remove_supervisor_config () {
|
|
||||||
# Declare an array to define the options of this helper.
|
|
||||||
local legacy_args=s
|
|
||||||
local -A args_array=( [s]=service= )
|
|
||||||
local service
|
|
||||||
# Manage arguments with getopts
|
|
||||||
ynh_handle_getopts_args "$@"
|
|
||||||
local service="${service:-$app}"
|
|
||||||
|
|
||||||
local finalsupervisorconf="/etc/supervisor/conf.d/$service.conf"
|
|
||||||
if [ -e "$finalsupervisorconf" ]
|
|
||||||
then
|
|
||||||
ynh_supervisor_action --service_name=$service --action=stop
|
|
||||||
ynh_secure_remove --file="$finalsupervisorconf"
|
|
||||||
supervisorctl reread
|
|
||||||
supervisorctl update
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Start (or other actions) a service, print a log in case of failure and optionnaly wait until the service is completely started
|
|
||||||
#
|
|
||||||
# usage: ynh_supervisor_action [--service_name=service_name] [--action=action] [ [--line_match="line to match"] [--log_path=log_path] [--timeout=300] [--length=20] ]
|
|
||||||
# | arg: -n, --service_name= - Name of the service to start. Default : `$app`
|
|
||||||
# | arg: -a, --action= - Action to perform with supervisorctl. Default: start
|
|
||||||
# | arg: -l, --line_match= - Line to match - The line to find in the log to attest the service have finished to boot. If not defined it don't wait until the service is completely started.
|
|
||||||
# | arg: -p, --log_path= - Log file - Path to the log file. Default : `/var/log/$app/$app.log`
|
|
||||||
# | arg: -t, --timeout= - Timeout - The maximum time to wait before ending the watching. Default : 300 seconds.
|
|
||||||
# | arg: -e, --length= - Length of the error log : Default : 20
|
|
||||||
#
|
|
||||||
# Requires YunoHost version 3.5.0 or higher.
|
|
||||||
ynh_supervisor_action() {
|
|
||||||
# Declare an array to define the options of this helper.
|
|
||||||
local legacy_args=nalpte
|
|
||||||
declare -Ar args_array=( [n]=service_name= [a]=action= [l]=line_match= [p]=log_path= [t]=timeout= [e]=length= )
|
|
||||||
local service_name
|
|
||||||
local action
|
|
||||||
local line_match
|
|
||||||
local length
|
|
||||||
local log_path
|
|
||||||
local timeout
|
|
||||||
# Manage arguments with getopts
|
|
||||||
ynh_handle_getopts_args "$@"
|
|
||||||
service_name="${service_name:-$app}"
|
|
||||||
action=${action:-start}
|
|
||||||
line_match=${line_match:-}
|
|
||||||
length=${length:-20}
|
|
||||||
log_path="${log_path:-/var/log/$service_name/$service_name.log}"
|
|
||||||
timeout=${timeout:-300}
|
|
||||||
|
|
||||||
# Start to read the log
|
|
||||||
if [[ -n "$line_match" ]]
|
|
||||||
then
|
|
||||||
local templog="$(mktemp)"
|
|
||||||
# Following the starting of the app in its log
|
|
||||||
if [ "$log_path" == "systemd" ]
|
|
||||||
then
|
|
||||||
# Read the supervisor journal
|
|
||||||
journalctl --unit=supervisor --follow --since=-0 --quiet > "$templog" &
|
|
||||||
# Get the PID of the journalctl command
|
|
||||||
local pid_tail=$!
|
|
||||||
else
|
|
||||||
# Read the specified log file
|
|
||||||
tail --follow=name --retry --lines=0 "$log_path" > "$templog" 2>&1 &
|
|
||||||
# Get the PID of the tail command
|
|
||||||
local pid_tail=$!
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Use reload-or-restart instead of reload. So it wouldn't fail if the service isn't running.
|
|
||||||
if [ "$action" == "reload" ]; then
|
|
||||||
action="update"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# If the service fails to perform the action
|
|
||||||
if ! supervisorctl $action $service_name
|
|
||||||
then
|
|
||||||
# Show syslog for this service
|
|
||||||
ynh_exec_err journalctl --quiet --no-hostname --no-pager --lines=$length --unit=$service_name
|
|
||||||
# If a log is specified for this service, show also the content of this log
|
|
||||||
if [ -e "$log_path" ]
|
|
||||||
then
|
|
||||||
ynh_exec_err tail --lines=$length "$log_path"
|
|
||||||
fi
|
|
||||||
ynh_clean_check_starting
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Start the timeout and try to find line_match
|
|
||||||
if [[ -n "${line_match:-}" ]]
|
|
||||||
then
|
|
||||||
set +x
|
|
||||||
local i=0
|
|
||||||
for i in $(seq 1 $timeout)
|
|
||||||
do
|
|
||||||
# Read the log until the sentence is found, that means the app finished to start. Or run until the timeout
|
|
||||||
if grep --extended-regexp --quiet "$line_match" "$templog"
|
|
||||||
then
|
|
||||||
ynh_print_info --message="The service $service_name has correctly executed the action ${action}."
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
if [ $i -eq 3 ]; then
|
|
||||||
echo -n "Please wait, the service $service_name is ${action}ing" >&2
|
|
||||||
fi
|
|
||||||
if [ $i -ge 3 ]; then
|
|
||||||
echo -n "." >&2
|
|
||||||
fi
|
|
||||||
sleep 1
|
|
||||||
done
|
|
||||||
set -x
|
|
||||||
if [ $i -ge 3 ]; then
|
|
||||||
echo "" >&2
|
|
||||||
fi
|
|
||||||
if [ $i -eq $timeout ]
|
|
||||||
then
|
|
||||||
ynh_print_warn --message="The service $service_name didn't fully executed the action ${action} before the timeout."
|
|
||||||
ynh_print_warn --message="Please find here an extract of the end of the log of the service $service_name:"
|
|
||||||
ynh_exec_warn journalctl --quiet --no-hostname --no-pager --lines=$length --unit=$service_name
|
|
||||||
if [ -e "$log_path" ]
|
|
||||||
then
|
|
||||||
ynh_print_warn --message="\-\-\-"
|
|
||||||
ynh_exec_warn tail --lines=$length "$log_path"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
ynh_clean_check_starting
|
|
||||||
fi
|
|
||||||
}
|
|
Loading…
Add table
Reference in a new issue