1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/archivebox_ynh.git synced 2024-09-03 18:15:54 +02:00

Merge pull request #39 from YunoHost-Apps/cleaning

Cleaning
This commit is contained in:
eric_G 2024-06-01 08:28:53 +02:00 committed by GitHub
commit c871c198e1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 70 additions and 175 deletions

View file

@ -16,7 +16,7 @@ It shall NOT be edited by hand.
## Overview
Archiving solution to collect, save, and view sites you want to preserve offline
Archiving solution to collect, save, and view sites you want to preserve offline.
**Shipped version:** 0.7.2~ynh1

View file

@ -16,7 +16,7 @@ No se debe editar a mano.
## Descripción general
Archiving solution to collect, save, and view sites you want to preserve offline
Archiving solution to collect, save, and view sites you want to preserve offline.
**Versión actual:** 0.7.2~ynh1

View file

@ -16,7 +16,7 @@ EZ editatu eskuz.
## Aurreikuspena
Archiving solution to collect, save, and view sites you want to preserve offline
Archiving solution to collect, save, and view sites you want to preserve offline.
**Paketatutako bertsioa:** 0.7.2~ynh1

View file

@ -16,7 +16,7 @@ Il NE doit PAS être modifié à la main.
## Vue densemble
Archiving solution to collect, save, and view sites you want to preserve offline
Archiving solution to collect, save, and view sites you want to preserve offline.
**Version incluse:** 0.7.2~ynh1

View file

@ -16,7 +16,7 @@ NON debe editarse manualmente.
## Vista xeral
Archiving solution to collect, save, and view sites you want to preserve offline
Archiving solution to collect, save, and view sites you want to preserve offline.
**Versión proporcionada:** 0.7.2~ynh1

View file

@ -16,7 +16,7 @@
## 概况
Archiving solution to collect, save, and view sites you want to preserve offline
Archiving solution to collect, save, and view sites you want to preserve offline.
**分发版本:** 0.7.2~ynh1

View file

@ -1 +1 @@
archivebox==0.6.2;
archivebox==0.7.2;

View file

@ -1 +1 @@
Archiving solution to collect, save, and view sites you want to preserve offline
Archiving solution to collect, save, and view sites you want to preserve offline.

View file

@ -1,5 +1,5 @@
this is documentation for developers working on archivebox_ynh package (or myself in the future),
for how to keep this package up to date with the upstream archivebox package on github
for how to keep this package up to date with the upstream archivebox package on GitHub
as it is updated.
## 1. apt-get dependencies

View file

@ -46,7 +46,7 @@ ram.runtime = "50M"
type = "user"
[install.password]
help.en = "Choose wisely a password that is different from the username and does not contain the `$` symbol."
help.en = "Choose a password that is different from the username and does not contain the `$` symbol."
help.fr = "Choisissez judicieusement un mot de passe différent du nom d'utilisateur et ne contenant pas le symbole `$`."
type = "password"
@ -68,4 +68,4 @@ ram.runtime = "50M"
main.url = "/"
[resources.apt]
packages = "python3-venv expect apt-transport-https ca-certificates gnupg2 zlib1g-dev dumb-init gosu cron unzip curl fontconfig fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-symbola fonts-noto fonts-freefont-ttf wget curl chromium git ffmpeg youtube-dl ripgrep build-essential python3-dev"
packages = "python3-venv, expect, apt-transport-https, ca-certificates, gnupg2, zlib1g-dev, dumb-init, gosu, unzip, curl, fontconfig, fonts-ipafont-gothic, fonts-wqy-zenhei, fonts-thai-tlwg, fonts-kacst, fonts-symbola, fonts-noto, fonts-freefont-ttf, wget, curl, chromium, ffmpeg, youtube-dl, ripgrep, build-essential, python3-dev"

View file

@ -4,7 +4,7 @@
# COMMON VARIABLES
#=================================================
nodejs_version=18
nodejs_version=20
#=================================================
# PERSONAL HELPERS

View file

@ -28,23 +28,13 @@ ynh_backup --src_path="$install_dir"
ynh_backup --src_path="$data_dir" --is_big
#=================================================
# BACKUP THE NGINX CONFIGURATION
# SYSTEM CONFIGURATION
#=================================================
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/systemd/system/$app.service"
#=================================================

View file

@ -35,14 +35,6 @@ mkdir -p $install_dir
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# SPECIFIC SETUP
#=================================================
@ -69,7 +61,7 @@ archivebox_cmd="$install_dir/venv/bin/archivebox"
#=================================================
# INSTALL NODE DEPENDENCIES
#=================================================
#REMOVEME? ynh_script_progression --message="Installing node dependencies..."
ynh_script_progression --message="Installing node dependencies..."
cp -f $tempdir/package.json "$install_dir/package.json"
cp -f $tempdir/package-lock.json "$install_dir/package-lock.json"
@ -84,7 +76,7 @@ popd
#=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1
ynh_add_config --template="../conf/ArchiveBox.conf" --destination="$data_dir/ArchiveBox.conf"
ynh_add_config --template="ArchiveBox.conf" --destination="$data_dir/ArchiveBox.conf"
chmod 600 "$data_dir/ArchiveBox.conf"
chown $app:$app "$data_dir/ArchiveBox.conf"
@ -92,7 +84,7 @@ chown $app:$app "$data_dir/ArchiveBox.conf"
#=================================================
# INITIALIZE ARCHIVEBOX
#=================================================
ynh_script_progression --message="Initializing Archivebox" --weight=1
ynh_script_progression --message="Initializing $app" --weight=1
pushd $data_dir
ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $archivebox_cmd init
@ -116,7 +108,7 @@ send -- "$password\r"
expect eof
EOF
else
ynh_script_progression --message="Creating new archivebox superuser: $admin" --weight=1
ynh_script_progression --message="Creating new Archivebox superuser: $admin" --weight=1
ynh_exec_as $app /usr/bin/expect<<EOF
set force_conservative 0 ;
set timeout -1
@ -135,28 +127,19 @@ EOF
popd
#=================================================
# SETUP SYSTEMD
# SYSTEM CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring a systemd service..." --weight=1
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
# Create a dedicated systemd config
ynh_add_systemd_config
#=================================================
# GENERIC FINALIZATION
#=================================================
# SETUP LOGROTATE
#=================================================
ynh_script_progression --message="Configuring log rotation..." --weight=1
# Use logrotate to manage application logfile(s)
ynh_use_logrotate
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="Self-hosted internet archiving" --log="/var/log/$app/$app.log"
#=================================================

