This commit is contained in:
Éric Gaspar 2024-08-31 22:34:54 +02:00
parent d109dfb7bb
commit a659b91efe
7 changed files with 8 additions and 36 deletions

View file

@ -20,7 +20,7 @@ code = "https://framagit.org/framasoft/peertube/search-index"
fund = "https://framasoft.org/fr/#support" fund = "https://framasoft.org/fr/#support"
[integration] [integration]
yunohost = ">= 11.2.18" yunohost = ">= 11.2.29"
helpers_version = "2.1" helpers_version = "2.1"
architectures = "all" architectures = "all"
multi_instance = true multi_instance = true

View file

@ -1,6 +1,5 @@
#!/bin/bash #!/bin/bash
# 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/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers

View file

@ -22,7 +22,6 @@ ynh_config_change_url_nginx
#================================================= #=================================================
ynh_script_progression "Starting $app's systemd service..." ynh_script_progression "Starting $app's systemd service..."
# Start a systemd service
ynh_systemctl --service="$app" --action="start" --log_path="systemd" --wait_until="Server listening on port" ynh_systemctl --service="$app" --action="start" --log_path="systemd" --wait_until="Server listening on port"
#================================================= #=================================================

View file

@ -27,8 +27,7 @@ systemctl start elasticsearch.service
ynh_script_progression "Setting up source files..." ynh_script_progression "Setting up source files..."
_git_clone_or_pull "$install_dir/sources" _git_clone_or_pull "$install_dir/sources"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R "$app:$app" "$install_dir"
#================================================= #=================================================
# BUILDING # BUILDING
#================================================= #=================================================
@ -36,9 +35,9 @@ ynh_script_progression "Building..."
pushd "$install_dir/sources" pushd "$install_dir/sources"
ynh_exec_as_app node_load_PATH" yarn install --pure-lockfile ynh_hide_warnings ynh_exec_as_app yarn install --pure-lockfile
ynh_exec_as_app mkdir -p "dist" ynh_exec_as_app mkdir -p "dist"
ynh_exec_as_app node_load_PATH" npm run build ynh_hide_warnings ynh_exec_as_app npm run build
popd popd
#================================================= #=================================================
@ -48,22 +47,16 @@ ynh_script_progression "Adding a config file..."
ynh_config_add --template="default.yaml" --destination="$install_dir/sources/config/production.yaml" ynh_config_add --template="default.yaml" --destination="$install_dir/sources/config/production.yaml"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$install_dir/sources/config/production.yaml"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown "$app:$app" "$install_dir/sources/config/production.yaml"
#================================================= #=================================================
# SYSTEM CONFIGURATION # SYSTEM CONFIGURATION
#================================================= #=================================================
ynh_script_progression "Adding system configurations related to $app..." ynh_script_progression "Adding system configurations related to $app..."
# Create a dedicated NGINX config
ynh_config_add_nginx ynh_config_add_nginx
# Create a dedicated systemd config
ynh_config_add_systemd ynh_config_add_systemd
yunohost service add "$app" --description="$app search index daemon" yunohost service add "$app" --description="$app search index daemon"
# Use logrotate to manage application logfile(s)
ynh_config_add_logrotate ynh_config_add_logrotate
#================================================= #=================================================
@ -71,7 +64,6 @@ ynh_config_add_logrotate
#================================================= #=================================================
ynh_script_progression "Starting $app's systemd service..." ynh_script_progression "Starting $app's systemd service..."
# Start a systemd service
ynh_systemctl --service="$app" --action="start" --log_path="systemd" --wait_until="Server listening on port" ynh_systemctl --service="$app" --action="start" --log_path="systemd" --wait_until="Server listening on port"
#================================================= #=================================================

View file

@ -8,18 +8,14 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
ynh_script_progression "Removing system configurations related to $app..." ynh_script_progression "Removing system configurations related to $app..."
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
if ynh_hide_warnings yunohost service status "$app" >/dev/null; then if ynh_hide_warnings yunohost service status "$app" >/dev/null; then
yunohost service remove "$app" yunohost service remove "$app"
fi fi
# Remove the dedicated systemd config
ynh_config_remove_systemd ynh_config_remove_systemd
# Remove the app-specific logrotate config
ynh_config_remove_logrotate ynh_config_remove_logrotate
# Remove the dedicated NGINX config
ynh_config_remove_nginx ynh_config_remove_nginx
#================================================= #=================================================

View file

@ -1,6 +1,5 @@
#!/bin/bash #!/bin/bash
# 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/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
@ -26,8 +25,6 @@ ynh_script_progression "Restoring the app main directory..."
ynh_restore "$install_dir" ynh_restore "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R "$app:$app" "$install_dir"
#================================================= #=================================================
# RESTORE SYSTEM CONFIGURATIONS # RESTORE SYSTEM CONFIGURATIONS
#================================================= #=================================================
@ -37,6 +34,7 @@ ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_restore "/etc/systemd/system/$app.service" ynh_restore "/etc/systemd/system/$app.service"
systemctl enable "$app.service" --quiet systemctl enable "$app.service" --quiet
yunohost service add "$app" --description="$app search index daemon" yunohost service add "$app" --description="$app search index daemon"
ynh_restore "/etc/logrotate.d/$app" ynh_restore "/etc/logrotate.d/$app"

View file

@ -37,28 +37,22 @@ if [ -d "$install_dir/.git" ]; then
mv "${install_dir}__tmp__" "$install_dir" mv "${install_dir}__tmp__" "$install_dir"
fi fi
# Fix upgrade from 0.0.1.2022.06.03~ynh1
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 750 "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R "$app:$app" "$install_dir"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_script_progression "Upgrading source files..." ynh_script_progression "Upgrading source files..."
_git_clone_or_pull "$install_dir/sources" _git_clone_or_pull "$install_dir/sources"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R "$app:$app" "$install_dir"
#================================================= #=================================================
# BUILDING # BUILDING
#================================================= #=================================================
ynh_script_progression "Building..." ynh_script_progression "Building..."
pushd "$install_dir/sources" pushd "$install_dir/sources"
ynh_hide_warnings ynh_exec_as_app yarn install --pure-lockfile
ynh_exec_as_app node_load_PATH" yarn install --pure-lockfile
ynh_exec_as_app mkdir -p "dist" ynh_exec_as_app mkdir -p "dist"
ynh_exec_as_app node_load_PATH" npm run build ynh_hide_warnings ynh_exec_as_app npm run build
popd popd
#================================================= #=================================================
@ -68,22 +62,16 @@ ynh_script_progression "Updating a config file..."
ynh_config_add --template="default.yaml" --destination="$install_dir/sources/config/production.yaml" ynh_config_add --template="default.yaml" --destination="$install_dir/sources/config/production.yaml"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$install_dir/sources/config/production.yaml"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown "$app:$app" "$install_dir/sources/config/production.yaml"
#================================================= #=================================================
# REAPPLY SYSTEM CONFIGURATIONS # REAPPLY SYSTEM CONFIGURATIONS
#================================================= #=================================================
ynh_script_progression "Upgrading system configurations related to $app..." ynh_script_progression "Upgrading system configurations related to $app..."
# Create a dedicated NGINX config
ynh_config_add_nginx ynh_config_add_nginx
# Create a dedicated systemd config
ynh_config_add_systemd ynh_config_add_systemd
yunohost service add "$app" --description="$app search index daemon" yunohost service add "$app" --description="$app search index daemon"
# Use logrotate to manage app-specific logfile(s)
ynh_config_add_logrotate ynh_config_add_logrotate
#================================================= #=================================================