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

Merge branch 'testing' into pr/37

This commit is contained in:
ericgaspar 2024-06-01 19:53:15 +02:00
commit 72eedff8bf
16 changed files with 304 additions and 199 deletions

8
ALL_README.md Normal file
View file

@ -0,0 +1,8 @@
# All available README files by language
- [Read the README in English](README.md)
- [Lea el README en español](README_es.md)
- [Irakurri README euskaraz](README_eu.md)
- [Lire le README en français](README_fr.md)
- [Le o README en galego](README_gl.md)
- [阅读中文(简体)的 README](README_zh_Hans.md)

View file

@ -1,5 +1,5 @@
<!--
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/readme_generator
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.
-->
@ -9,19 +9,19 @@ It shall NOT be edited by hand.
[![Install ArchiveBox with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=archivebox)
*[Lire ce readme en français.](./README_fr.md)*
*[Read this README in other languages.](./ALL_README.md)*
> *This package allows you to install ArchiveBox quickly and simply on a YunoHost server.
If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
> *This package allows you to install ArchiveBox quickly and simply on a YunoHost server.*
> *If you don't have YunoHost, please consult [the guide](https://yunohost.org/install) to learn how to install it.*
## 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
**Demo:** https://archiveboxdemo.commoninternet.net
**Demo:** <https://archiveboxdemo.commoninternet.net>
## Screenshots
@ -29,22 +29,22 @@ Archiving solution to collect, save, and view sites you want to preserve offline
## Documentation and resources
* Official app website: <https://archivebox.io/>
* Official admin documentation: <https://github.com/ArchiveBox/ArchiveBox/wiki>
* Upstream app code repository: <https://github.com/ArchiveBox/ArchiveBox>
* YunoHost Store: <https://apps.yunohost.org/app/archivebox>
* Report a bug: <https://github.com/YunoHost-Apps/archivebox_ynh/issues>
- Official app website: <https://archivebox.io/>
- Official admin documentation: <https://github.com/ArchiveBox/ArchiveBox/wiki>
- Upstream app code repository: <https://github.com/ArchiveBox/ArchiveBox>
- YunoHost Store: <https://apps.yunohost.org/app/archivebox>
- Report a bug: <https://github.com/YunoHost-Apps/archivebox_ynh/issues>
## Developer info
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/archivebox_ynh/tree/testing).
Please send your pull request to the [`testing` branch](https://github.com/YunoHost-Apps/archivebox_ynh/tree/testing).
To try the testing branch, please proceed like that.
To try the `testing` branch, please proceed like that:
``` bash
```bash
sudo yunohost app install https://github.com/YunoHost-Apps/archivebox_ynh/tree/testing --debug
or
sudo yunohost app upgrade archivebox -u https://github.com/YunoHost-Apps/archivebox_ynh/tree/testing --debug
```
**More info regarding app packaging:** <https://yunohost.org/packaging_apps>
**More info regarding app packaging:** <https://yunohost.org/packaging_apps>

50
README_es.md Normal file
View file

@ -0,0 +1,50 @@
<!--
Este archivo README esta generado automaticamente<https://github.com/YunoHost/apps/tree/master/tools/readme_generator>
No se debe editar a mano.
-->
# ArchiveBox para Yunohost
[![Nivel de integración](https://dash.yunohost.org/integration/archivebox.svg)](https://dash.yunohost.org/appci/app/archivebox) ![Estado funcional](https://ci-apps.yunohost.org/ci/badges/archivebox.status.svg) ![Estado En Mantención](https://ci-apps.yunohost.org/ci/badges/archivebox.maintain.svg)
[![Instalar ArchiveBox con Yunhost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=archivebox)
*[Leer este README en otros idiomas.](./ALL_README.md)*
> *Este paquete le permite instalarArchiveBox rapidamente y simplement en un servidor YunoHost.*
> *Si no tiene YunoHost, visita [the guide](https://yunohost.org/install) para aprender como instalarla.*
## Descripción general
Archiving solution to collect, save, and view sites you want to preserve offline.
**Versión actual:** 0.7.2~ynh1
**Demo:** <https://archiveboxdemo.commoninternet.net>
## Capturas
![Captura de ArchiveBox](./doc/screenshots/screenshot_archivebox1.png)
## Documentaciones y recursos
- Sitio web oficial: <https://archivebox.io/>
- Documentación administrador oficial: <https://github.com/ArchiveBox/ArchiveBox/wiki>
- Repositorio del código fuente oficial de la aplicación : <https://github.com/ArchiveBox/ArchiveBox>
- Catálogo YunoHost: <https://apps.yunohost.org/app/archivebox>
- Reportar un error: <https://github.com/YunoHost-Apps/archivebox_ynh/issues>
## Información para desarrolladores
Por favor enviar sus correcciones a la [`branch testing`](https://github.com/YunoHost-Apps/archivebox_ynh/tree/testing
Para probar la rama `testing`, sigue asÍ:
```bash
sudo yunohost app install https://github.com/YunoHost-Apps/archivebox_ynh/tree/testing --debug
o
sudo yunohost app upgrade archivebox -u https://github.com/YunoHost-Apps/archivebox_ynh/tree/testing --debug
```
**Mas informaciones sobre el empaquetado de aplicaciones:** <https://yunohost.org/packaging_apps>

50
README_eu.md Normal file
View file

@ -0,0 +1,50 @@
<!--
Ohart ongi: README hau automatikoki sortu da <https://github.com/YunoHost/apps/tree/master/tools/readme_generator>ri esker
EZ editatu eskuz.
-->
# ArchiveBox YunoHost-erako
[![Integrazio maila](https://dash.yunohost.org/integration/archivebox.svg)](https://dash.yunohost.org/appci/app/archivebox) ![Funtzionamendu egoera](https://ci-apps.yunohost.org/ci/badges/archivebox.status.svg) ![Mantentze egoera](https://ci-apps.yunohost.org/ci/badges/archivebox.maintain.svg)
[![Instalatu ArchiveBox YunoHost-ekin](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=archivebox)
*[Irakurri README hau beste hizkuntzatan.](./ALL_README.md)*
> *Pakete honek ArchiveBox YunoHost zerbitzari batean azkar eta zailtasunik gabe instalatzea ahalbidetzen dizu.*
> *YunoHost ez baduzu, kontsultatu [gida](https://yunohost.org/install) nola instalatu ikasteko.*
## Aurreikuspena
Archiving solution to collect, save, and view sites you want to preserve offline.
**Paketatutako bertsioa:** 0.7.2~ynh1
**Demoa:** <https://archiveboxdemo.commoninternet.net>
## Pantaila-argazkiak
![ArchiveBox(r)en pantaila-argazkia](./doc/screenshots/screenshot_archivebox1.png)
## Dokumentazioa eta baliabideak
- Aplikazioaren webgune ofiziala: <https://archivebox.io/>
- Administratzaileen dokumentazio ofiziala: <https://github.com/ArchiveBox/ArchiveBox/wiki>
- Jatorrizko aplikazioaren kode-gordailua: <https://github.com/ArchiveBox/ArchiveBox>
- YunoHost Denda: <https://apps.yunohost.org/app/archivebox>
- Eman errore baten berri: <https://github.com/YunoHost-Apps/archivebox_ynh/issues>
## Garatzaileentzako informazioa
Bidali `pull request`a [`testing` abarrera](https://github.com/YunoHost-Apps/archivebox_ynh/tree/testing).
`testing` abarra probatzeko, ondorengoa egin:
```bash
sudo yunohost app install https://github.com/YunoHost-Apps/archivebox_ynh/tree/testing --debug
edo
sudo yunohost app upgrade archivebox -u https://github.com/YunoHost-Apps/archivebox_ynh/tree/testing --debug
```
**Informazio gehiago aplikazioaren paketatzeari buruz:** <https://yunohost.org/packaging_apps>

View file

@ -1,6 +1,6 @@
<!--
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.
Nota bene: ce README est automatiquement généré par <https://github.com/YunoHost/apps/tree/master/tools/readme_generator>
Il NE doit PAS être modifié à la main.
-->
# ArchiveBox pour YunoHost
@ -9,19 +9,19 @@ It shall NOT be edited by hand.
[![Installer ArchiveBox avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=archivebox)
*[Read this readme in english.](./README.md)*
*[Lire le README dans d'autres langues.](./ALL_README.md)*
> *Ce package vous permet dinstaller ArchiveBox rapidement et simplement sur un serveur YunoHost.
Si vous navez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment linstaller et en profiter.*
> *Ce package vous permet dinstaller ArchiveBox rapidement et simplement sur un serveur YunoHost.*
> *Si vous navez pas YunoHost, consultez [ce guide](https://yunohost.org/install) pour savoir comment linstaller et en profiter.*
## 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
**Version incluse:** 0.7.2~ynh1
**Démo :** https://archiveboxdemo.commoninternet.net
**Démo:** <https://archiveboxdemo.commoninternet.net>
## Captures décran
@ -29,22 +29,22 @@ Archiving solution to collect, save, and view sites you want to preserve offline
## Documentations et ressources
* Site officiel de lapp : <https://archivebox.io/>
* Documentation officielle de ladmin : <https://github.com/ArchiveBox/ArchiveBox/wiki>
* Dépôt de code officiel de lapp : <https://github.com/ArchiveBox/ArchiveBox>
* YunoHost Store: <https://apps.yunohost.org/app/archivebox>
* Signaler un bug : <https://github.com/YunoHost-Apps/archivebox_ynh/issues>
- Site officiel de lapp: <https://archivebox.io/>
- Documentation officielle de ladmin: <https://github.com/ArchiveBox/ArchiveBox/wiki>
- Dépôt de code officiel de lapp: <https://github.com/ArchiveBox/ArchiveBox>
- YunoHost Store: <https://apps.yunohost.org/app/archivebox>
- Signaler un bug: <https://github.com/YunoHost-Apps/archivebox_ynh/issues>
## Informations pour les développeurs
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/archivebox_ynh/tree/testing).
Merci de faire vos pull request sur la [branche `testing`](https://github.com/YunoHost-Apps/archivebox_ynh/tree/testing).
Pour essayer la branche testing, procédez comme suit.
Pour essayer la branche `testing`, procédez comme suit:
``` bash
```bash
sudo yunohost app install https://github.com/YunoHost-Apps/archivebox_ynh/tree/testing --debug
ou
sudo yunohost app upgrade archivebox -u https://github.com/YunoHost-Apps/archivebox_ynh/tree/testing --debug
```
**Plus dinfos sur le packaging dapplications :** <https://yunohost.org/packaging_apps>
**Plus dinfos sur le packaging dapplications:** <https://yunohost.org/packaging_apps>

50
README_gl.md Normal file
View file

@ -0,0 +1,50 @@
<!--
NOTA: Este README foi creado automáticamente por <https://github.com/YunoHost/apps/tree/master/tools/readme_generator>
NON debe editarse manualmente.
-->
# ArchiveBox para YunoHost
[![Nivel de integración](https://dash.yunohost.org/integration/archivebox.svg)](https://dash.yunohost.org/appci/app/archivebox) ![Estado de funcionamento](https://ci-apps.yunohost.org/ci/badges/archivebox.status.svg) ![Estado de mantemento](https://ci-apps.yunohost.org/ci/badges/archivebox.maintain.svg)
[![Instalar ArchiveBox con YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=archivebox)
*[Le este README en outros idiomas.](./ALL_README.md)*
> *Este paquete permíteche instalar ArchiveBox de xeito rápido e doado nun servidor YunoHost.*
> *Se non usas YunoHost, le a [documentación](https://yunohost.org/install) para saber como instalalo.*
## Vista xeral
Archiving solution to collect, save, and view sites you want to preserve offline.
**Versión proporcionada:** 0.7.2~ynh1
**Demo:** <https://archiveboxdemo.commoninternet.net>
## Capturas de pantalla
![Captura de pantalla de ArchiveBox](./doc/screenshots/screenshot_archivebox1.png)
## Documentación e recursos
- Web oficial da app: <https://archivebox.io/>
- Documentación oficial para admin: <https://github.com/ArchiveBox/ArchiveBox/wiki>
- Repositorio de orixe do código: <https://github.com/ArchiveBox/ArchiveBox>
- Tenda YunoHost: <https://apps.yunohost.org/app/archivebox>
- Informar dun problema: <https://github.com/YunoHost-Apps/archivebox_ynh/issues>
## Info de desenvolvemento
Envía a túa colaboración á [rama `testing`](https://github.com/YunoHost-Apps/archivebox_ynh/tree/testing).
Para probar a rama `testing`, procede deste xeito:
```bash
sudo yunohost app install https://github.com/YunoHost-Apps/archivebox_ynh/tree/testing --debug
ou
sudo yunohost app upgrade archivebox -u https://github.com/YunoHost-Apps/archivebox_ynh/tree/testing --debug
```
**Máis info sobre o empaquetado da app:** <https://yunohost.org/packaging_apps>

50
README_zh_Hans.md Normal file
View file

@ -0,0 +1,50 @@
<!--
注意:此 README 由 <https://github.com/YunoHost/apps/tree/master/tools/readme_generator> 自动生成
请勿手动编辑。
-->
# YunoHost 上的 ArchiveBox
[![集成程度](https://dash.yunohost.org/integration/archivebox.svg)](https://dash.yunohost.org/appci/app/archivebox) ![工作状态](https://ci-apps.yunohost.org/ci/badges/archivebox.status.svg) ![维护状态](https://ci-apps.yunohost.org/ci/badges/archivebox.maintain.svg)
[![使用 YunoHost 安装 ArchiveBox](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=archivebox)
*[阅读此 README 的其它语言版本。](./ALL_README.md)*
> *通过此软件包,您可以在 YunoHost 服务器上快速、简单地安装 ArchiveBox。*
> *如果您还没有 YunoHost请参阅[指南](https://yunohost.org/install)了解如何安装它。*
## 概况
Archiving solution to collect, save, and view sites you want to preserve offline.
**分发版本:** 0.7.2~ynh1
**演示:** <https://archiveboxdemo.commoninternet.net>
## 截图
![ArchiveBox 的截图](./doc/screenshots/screenshot_archivebox1.png)
## 文档与资源
- 官方应用网站: <https://archivebox.io/>
- 官方管理文档: <https://github.com/ArchiveBox/ArchiveBox/wiki>
- 上游应用代码库: <https://github.com/ArchiveBox/ArchiveBox>
- YunoHost 商店: <https://apps.yunohost.org/app/archivebox>
- 报告 bug <https://github.com/YunoHost-Apps/archivebox_ynh/issues>
## 开发者信息
请向 [`testing` 分支](https://github.com/YunoHost-Apps/archivebox_ynh/tree/testing) 发送拉取请求。
如要尝试 `testing` 分支,请这样操作:
```bash
sudo yunohost app install https://github.com/YunoHost-Apps/archivebox_ynh/tree/testing --debug
sudo yunohost app upgrade archivebox -u https://github.com/YunoHost-Apps/archivebox_ynh/tree/testing --debug
```
**有关应用打包的更多信息:** <https://yunohost.org/packaging_apps>

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,4 +1,6 @@
This is intended to be documentation for developers working on the archivebox_ynh package
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
as it is updated.
## 1. Modify the Manifest.toml
Replace the following fields:

View file

@ -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
#=================================================
ynh_script_progression --message="Upgrading source files..." --weight=1
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
# Download, check integrity, uncompress and patch the source from app.src
tempdir="$(mktemp -d)"
ynh_setup_source --dest_dir="$tempdir"
mkdir -p $install_dir
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
@ -48,57 +38,42 @@ 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
#=================================================
ynh_script_progression --message="Upgrading via pip" --weight=1
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"
chown -R "$app" "$install_dir"
ynh_use_nodejs
python3 -m venv "${install_dir}/venv"
cp ../conf/requirements.txt "$install_dir/requirements.txt"
chown -R "$app" "$install_dir"
#run source in a 'sub shell'
(
set +o nounset
source "${install_dir}/venv/bin/activate"
set -o nounset
ynh_exec_as $app $install_dir/venv/bin/pip install --upgrade pip
ynh_exec_as $app $install_dir/venv/bin/pip install -r "$install_dir/requirements.txt"
)
#run source in a 'sub shell'
(
set +o nounset
source "${install_dir}/venv/bin/activate"
set -o nounset
ynh_exec_as $app $install_dir/venv/bin/pip install --upgrade pip
ynh_exec_as $app $install_dir/venv/bin/pip install -r "$install_dir/requirements.txt"
)
# we use this virtualenv archivebox for further commands now
archivebox_cmd="$install_dir/venv/bin/archivebox"
fi
# we use this virtualenv archivebox for further commands now
archivebox_cmd="$install_dir/venv/bin/archivebox"
#=================================================
# UPGRADE NODE DEPENDENCIES
#=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading node dependencies..."
ynh_script_progression --message="Upgrading node dependencies..."
cp -f $tempdir/package.json "$install_dir/package.json"
cp -f $tempdir/package-lock.json "$install_dir/package-lock.json"
ynh_secure_remove --file="$tempdir"
pushd $install_dir
ynh_use_nodejs
ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm ci
popd
fi
cp -f $tempdir/package.json "$install_dir/package.json"
cp -f $tempdir/package-lock.json "$install_dir/package-lock.json"
ynh_secure_remove --file="$tempdir"
pushd $install_dir
ynh_use_nodejs
ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm ci
popd
#=================================================
# 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
# 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
#=================================================
# 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"
#=================================================