View file

@ -10,10 +10,9 @@ source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# STANDARD REMOVE
#=================================================
# REMOVE SERVICE INTEGRATION IN YUNOHOST
# REMOVE SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
# 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
@ -22,37 +21,15 @@ then
yunohost service remove $app
fi
#=================================================
# STOP AND REMOVE SERVICE
#=================================================
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1
# Remove the dedicated systemd config
ynh_remove_systemd_config
#=================================================
# REMOVE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Removing logrotate configuration..." --weight=1
# Remove the app-specific logrotate config
ynh_remove_logrotate
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
# Remove the dedicated NGINX config
ynh_remove_nginx_config
#=================================================
# SPECIFIC REMOVE
#=================================================
# REMOVE VARIOUS FILES
#=================================================
ynh_script_progression --message="Removing various files..." --weight=1
# Remove the log files
ynh_secure_remove --file="/var/log/$app"

View file

@ -39,49 +39,31 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=1
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
#=================================================
# RESTORE THE NGINX CONFIGURATION
# RESTORE SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RESTORE SYSTEMD
#=================================================
ynh_script_progression --message="Restoring the systemd configuration..." --weight=1
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable $app.service --quiet
yunohost service add $app --description="Self-hosted internet archiving" --log="/var/log/$app/$app.log"
#=================================================
# RESTORE THE LOGROTATE CONFIGURATION
# RESTORE VARIOUS FILES
#=================================================
ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1
mkdir -p /var/log/$app
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="Self-hosted internet archiving" --log="/var/log/$app/$app.log"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
#=================================================
# GENERIC FINALIZATION
#=================================================
# RELOAD NGINX AND PHP-FPM
#=================================================
ynh_script_progression --message="Reloading NGINX" --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#=================================================

View file

@ -9,12 +9,6 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# CHECK VERSION
#=================================================
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
@ -27,16 +21,12 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..." --weight=1
# Download, check integrity, uncompress and patch the source from app.src
tempdir="$(mktemp -d)"
ynh_setup_source --dest_dir="$tempdir"
mkdir -p $install_dir
fi
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
@ -48,23 +38,13 @@ ynh_script_progression --message="Upgrading dependencies..." --weight=1
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# SPECIFIC UPGRADE
#=================================================
# UPGRADE VIA PIP
#=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading via pip" --weight=1
ynh_use_nodejs
python3 -m venv "${install_dir}/venv"
cp ../conf/requirements.txt "$install_dir/requirements.txt"
@ -81,14 +61,10 @@ then
# we use this virtualenv archivebox for further commands now
archivebox_cmd="$install_dir/venv/bin/archivebox"
fi
#=================================================
# UPGRADE NODE DEPENDENCIES
#=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading node dependencies..."
cp -f $tempdir/package.json "$install_dir/package.json"
@ -98,7 +74,6 @@ then
ynh_use_nodejs
ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm ci
popd
fi
#=================================================
# UPDATE A CONFIG FILE
@ -106,7 +81,7 @@ fi
ynh_script_progression --message="Updating a configuration file..." --weight=1
ynh_store_file_checksum --file="$data_dir/ArchiveBox.conf"
ynh_add_config --template="../conf/ArchiveBox.conf" --destination="$data_dir/ArchiveBox.conf"
ynh_add_config --template="ArchiveBox.conf" --destination="$data_dir/ArchiveBox.conf"
chmod 600 "$data_dir/ArchiveBox.conf"
chown $app:$app "$data_dir/ArchiveBox.conf"
@ -115,38 +90,26 @@ chown $app:$app "$data_dir/ArchiveBox.conf"
# FINISH ARCHIVEBOX SETUP
#=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
# rerun archivebox setup (its idempotent, so it should be ok during upgrade)
ynh_script_progression --message="Finishing Archivebox Setup" --weight=1
pushd $data_dir
ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $archivebox_cmd init --setup
popd
fi
#=================================================
# SETUP SYSTEMD
# REAPPLY SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Upgrading systemd configuration..." --weight=1
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
# Create a dedicated systemd config
ynh_add_systemd_config
#=================================================
# GENERIC FINALIZATION
#=================================================
# SETUP LOGROTATE
#=================================================
ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1
# 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..." --weight=1
yunohost service add $app --description="Self-hosted internet archiving" --log="/var/log/$app/$app.log"
#=================================================