mirror of
https://github.com/YunoHost-Apps/archivebox_ynh.git
synced 2024-09-03 18:15:54 +02:00
Merge pull request #16 from YunoHost-Apps/testing
Install node via yunohost helper and use this node in archivebox
This commit is contained in:
commit
a2d626f966
8 changed files with 42 additions and 26 deletions
|
@ -17,7 +17,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
|
||||||
|
|
||||||
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.6.2~ynh8
|
**Shipped version:** 0.6.2~ynh9
|
||||||
|
|
||||||
**Demo:** https://archiveboxdemo.commoninternet.net
|
**Demo:** https://archiveboxdemo.commoninternet.net
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour
|
||||||
|
|
||||||
Solution d'archivage pour collecter, enregistrer et afficher les sites que vous souhaitez conserver hors ligne
|
Solution d'archivage pour collecter, enregistrer et afficher les sites que vous souhaitez conserver hors ligne
|
||||||
|
|
||||||
**Version incluse :** 0.6.2~ynh8
|
**Version incluse :** 0.6.2~ynh9
|
||||||
|
|
||||||
**Démo :** https://archiveboxdemo.commoninternet.net
|
**Démo :** https://archiveboxdemo.commoninternet.net
|
||||||
|
|
||||||
|
|
2
conf/ArchiveBox.conf
Normal file
2
conf/ArchiveBox.conf
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
[DEPENDENCY_CONFIG]
|
||||||
|
NODE_BINARY=__YNH_NODE__
|
|
@ -6,7 +6,7 @@
|
||||||
"en": "Archiving solution to collect, save, and view sites you want to preserve offline",
|
"en": "Archiving solution to collect, save, and view sites you want to preserve offline",
|
||||||
"fr": "Solution d'archivage pour collecter, enregistrer et afficher les sites que vous souhaitez conserver hors ligne"
|
"fr": "Solution d'archivage pour collecter, enregistrer et afficher les sites que vous souhaitez conserver hors ligne"
|
||||||
},
|
},
|
||||||
"version": "0.6.2~ynh8",
|
"version": "0.6.2~ynh9",
|
||||||
"url": "https://archivebox.io/",
|
"url": "https://archivebox.io/",
|
||||||
"upstream": {
|
"upstream": {
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|
|
@ -5,12 +5,14 @@
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# dependencies used by the app
|
# dependencies used by the app
|
||||||
pkg_dependencies="python3-venv expect nodejs npm \
|
pkg_dependencies="python3-venv expect \
|
||||||
apt-transport-https ca-certificates gnupg2 zlib1g-dev dumb-init gosu cron unzip curl \
|
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 \
|
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 \
|
wget curl chromium git ffmpeg youtube-dl ripgrep \
|
||||||
build-essential python-dev python3-dev"
|
build-essential python-dev python3-dev"
|
||||||
|
|
||||||
|
nodejs_version=14
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PERSONAL HELPERS
|
# PERSONAL HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -77,6 +77,8 @@ ynh_script_progression --message="Installing dependencies..." --weight=8
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
|
ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -137,7 +139,9 @@ archivebox_cmd="$final_path/venv/bin/archivebox"
|
||||||
#=================================================
|
#=================================================
|
||||||
cp ../conf/package.json "$final_path/package.json"
|
cp ../conf/package.json "$final_path/package.json"
|
||||||
cp ../conf/package-lock.json "$final_path/package-lock.json"
|
cp ../conf/package-lock.json "$final_path/package-lock.json"
|
||||||
cd $final_path; npm ci
|
cd $final_path; ynh_npm ci
|
||||||
|
|
||||||
|
ynh_node_path=$ynh_node
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DATA DIRECTORY
|
# CREATE DATA DIRECTORY
|
||||||
|
@ -158,6 +162,13 @@ chown -R $app:www-data "$datadir"
|
||||||
# CREATE ARCHIVEBOX CONFIG
|
# CREATE ARCHIVEBOX CONFIG
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
# copy configuration file
|
||||||
|
ynh_add_config --template="../conf/ArchiveBox.conf" --destination="$datadir/ArchiveBox.conf"
|
||||||
|
|
||||||
|
# permissions
|
||||||
|
chmod 750 "$datadir"
|
||||||
|
chmod -R o-rwx "$datadir"
|
||||||
|
chown -R $app:www-data "$datadir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INITIALIZE ARCHIVEBOX
|
# INITIALIZE ARCHIVEBOX
|
||||||
|
@ -200,13 +211,7 @@ EOF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ynh_script_progression --message="Finishing Archivebox Setup" --weight=1
|
ynh_script_progression --message="Finishing Archivebox Setup" --weight=1
|
||||||
cd $datadir && ynh_exec_as $app $archivebox_cmd init --setup
|
cd $datadir && ynh_exec_as $app $ynh_node_load_PATH $archivebox_cmd init --setup
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# ADD A CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
# config files for archive box live in $data_dir/ArchiveBox.conf
|
|
||||||
# and are handled manually outside of YunoHost
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# SETUP SYSTEMD
|
||||||
|
|
|
@ -92,6 +92,8 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=1
|
||||||
# Define and install dependencies
|
# Define and install dependencies
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
|
ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE SYSTEMD
|
# RESTORE SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -26,6 +26,12 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
language=$(ynh_app_setting_get --app=$app --key=language)
|
language=$(ynh_app_setting_get --app=$app --key=language)
|
||||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||||
|
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SET CORRECT NODE VERSION
|
||||||
|
#=================================================
|
||||||
|
ynh_use_nodejs --nodejs_version=$nodejs_version
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK VERSION
|
# CHECK VERSION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -75,6 +81,18 @@ ynh_script_progression --message="Making sure dedicated system user exists..." -
|
||||||
# Create a dedicated user (if not existing)
|
# Create a dedicated user (if not existing)
|
||||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# UPGRADE DEPENDENCIES
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Upgrading dependencies..." --weight=1
|
||||||
|
|
||||||
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
|
if [ $nodejs_version != $(ynh_app_setting_get --app=$app --key=nodejs_version) ]; then
|
||||||
|
ynh_remove_nodejs
|
||||||
|
ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||||
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPGRADE VIA PIP
|
# UPGRADE VIA PIP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -102,7 +120,7 @@ then
|
||||||
|
|
||||||
# rerun archivebox setup (its idempotent, so it should be ok during upgrade)
|
# rerun archivebox setup (its idempotent, so it should be ok during upgrade)
|
||||||
ynh_script_progression --message="Finishing Archivebox Setup" --weight=1
|
ynh_script_progression --message="Finishing Archivebox Setup" --weight=1
|
||||||
cd $datadir && ynh_exec_as $app $archivebox_cmd init --setup
|
cd $datadir && ynh_exec_as $app $ynh_node_load_PATH $archivebox_cmd init --setup
|
||||||
fi
|
fi
|
||||||
|
|
||||||
chmod 750 "$final_path"
|
chmod 750 "$final_path"
|
||||||
|
@ -117,19 +135,6 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." -
|
||||||
# Create a dedicated NGINX config
|
# Create a dedicated NGINX config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# UPGRADE DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Upgrading dependencies..." --weight=1
|
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# UPDATE A CONFIG FILE
|
|
||||||
#=================================================
|
|
||||||
# config files for archive box live in $data_dir/ArchiveBox.conf
|
|
||||||
# and are handled manually outside of YunoHost
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# SETUP SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Add table
Reference in a new issue