mirror of
https://github.com/YunoHost-Apps/jupyterlab_ynh.git
synced 2024-09-03 19:26:35 +02:00
Merge pull request #99 from YunoHost-Apps/example
Apply last example_ynh
This commit is contained in:
commit
181d007ed2
17 changed files with 176 additions and 261 deletions
59
README.md
59
README.md
|
@ -1,3 +1,8 @@
|
|||
<!--
|
||||
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.
|
||||
-->
|
||||
|
||||
# JupyterLab for YunoHost
|
||||
|
||||
[](https://dash.yunohost.org/appci/app/jupyterlab)  
|
||||
|
@ -5,55 +10,33 @@
|
|||
|
||||
*[Lire ce readme en français.](./README_fr.md)*
|
||||
|
||||
> *This package allow you to install JupyterLab quickly and simply on a YunoHost server.
|
||||
If you don't have YunoHost, please see [here](https://yunohost.org/install) to know how to install and enjoy it.*
|
||||
> *This package allows you to install JupyterLab 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
|
||||
|
||||
JupyterLab is the next-generation user interface for Project Jupyter offering all the familiar building blocks of the classic Jupyter Notebook (notebook, terminal, text editor, file browser, rich outputs, etc.) in a flexible and powerful user interface. JupyterLab will eventually replace the classic Jupyter Notebook.
|
||||
|
||||
**Shipped version:** 3.0.16
|
||||
|
||||
**Shipped version:** 3.0.16~ynh2
|
||||
|
||||
**Demo:** https://mybinder.org/v2/gh/jupyterlab/jupyterlab-demo/master?urlpath=lab/tree/demo
|
||||
|
||||
## Screenshots
|
||||
|
||||

|
||||

|
||||
|
||||
## Demo
|
||||
|
||||
* [Try it on Binder](https://mybinder.org/v2/gh/jupyterlab/jupyterlab-demo/master?urlpath=lab/tree/demo)
|
||||
|
||||
## Configuration
|
||||
|
||||
How to configure this app: by an admin panel, a plain file with SSH.
|
||||
|
||||
## Documentation
|
||||
|
||||
* Official documentation: https://jupyterlab.readthedocs.io/en/stable/
|
||||
* YunoHost documentation: https://yunohost.org/en/app_jupyterlab
|
||||
|
||||
## YunoHost specific features
|
||||
|
||||
#### Multi-users support
|
||||
|
||||
* LDAP auth supported? **Yes**
|
||||
* Can the app be used by multiple users? **Yes**
|
||||
|
||||
#### Supported architectures
|
||||
|
||||
* x86-64 - [](https://ci-apps.yunohost.org/ci/apps/jupyterlab/)
|
||||
* ARMv8-A - [](https://ci-apps-arm.yunohost.org/ci/apps/jupyterlab/)
|
||||
|
||||
## Links
|
||||
## Documentation and resources
|
||||
|
||||
* Official app website: https://jupyterlab.readthedocs.io/en/stable/
|
||||
* Official admin documentation: https://jupyterlab.readthedocs.io/en/stable/
|
||||
* Upstream app code repository: https://github.com/jupyterhub/jupyterhub
|
||||
* YunoHost documentation for this app: https://yunohost.org/app_jupyterlab
|
||||
* Report a bug: https://github.com/YunoHost-Apps/jupyterlab_ynh/issues
|
||||
* App website: https://jupyter.org
|
||||
* Upstream app repository: https://github.com/jupyterhub/jupyterhub
|
||||
* YunoHost website: https://yunohost.org/
|
||||
|
||||
---
|
||||
## Developer info
|
||||
|
||||
## Developers info
|
||||
|
||||
Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/jupyterlab_ynh/tree/testing).
|
||||
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/jupyterlab_ynh/tree/testing).
|
||||
|
||||
To try the testing branch, please proceed like that.
|
||||
```
|
||||
|
@ -61,3 +44,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/jupyterlab_ynh/tree/t
|
|||
or
|
||||
sudo yunohost app upgrade jupyterlab -u https://github.com/YunoHost-Apps/jupyterlab_ynh/tree/testing --debug
|
||||
```
|
||||
|
||||
**More info regarding app packaging:** https://yunohost.org/packaging_apps
|
57
README_fr.md
57
README_fr.md
|
@ -1,55 +1,34 @@
|
|||
# JupyterLab pour YunoHost
|
||||
|
||||
[](https://dash.yunohost.org/appci/app/jupyterlab)  
|
||||
[](https://dash.yunohost.org/appci/app/jupyterlab)  
|
||||
[](https://install-app.yunohost.org/?app=jupyterlab)
|
||||
|
||||
*[Read this readme in english.](./README.md)*
|
||||
*[Read this readme in english.](./README.md)*
|
||||
*[Lire ce readme en français.](./README_fr.md)*
|
||||
|
||||
> *Ce package vous permet d’installer JupyterLab rapidement et simplement sur un serveur YunoHost.
|
||||
Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/install) pour savoir comment l’installer et en profiter.*
|
||||
> *Ce package vous permet d'installer JupyterLab rapidement et simplement sur un serveur YunoHost.
|
||||
Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
|
||||
|
||||
## Vue d’ensemble
|
||||
JupyterLab est une interface utilisateur de nouvelle génération pour le projet Jupyter offrant tous les modules de Jupyter Notebook (interpréteur Python, terminal, éditeur de texte, navigateur de fichiers, etc.) dans une interface utilisateur flexible et puissante. JupyterLab remplacera à terme Jupyter Notebook.
|
||||
## Vue d'ensemble
|
||||
|
||||
**Version incluse :** 3.0.16
|
||||
JupyterLab is the next-generation user interface for Project Jupyter offering all the familiar building blocks of the classic Jupyter Notebook (notebook, terminal, text editor, file browser, rich outputs, etc.) in a flexible and powerful user interface. JupyterLab will eventually replace the classic Jupyter Notebook.
|
||||
|
||||
## Captures d’écran
|
||||
|
||||

|
||||
**Version incluse :** 3.0.16~ynh2
|
||||
|
||||
## Démo
|
||||
**Démo :** https://mybinder.org/v2/gh/jupyterlab/jupyterlab-demo/master?urlpath=lab/tree/demo
|
||||
|
||||
* [Démo sur Binder](https://mybinder.org/v2/gh/jupyterlab/jupyterlab-demo/master?urlpath=lab/tree/demo)
|
||||
## Captures d'écran
|
||||
|
||||
## Configuration
|
||||

|
||||
|
||||
Comment configurer cette application : via le panneau d'administration, un fichier brut en SSH.
|
||||
## Documentations et ressources
|
||||
|
||||
## Documentation
|
||||
|
||||
* Documentation officielle : https://jupyterlab.readthedocs.io/en/stable/
|
||||
* Documentation YunoHost : https://yunohost.org/fr/app_jupyterlab
|
||||
|
||||
## Caractéristiques spécifiques YunoHost
|
||||
|
||||
#### Support multi-utilisateurs
|
||||
|
||||
* L’authentification LDAP est-elle prise en charge ? **Oui**
|
||||
* L’application peut-elle être utilisée par plusieurs utilisateurs ? **Oui**
|
||||
|
||||
#### Architectures supportées
|
||||
|
||||
* x86-64 - [](https://ci-apps.yunohost.org/ci/apps/jupyterlab/)
|
||||
* ARMv8-A - [](https://ci-apps-arm.yunohost.org/ci/apps/jupyterlab/)
|
||||
|
||||
## Liens
|
||||
|
||||
* Signaler un bug : https://github.com/YunoHost-Apps/jupyterlab_ynh/issues
|
||||
* Site de l’application : https://jupyter.org
|
||||
* Dépôt de l’application principale : https://github.com/jupyterhub/jupyterhub
|
||||
* Site web YunoHost : https://yunohost.org/
|
||||
|
||||
---
|
||||
* Site officiel de l'app : https://jupyterlab.readthedocs.io/en/stable/
|
||||
* Documentation officielle de l'admin : https://jupyterlab.readthedocs.io/en/stable/
|
||||
* Dépôt de code officiel de l'app : https://github.com/jupyterhub/jupyterhub
|
||||
* Documentation YunoHost pour cette app : https://yunohost.org/app_jupyterlab
|
||||
* Signaler un bug : https://github.com/YunoHost-Apps/jupyterlab_ynh/issues
|
||||
|
||||
## Informations pour les développeurs
|
||||
|
||||
|
@ -61,3 +40,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/jupyterlab_ynh/tree/t
|
|||
ou
|
||||
sudo yunohost app upgrade jupyterlab -u https://github.com/YunoHost-Apps/jupyterlab_ynh/tree/testing --debug
|
||||
```
|
||||
|
||||
**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps
|
|
@ -2,8 +2,8 @@
|
|||
; Manifest
|
||||
domain="domain.tld"
|
||||
path="/jupyterlab"
|
||||
admin="john"
|
||||
is_public=1
|
||||
admin="john"
|
||||
; Checks
|
||||
pkg_linter=1
|
||||
setup_sub_dir=1
|
||||
|
@ -12,9 +12,11 @@
|
|||
setup_private=1
|
||||
setup_public=1
|
||||
upgrade=1
|
||||
# 3.0.16~ynh1
|
||||
upgrade=1 from_commit=197dca5095e29abe8d4a560a5a2ba2984045c989
|
||||
backup_restore=1
|
||||
multi_instance=1
|
||||
port_already_use=1
|
||||
port_already_use=0
|
||||
change_url=1
|
||||
;;; Options
|
||||
Email=
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
|
||||
location __PATH__/ {
|
||||
proxy_pass http://localhost:__PORT__;
|
||||
proxy_redirect off;
|
||||
|
|
|
@ -3,13 +3,15 @@ Description=JupyterLab
|
|||
After=syslog.target network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=root
|
||||
WorkingDirectory=__FINALPATH__/
|
||||
Environment="LC_ALL=C.UTF-8"
|
||||
Environment="LANG=C.UTF-8"
|
||||
Environment="PATH=__NODE_PATH__:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
||||
ExecStart=/usr/local/bin/pipenv run jupyterhub -f __FINALPATH__/config/jupyterhub_config.py
|
||||
Environment="__YNH_NODE_LOAD_PATH__:__FINALPATH__/.venv/bin"
|
||||
ExecStart=__FINALPATH__/.venv/bin/jupyterhub -f __FINALPATH__/config/jupyterhub_config.py --upgrade-db
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
WorkingDirectory=__FINALPATH__
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
WantedBy=multi-user.target
|
||||
|
|
0
doc/.gitkeep
Normal file
0
doc/.gitkeep
Normal file
1
doc/DESCRIPTION.md
Normal file
1
doc/DESCRIPTION.md
Normal file
|
@ -0,0 +1 @@
|
|||
JupyterLab is the next-generation user interface for Project Jupyter offering all the familiar building blocks of the classic Jupyter Notebook (notebook, terminal, text editor, file browser, rich outputs, etc.) in a flexible and powerful user interface. JupyterLab will eventually replace the classic Jupyter Notebook.
|
0
doc/DISCLAIMER.md
Normal file
0
doc/DISCLAIMER.md
Normal file
0
doc/screenshots/.gitkeep
Normal file
0
doc/screenshots/.gitkeep
Normal file
BIN
doc/screenshots/jupyterlab.png
Normal file
BIN
doc/screenshots/jupyterlab.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 70 KiB |
|
@ -6,15 +6,22 @@
|
|||
"en": "Code console environment for running Python code interactively.",
|
||||
"fr": "Console de code pour exécuter du code Python de manière interactive."
|
||||
},
|
||||
"version": "3.0.16~ynh1",
|
||||
"version": "3.0.16~ynh2",
|
||||
"url": "https://jupyterlab.readthedocs.io/en/stable/",
|
||||
"upstream": {
|
||||
"license": "BSD-3-Clause",
|
||||
"website": "https://jupyterlab.readthedocs.io/en/stable/",
|
||||
"demo": "https://mybinder.org/v2/gh/jupyterlab/jupyterlab-demo/master?urlpath=lab/tree/demo",
|
||||
"admindoc": "https://jupyterlab.readthedocs.io/en/stable/",
|
||||
"code": "https://github.com/jupyterhub/jupyterhub"
|
||||
},
|
||||
"license": "BSD-3-Clause",
|
||||
"maintainer": {
|
||||
"name": "kay0u",
|
||||
"email": "pierre@kayou.io"
|
||||
},
|
||||
"requirements": {
|
||||
"yunohost": ">= 4.1.7"
|
||||
"yunohost": ">= 4.3.0"
|
||||
},
|
||||
"multi_instance": true,
|
||||
"services": [
|
||||
|
@ -24,8 +31,7 @@
|
|||
"install": [
|
||||
{
|
||||
"name": "domain",
|
||||
"type": "domain",
|
||||
"example": "example.com"
|
||||
"type": "domain"
|
||||
},
|
||||
{
|
||||
"name": "path",
|
||||
|
@ -33,16 +39,15 @@
|
|||
"example": "/jupyterlab",
|
||||
"default": "/jupyterlab"
|
||||
},
|
||||
{
|
||||
"name": "admin",
|
||||
"type": "user",
|
||||
"example": "johndoe"
|
||||
},
|
||||
{
|
||||
"name": "is_public",
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
},
|
||||
{
|
||||
"name": "admin",
|
||||
"type": "user"
|
||||
},
|
||||
{
|
||||
"name": "enable_terminal",
|
||||
"type": "boolean",
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
|
|
|
@ -24,23 +24,26 @@ app=$YNH_APP_INSTANCE_NAME
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..."
|
||||
ynh_script_progression --message="Loading installation settings..."
|
||||
|
||||
# Needed for helper "ynh_add_nginx_config"
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
|
||||
# Add settings here as needed by your application
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
port_hub=$(ynh_app_setting_get --app=$app --key=port_hub)
|
||||
port_http_proxy=$(ynh_app_setting_get --app=$app --key=port_http_proxy)
|
||||
admin=$(ynh_app_setting_get --app=$app --key=admin)
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
|
||||
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||
|
||||
|
@ -71,14 +74,14 @@ fi
|
|||
#=================================================
|
||||
# STOP SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Stopping a systemd service..."
|
||||
ynh_script_progression --message="Stopping a systemd service..."
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="stop"
|
||||
|
||||
#=================================================
|
||||
# MODIFY URL IN NGINX CONF
|
||||
#=================================================
|
||||
ynh_script_progression --message="Updating NGINX web server configuration..."
|
||||
ynh_script_progression --message="Updating NGINX web server configuration..."
|
||||
|
||||
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||
|
||||
|
@ -120,14 +123,15 @@ ynh_add_config --template="../conf/jupyterhub_config.py" --destination="$final_p
|
|||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..."
|
||||
ynh_script_progression --message="Starting a systemd service..."
|
||||
|
||||
# Start a systemd service
|
||||
ynh_systemd_action --service_name=$app --action="start" --line_match="JupyterHub is now running at" --log_path="systemd"
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..."
|
||||
ynh_script_progression --message="Reloading NGINX web server..."
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
|
|
|
@ -59,13 +59,14 @@ ynh_app_setting_set --app=$app --key=enable_terminal --value=$enable_terminal
|
|||
#=================================================
|
||||
ynh_script_progression --message="Finding an available port..." --weight=1
|
||||
|
||||
# Find a free port
|
||||
# Find an available port
|
||||
port=$(ynh_find_port --port=8080)
|
||||
port_hub=$(ynh_find_port --port=$(($port + 1)))
|
||||
port_http_proxy=$(ynh_find_port --port=$(($port_hub + 1)))
|
||||
|
||||
ynh_app_setting_set --app=$app --key=port --value=$port
|
||||
|
||||
port_hub=$(ynh_find_port --port=$(($port + 1)))
|
||||
ynh_app_setting_set --app=$app --key=port_hub --value=$port_hub
|
||||
|
||||
port_http_proxy=$(ynh_find_port --port=$(($port_hub + 1)))
|
||||
ynh_app_setting_set --app=$app --key=port_http_proxy --value=$port_http_proxy
|
||||
|
||||
#=================================================
|
||||
|
@ -74,83 +75,65 @@ ynh_app_setting_set --app=$app --key=port_http_proxy --value=$port_http_proxy
|
|||
ynh_script_progression --message="Installing dependencies..." --weight=23
|
||||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||
|
||||
ynh_use_nodejs
|
||||
$ynh_npm install -g configurable-http-proxy
|
||||
python3 -m pip install pipenv
|
||||
|
||||
npm install -g configurable-http-proxy
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Setting up source files..." --weight=64
|
||||
|
||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||
|
||||
mkdir -p $final_path
|
||||
|
||||
pushd $final_path
|
||||
|
||||
PIPENV_VENV_IN_PROJECT="enabled" PIPENV_SKIP_LOCK=true ynh_exec_warn_less python3 -m pipenv install jupyterlab==$jupyterlab_version jupyterhub notebook jupyterhub-ldapauthenticator pyzmq --three
|
||||
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
|
||||
|
||||
# Create a dedicated nginx config
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring system user..." --weight=1
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create --username=$app
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC SETUP
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
# BUILD APP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring a systemd service..." --weight=3
|
||||
ynh_script_progression --message="Building app..."
|
||||
|
||||
# Create a dedicated systemd config
|
||||
ynh_replace_string --match_string="__NODE_PATH__" --replace_string="$nodejs_path" --target_file="../conf/systemd.service"
|
||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||
mkdir -p "$final_path"
|
||||
|
||||
ynh_add_systemd_config
|
||||
pushd $final_path
|
||||
|
||||
PIPENV_VENV_IN_PROJECT="enabled" PIPENV_SKIP_LOCK=true ynh_exec_warn_less python3 -m pipenv install jupyterlab==$jupyterlab_version jupyterhub notebook jupyterhub-ldapauthenticator pyzmq --three
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
# MODIFY A CONFIG FILE
|
||||
# ADD A CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Adding a configuration file..."
|
||||
|
||||
mkdir -p "$final_path/config"
|
||||
|
||||
path=${path_url%/}
|
||||
|
||||
ynh_add_config --template="../conf/jupyterhub_config.py" --destination="$final_path/config/jupyterhub_config.py"
|
||||
|
||||
ynh_add_config --template="../conf/jupyter_notebook_config.py" --destination="$final_path/config/jupyter_notebook_config.py"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# SECURE FILES AND DIRECTORIES
|
||||
#=================================================
|
||||
|
||||
# Set permissions to app files
|
||||
chown -R root: $final_path/
|
||||
chown -R $admin: $final_path/.venv/
|
||||
|
||||
#=================================================
|
||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||
# SETUP SYSTEMD
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring a systemd service..." --weight=3
|
||||
|
||||
yunohost service add $app --description="$app daemon" --log="$app"
|
||||
# Create a dedicated systemd config
|
||||
ynh_add_systemd_config
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||
|
||||
yunohost service add $app --description="$app daemon"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
|
|
|
@ -17,21 +17,18 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
|
|||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
port_hub=$(ynh_app_setting_get --app=$app --key=port_hub)
|
||||
port_http_proxy=$(ynh_app_setting_get --app=$app --key=port_http_proxy)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
|
||||
#=================================================
|
||||
# STANDARD REMOVE
|
||||
#=================================================
|
||||
# REMOVE SERVICE FROM ADMIN PANEL
|
||||
# REMOVE SERVICE INTEGRATION IN YUNOHOST
|
||||
#=================================================
|
||||
|
||||
# Remove a service from the admin panel, added by `yunohost service add`
|
||||
# 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
|
||||
then
|
||||
ynh_script_progression --message="Removing $app service..." --weight=2
|
||||
ynh_script_progression --message="Removing $app service integration..."--weight=2
|
||||
yunohost service remove $app
|
||||
fi
|
||||
|
||||
|
@ -43,16 +40,6 @@ ynh_script_progression --message="Stopping and removing the systemd service..."
|
|||
# Remove the dedicated systemd config
|
||||
ynh_remove_systemd_config
|
||||
|
||||
#=================================================
|
||||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing dependencies..." --weight=4
|
||||
|
||||
# Remove metapackage and its dependencies
|
||||
ynh_remove_app_dependencies
|
||||
|
||||
ynh_remove_nodejs
|
||||
|
||||
#=================================================
|
||||
# REMOVE APP MAIN DIR
|
||||
#=================================================
|
||||
|
@ -70,12 +57,13 @@ ynh_script_progression --message="Removing NGINX web server configuration..." --
|
|||
ynh_remove_nginx_config
|
||||
|
||||
#=================================================
|
||||
# REMOVE DEDICATED USER
|
||||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
|
||||
ynh_script_progression --message="Removing dependencies..." --weight=4
|
||||
|
||||
# Delete a system user
|
||||
ynh_system_user_delete --username=$app
|
||||
# Remove metapackage and its dependencies
|
||||
ynh_remove_app_dependencies
|
||||
ynh_remove_nodejs
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
|
@ -23,22 +23,20 @@ ynh_abort_if_errors
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading settings..." --weight=1
|
||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
admin=$(ynh_app_setting_get --app=$app --key=admin)
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
admin=$(ynh_app_setting_get --app=$app --key=admin)
|
||||
|
||||
#=================================================
|
||||
# CHECK IF THE APP CAN BE RESTORED
|
||||
#=================================================
|
||||
ynh_script_progression --message="Validating restoration parameters..." --weight=1
|
||||
|
||||
ynh_webpath_available --domain=$domain --path_url=$path_url \
|
||||
|| ynh_die --message="Path not available: ${domain}${path_url}"
|
||||
test ! -d $final_path \
|
||||
|| ynh_die --message="There is already a directory: $final_path "
|
||||
|
||||
|
@ -47,6 +45,7 @@ test ! -d $final_path \
|
|||
#=================================================
|
||||
# RESTORE THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the NGINX web server configuration..."
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
|
@ -57,19 +56,6 @@ ynh_script_progression --message="Restoring the app main directory..." --weight=
|
|||
|
||||
ynh_restore_file --origin_path="$final_path"
|
||||
|
||||
#=================================================
|
||||
# RECREATE THE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
|
||||
|
||||
# Create the dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app
|
||||
|
||||
#=================================================
|
||||
# RESTORE USER RIGHTS
|
||||
#=================================================
|
||||
|
||||
# Restore permissions on app files
|
||||
chown -R root: $final_path/
|
||||
chown -R $admin: $final_path/.venv/
|
||||
|
||||
|
@ -82,13 +68,11 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=75
|
|||
|
||||
# Define and install dependencies
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||
|
||||
ynh_use_nodejs
|
||||
$ynh_npm install -g configurable-http-proxy
|
||||
python3 -m pip install pipenv
|
||||
|
||||
npm install -g configurable-http-proxy
|
||||
|
||||
#=================================================
|
||||
# RESTORE SYSTEMD
|
||||
#=================================================
|
||||
|
@ -98,17 +82,18 @@ ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
|||
systemctl enable $app.service --quiet
|
||||
|
||||
#=================================================
|
||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||
|
||||
yunohost service add $app --description="$app daemon" --log="$app"
|
||||
yunohost service add $app --description="$app daemon"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=5
|
||||
|
||||
ynh_systemd_action --service_name=$app --action=start --line_match="JupyterHub is now running at" --log_path="systemd"
|
||||
ynh_systemd_action --service_name=$app --action="start" --line_match="JupyterHub is now running at" --log_path="systemd"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
|
|
120
scripts/upgrade
120
scripts/upgrade
|
@ -28,9 +28,34 @@ enable_terminal=$(ynh_app_setting_get --app=$app --key=enable_terminal)
|
|||
#=================================================
|
||||
# CHECK VERSION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Checking version..."
|
||||
|
||||
upgrade_type=$(ynh_check_app_version_changed)
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=48
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
# Restore it if the upgrade fails
|
||||
ynh_restore_upgradebackup
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
#=================================================
|
||||
# STOP SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Stopping a systemd service..." --weight=2
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="stop"
|
||||
|
||||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
|
@ -52,86 +77,45 @@ if ynh_legacy_permissions_exists; then
|
|||
ynh_app_setting_delete --app=$app --key=is_public
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=48
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
|
||||
# restore it if the upgrade fails
|
||||
ynh_restore_upgradebackup
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
#=================================================
|
||||
# STOP SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Stopping a systemd service..." --weight=2
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="stop"
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
|
||||
|
||||
# Create a dedicated nginx config
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
|
||||
|
||||
# Create a dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app
|
||||
|
||||
#=================================================
|
||||
# UPGRADE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading dependencies..." --weight=83
|
||||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||
|
||||
npm install -g configurable-http-proxy
|
||||
|
||||
ynh_use_nodejs
|
||||
$ynh_npm install -g configurable-http-proxy
|
||||
python3 -m pip install pipenv
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
|
||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||
then
|
||||
ynh_script_progression --message="Upgrading source files..." --weight=160
|
||||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
mkdir -p $final_path
|
||||
|
||||
pushd $final_path
|
||||
|
||||
PIPENV_VENV_IN_PROJECT="enabled" PIPENV_SKIP_LOCK=true ynh_exec_warn_less python3 -m pipenv install jupyterlab==$jupyterlab_version jupyterhub notebook jupyterhub-ldapauthenticator pyzmq
|
||||
|
||||
ynh_exec_warn_less python3 -m pipenv run jupyterhub upgrade-db
|
||||
|
||||
popd
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC UPGRADE
|
||||
#=================================================
|
||||
# STORE THE CONFIG FILE CHECKSUM
|
||||
# BUILD APP
|
||||
#=================================================
|
||||
|
||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||
then
|
||||
ynh_script_progression --message="Building app..." --weight=160
|
||||
|
||||
pushd $final_path
|
||||
PIPENV_VENV_IN_PROJECT="enabled" PIPENV_SKIP_LOCK=true ynh_exec_warn_less python3 -m pipenv install jupyterlab==$jupyterlab_version jupyterhub notebook jupyterhub-ldapauthenticator pyzmq
|
||||
popd
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# UPDATE A CONFIG FILE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Updating a configuration file..."
|
||||
|
||||
mkdir -p "$final_path/config"
|
||||
|
||||
path=${path_url%/}
|
||||
|
@ -140,29 +124,23 @@ ynh_add_config --template="../conf/jupyterhub_config.py" --destination="$final_p
|
|||
|
||||
ynh_add_config --template="../conf/jupyter_notebook_config.py" --destination="$final_path/config/jupyter_notebook_config.py"
|
||||
|
||||
chown -R root: $final_path/
|
||||
chown -R $admin: $final_path/.venv/
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading systemd configuration..."
|
||||
|
||||
# Create a dedicated systemd config
|
||||
ynh_replace_string --match_string="__NODE_PATH__" --replace_string="$nodejs_path" --target_file="../conf/systemd.service"
|
||||
|
||||
ynh_add_systemd_config
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# SECURE FILES AND DIRECTORIES
|
||||
#=================================================
|
||||
|
||||
# Set permissions on app files
|
||||
chown -R root: $final_path/
|
||||
chown -R $admin: $final_path/.venv/
|
||||
|
||||
#=================================================
|
||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||
|
||||
yunohost service add $app --description="$app daemon" --log="$app"
|
||||
|
||||
|
@ -171,7 +149,7 @@ yunohost service add $app --description="$app daemon" --log="$app"
|
|||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..."
|
||||
|
||||
ynh_systemd_action --service_name=$app --action=start --line_match="JupyterHub is now running at" --log_path="systemd"
|
||||
ynh_systemd_action --service_name=$app --action="start" --line_match="JupyterHub is now running at" --log_path="systemd"
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
|
|
Loading…
Add table
Reference in a new issue