mirror of
https://github.com/YunoHost-Apps/jupyterlab_ynh.git
synced 2024-09-03 19:26:35 +02:00
Merge pull request #6 from YunoHost-Apps/testing
Fix change url and upgrade scripts
This commit is contained in:
commit
52b333ce4b
8 changed files with 152 additions and 23 deletions
|
@ -1,6 +1,6 @@
|
||||||
# JupyterLab for YunoHost
|
# JupyterLab for YunoHost
|
||||||
|
|
||||||
[](https://ci-apps.yunohost.org/jenkins/job/jupyterlab%20%28Community%29/lastBuild/consoleFull)
|
[](https://ci-apps.yunohost.org/jenkins/job/jupyterlab%20%28Community%29/lastBuild/consoleFull)
|
||||||
[](https://install-app.yunohost.org/?app=jupyterlab)
|
[](https://install-app.yunohost.org/?app=jupyterlab)
|
||||||
|
|
||||||
> *This package allow you to install jupyterlab quickly and simply on a YunoHost server.
|
> *This package allow you to install jupyterlab quickly and simply on a YunoHost server.
|
||||||
|
@ -36,9 +36,9 @@ Can the app be used by multiple users? **Yes**
|
||||||
|
|
||||||
#### Supported architectures
|
#### Supported architectures
|
||||||
|
|
||||||
* x86-64b - [/badge/icon)](https://ci-apps.yunohost.org/jenkins/job/jupyterlab%20(Community)/)
|
* x86-64b - [](https://ci-apps.yunohost.org/ci/apps/jupyterlab/)
|
||||||
* ARMv8-A - [%20(%7EARM%7E)/badge/icon)](https://ci-apps-arm.yunohost.org/jenkins/job/jupyterlab%20(Community)%20(%7EARM%7E)/)
|
* ARMv8-A - [](https://ci-apps-arm.yunohost.org/ci/apps/jupyterlab/)
|
||||||
* Jessie x86-64b - [/badge/icon)](https://ci-stretch.nohost.me/jenkins/job/jupyterlab%20(Community)/)
|
* Jessie x86-64b - [](https://ci-stretch.nohost.me/ci/apps/jupyterlab/)
|
||||||
|
|
||||||
## Links
|
## Links
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ After=syslog.target network.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Environment="PATH=__FINALPATH__/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
Environment="PATH=__FINALPATH__/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
||||||
ExecStart=__FINALPATH__/bin/jupyterhub -f __CONFIGPATH__/jupyterhub_config.py 2&>> /var/log/__APP__.log
|
ExecStart=__FINALPATH__/bin/jupyterhub -f __CONFIGPATH__/jupyterhub_config.py
|
||||||
Restart=always
|
Restart=always
|
||||||
RestartSec=10
|
RestartSec=10
|
||||||
WorkingDirectory=__FINALPATH__
|
WorkingDirectory=__FINALPATH__
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"name": "JupyterLab",
|
"name": "JupyterLab",
|
||||||
"id": "jupyterlab",
|
"id": "jupyterlab",
|
||||||
"packaging_format": 1,
|
"packaging_format": 1,
|
||||||
"version": "0.35.4~ynh1",
|
"version": "0.35.4~ynh2",
|
||||||
"description": {
|
"description": {
|
||||||
"en": "JupyterLab for Yunohost, an extensible environment for interactive and reproducible computing (notebook, terminal, text editor, file browser, rich outputs, etc.)",
|
"en": "JupyterLab for Yunohost, an extensible environment for interactive and reproducible computing (notebook, terminal, text editor, file browser, rich outputs, etc.)",
|
||||||
"fr": "JupyterLab pour YunoHost, un environnement informatique extensible, interactif et reproductible (bloc-notes, terminal, éditeur de texte, explorateur de fichiers, texte enrichi, etc.)"
|
"fr": "JupyterLab pour YunoHost, un environnement informatique extensible, interactif et reproductible (bloc-notes, terminal, éditeur de texte, explorateur de fichiers, texte enrichi, etc.)"
|
||||||
|
|
|
@ -134,21 +134,26 @@ setup_source() {
|
||||||
if [ "$src_filename" = "" ] ; then
|
if [ "$src_filename" = "" ] ; then
|
||||||
src_filename="${src_id}.${src_format}"
|
src_filename="${src_id}.${src_format}"
|
||||||
fi
|
fi
|
||||||
local local_src="/opt/yunohost-apps-src/${YNH_APP_ID}/${src_filename}"
|
|
||||||
|
|
||||||
if test -e "$local_src"
|
if ! test -e "$final_path"
|
||||||
then # Use the local source file if it is present
|
then
|
||||||
cp $local_src $src_filename
|
|
||||||
else # If not, download the source
|
local local_src="/opt/yunohost-apps-src/${YNH_APP_ID}/${src_filename}"
|
||||||
local out=`wget -nv -O $src_filename $src_url 2>&1` || ynh_print_err $out
|
|
||||||
|
if test -e "$local_src"
|
||||||
|
then # Use the local source file if it is present
|
||||||
|
cp $local_src $src_filename
|
||||||
|
else # If not, download the source
|
||||||
|
local out=`wget -nv -O $src_filename $src_url 2>&1` || ynh_print_err $out
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check the control sum
|
||||||
|
echo "${src_sum} ${src_filename}" | ${src_sumprg} -c --status \
|
||||||
|
|| ynh_die "Corrupt source"
|
||||||
|
|
||||||
|
bash $src_filename -b -p $final_path
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check the control sum
|
|
||||||
echo "${src_sum} ${src_filename}" | ${src_sumprg} -c --status \
|
|
||||||
|| ynh_die "Corrupt source"
|
|
||||||
|
|
||||||
bash $src_filename -b -p $final_path
|
|
||||||
|
|
||||||
export "PATH=$final_path/bin/:$PATH"
|
export "PATH=$final_path/bin/:$PATH"
|
||||||
|
|
||||||
if [ "$src_id" = "arm" ]
|
if [ "$src_id" = "arm" ]
|
||||||
|
|
|
@ -41,8 +41,6 @@ port_http_proxy=$(ynh_app_setting_get "$app" port_http_proxy)
|
||||||
# CHECK PATHS SYNTAX
|
# CHECK PATHS SYNTAX
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
test -n "$old_path" || old_path="/"
|
|
||||||
test -n "$new_path" || new_path="/"
|
|
||||||
new_path=$(ynh_normalize_url_path $new_path)
|
new_path=$(ynh_normalize_url_path $new_path)
|
||||||
old_path=$(ynh_normalize_url_path $old_path)
|
old_path=$(ynh_normalize_url_path $old_path)
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ ynh_systemd_action() {
|
||||||
# Following the starting of the app in its log
|
# Following the starting of the app in its log
|
||||||
if [ "$log_path" == "systemd" ] ; then
|
if [ "$log_path" == "systemd" ] ; then
|
||||||
# Read the systemd journal
|
# Read the systemd journal
|
||||||
journalctl -u $service_name -f --since=-45 > "$templog" &
|
journalctl -u $service_name -f -n0 > "$templog" &
|
||||||
else
|
else
|
||||||
# Read the specified log file
|
# Read the specified log file
|
||||||
tail -F -n0 "$log_path" > "$templog" &
|
tail -F -n0 "$log_path" > "$templog" &
|
||||||
|
|
|
@ -31,7 +31,6 @@ enable_terminal=$YNH_APP_ARG_ENABLE_TERMINAL
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Normalize the url path syntax
|
# Normalize the url path syntax
|
||||||
test -n "$path_url" || path_url="/"
|
|
||||||
path_url=$(ynh_normalize_url_path $path_url)
|
path_url=$(ynh_normalize_url_path $path_url)
|
||||||
|
|
||||||
# This function check also the availability of this one
|
# This function check also the availability of this one
|
||||||
|
|
127
scripts/upgrade
Normal file
127
scripts/upgrade
Normal file
|
@ -0,0 +1,127 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC START
|
||||||
|
#=================================================
|
||||||
|
# IMPORT GENERIC HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# IMPORT GENERIC HELPERS
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
source ./experimental_helper.sh
|
||||||
|
|
||||||
|
# Load common variables and helpers
|
||||||
|
source ./_common.sh
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# LOAD SETTINGS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
# Retrieve app settings
|
||||||
|
domain=$(ynh_app_setting_get "$app" domain)
|
||||||
|
path_url=$(ynh_app_setting_get "$app" path_url)
|
||||||
|
admin=$(ynh_app_setting_get "$app" admin)
|
||||||
|
is_public=$(ynh_app_setting_get "$app" is_public)
|
||||||
|
port=$(ynh_app_setting_get "$app" port)
|
||||||
|
port_hub=$(ynh_app_setting_get "$app" port_hub)
|
||||||
|
port_http_proxy=$(ynh_app_setting_get "$app" port_http_proxy)
|
||||||
|
enable_terminal=$(ynh_app_setting_get "$app" enable_terminal)
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# TODO Add backup/restore scripts
|
||||||
|
## Backup the current version of the app
|
||||||
|
#ynh_backup_before_upgrade
|
||||||
|
#ynh_clean_setup () {
|
||||||
|
# # restore it if the upgrade fails
|
||||||
|
# ynh_restore_upgradebackup
|
||||||
|
#}
|
||||||
|
|
||||||
|
# Exit if an error occurs during the execution of the script
|
||||||
|
ynh_abort_if_errors
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CHECK THE PATH
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Normalize the URL path syntax
|
||||||
|
path_url=$(ynh_normalize_url_path $path_url)
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# STANDARD UPGRADE STEPS
|
||||||
|
#=================================================
|
||||||
|
# NGINX CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Modify Nginx configuration file and copy it to Nginx conf directory
|
||||||
|
ynh_add_nginx_config
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CONFIGURE JUPYTERLAB
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Configure jupyterlab with jupyterhub_config.py file
|
||||||
|
config_jupyterlab
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# DOWNLOAD, CHECK AND INSTALL JUPYTERLAB
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
setup_source $miniconda_architecture
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC SETUP
|
||||||
|
#=================================================
|
||||||
|
# ADD HUB EXTENSION
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
jupyter labextension install @jupyterlab/hub-extension
|
||||||
|
jupyter lab build
|
||||||
|
|
||||||
|
chown $admin -R $final_path/share/jupyter
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CONFIGURE JUPYTER NOTEBOOK
|
||||||
|
#=================================================
|
||||||
|
config_jupyter_notebook
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SETUP SYSTEMD
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# Create a dedicated systemd config
|
||||||
|
add_systemd_config
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC FINALIZATION
|
||||||
|
#=================================================
|
||||||
|
# SETUP SSOWAT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
# If app is public, add url to SSOWat conf as skipped_uris
|
||||||
|
if [[ $is_public -eq 1 ]]; then
|
||||||
|
# See install script
|
||||||
|
ynh_app_setting_set "$app" unprotected_uris "/"
|
||||||
|
fi
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RELOAD NGINX
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
systemctl reload nginx
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
yunohost service add $app --log "systemd"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# START SERVICE
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_systemd_action -n $app -a restart -l "JupyterHub is now running at" -p "systemd"
|
Loading…
Add table
Reference in a new issue