1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/pyinventory_ynh.git synced 2024-09-03 20:16:09 +02:00

Merge pull request #92 from YunoHost-Apps/revert-90-bugfix-ci

Revert "Bugfix CI run" and fix it in a other way
This commit is contained in:
Jens Diemer 2022-01-18 09:46:20 +01:00 committed by GitHub
commit f2a5c7725a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 68 additions and 51 deletions

View file

@ -5,7 +5,7 @@
"description": {
"en": "Web based management to catalog things including state and location etc."
},
"version": "0.13.0~ynh3",
"version": "0.13.0~ynh4",
"url": "https://github.com/jedie/PyInventory",
"license": "GPL-3.0",
"maintainer": {
@ -25,29 +25,17 @@
{
"name": "domain",
"type": "domain",
"ask": {
"en": "Choose a domain for PyInventory",
"fr": "Choisissez un domaine pour PyInventory"
},
"example": "domain.org"
},
{
"name": "path",
"type": "path",
"ask": {
"en": "Choose a path for PyInventory",
"fr": "Choisissez un chemin pour PyInventory"
},
"example": "/pyinventory",
"default": "/pyinventory"
},
{
"name": "admin",
"type": "user",
"ask": {
"en": "Choose an admin user for PyInventory",
"fr": "Choisissez l'administrateur pour PyInventory"
},
"example": "johndoe"
}
]

View file

@ -1,6 +1,6 @@
[tool.poetry]
name = "pyinventory_ynh"
version = "0.13.0~ynh3"
version = "0.13.0~ynh4"
description = "Test pyinventory_ynh via local_test.py"
authors = ["JensDiemer <git@jensdiemer.de>"]
license = "GPL"

View file

@ -8,9 +8,11 @@ domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
admin=$YNH_APP_ARG_ADMIN
is_public=$YNH_APP_ARG_IS_PUBLIC
app=$YNH_APP_INSTANCE_NAME
# Currently not used: PyInventory has no public pages, yet!
is_public=$YNH_APP_ARG_IS_PUBLIC
#=================================================
# SET CONSTANTS
#=================================================
@ -27,31 +29,6 @@ log_file="${log_path}/pyinventory.log"
# dependencies used by the app
pkg_dependencies="build-essential python3-dev python3-pip python3-venv git libpq-dev postgresql postgresql-contrib libjpeg-dev"
#=================================================
# PyInventory shared functions
#=================================================
setup_venv() {
ynh_script_progression --message="Setup Python virtualenv..." --weight=15
# Always recreate everything fresh with current python version
ynh_secure_remove "${final_path}/venv"
python3 -m venv --without-pip "${final_path}/venv"
cp ../conf/requirements.txt "$final_path/requirements.txt"
chown -R "$app:" "$final_path"
(
# Activate venv in sub shell
set +o nounset
source "${final_path}/venv/bin/activate"
set -o nounset
ynh_exec_as $app $final_path/venv/bin/python3 -m ensurepip
ynh_exec_as $app $final_path/venv/bin/pip3 install --upgrade wheel pip
ynh_exec_as $app $final_path/venv/bin/pip3 install --no-deps -r "$final_path/requirements.txt"
)
}
#=================================================
# Redis HELPERS
#=================================================

View file

@ -25,7 +25,6 @@ new_path=$YNH_APP_NEW_PATH
ynh_script_progression --message="Loading installation settings..."
admin=$(ynh_app_setting_get --app="$app" --key=admin)
is_public=$(ynh_app_setting_get --app="$app" --key=is_public)
public_path=$(ynh_app_setting_get --app="$app" --key=public_path)
final_path=$(ynh_app_setting_get --app="$app" --key=final_path)
log_path=$(ynh_app_setting_get --app="$app" --key=log_path)
@ -38,7 +37,7 @@ redis_db=$(ynh_app_setting_get --app="$app" --key=redis_db)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=15
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=40
# Backup the current version of the app
ynh_backup_before_upgrade

View file

@ -40,7 +40,6 @@ touch "${log_file}"
ynh_script_progression --message="Storing installation settings..."
ynh_app_setting_set --app="$app" --key=admin --value="$admin"
ynh_app_setting_set --app="$app" --key=is_public --value="$is_public"
ynh_app_setting_set --app="$app" --key=public_path --value="$public_path"
ynh_app_setting_set --app="$app" --key=final_path --value="$final_path"
ynh_app_setting_set --app="$app" --key=log_path --value="$log_file"
@ -63,7 +62,7 @@ redis_db=$(ynh_redis_get_free_db)
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing dependencies..." --weight=10
ynh_script_progression --message="Installing dependencies..." --weight=20
ynh_exec_warn_less ynh_install_app_dependencies "$pkg_dependencies"
@ -101,7 +100,26 @@ ynh_system_user_create --username="$app" --home_dir="$final_path" --use_shell
#=================================================
# PIP INSTALLATION
#=================================================
setup_venv # function defined in _common.sh
ynh_script_progression --message="Install project via pip..." --weight=50
# Always recreate everything fresh with current python version
ynh_secure_remove "${final_path}/venv"
# Skip pip because of: https://github.com/YunoHost/issues/issues/1960
python3 -m venv --without-pip "${final_path}/venv"
cp ../conf/requirements.txt "$final_path/requirements.txt"
chown -R "$app:" "$final_path"
#run source in a 'sub shell'
(
set +o nounset
source "${final_path}/venv/bin/activate"
set -o nounset
ynh_exec_as $app $final_path/venv/bin/python3 -m ensurepip
ynh_exec_as $app $final_path/venv/bin/pip3 install --upgrade wheel pip setuptools
ynh_exec_as $app $final_path/venv/bin/pip3 install --no-deps -r "$final_path/requirements.txt"
)
#=================================================
# copy config files

View file

@ -78,7 +78,7 @@ chown -R "$app:" "$final_path"
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=10
ynh_script_progression --message="Reinstalling dependencies..." --weight=20
ynh_exec_warn_less ynh_install_app_dependencies "$pkg_dependencies"
@ -86,7 +86,24 @@ ynh_exec_warn_less ynh_install_app_dependencies "$pkg_dependencies"
# REINSTALL PYTHON VIRTUALENV
# Maybe the backup contains a other Python version
#=================================================
setup_venv # function defined in _common.sh
ynh_script_progression --message="Upgrade Python virtualenv..." --weight=50
# Always recreate everything fresh with current python version
ynh_secure_remove "${final_path}/venv"
# Skip pip because of: https://github.com/YunoHost/issues/issues/1960
python3 -m venv --without-pip "${final_path}/venv"
chown -R "$app:" "$final_path"
#run source in a 'sub shell'
(
set +o nounset
source "${final_path}/venv/bin/activate"
set -o nounset
ynh_exec_as $app $final_path/venv/bin/python3 -m ensurepip
ynh_exec_as $app $final_path/venv/bin/pip3 install --upgrade wheel pip setuptools
ynh_exec_as $app $final_path/venv/bin/pip3 install --no-deps -r "$final_path/requirements.txt"
)
#=================================================
# RESTORE THE PostgreSQL DATABASE

View file

@ -13,7 +13,6 @@ source /usr/share/yunohost/helpers
ynh_script_progression --message="Loading installation settings..."
admin=$(ynh_app_setting_get --app="$app" --key=admin)
is_public=$(ynh_app_setting_get --app="$app" --key=is_public)
public_path=$(ynh_app_setting_get --app="$app" --key=public_path)
final_path=$(ynh_app_setting_get --app="$app" --key=final_path)
log_path=$(ynh_app_setting_get --app="$app" --key=log_path)
@ -29,7 +28,7 @@ redis_db=$(ynh_app_setting_get --app="$app" --key=redis_db)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=15
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=40
# Backup the current version of the app
ynh_backup_before_upgrade
@ -63,7 +62,7 @@ ynh_add_nginx_config "public_path" "port"
#=================================================
# Update dependencies
#=================================================
ynh_script_progression --message="Upgrading dependencies..."
ynh_script_progression --message="Upgrading dependencies..." --weight=20
ynh_exec_warn_less ynh_install_app_dependencies "$pkg_dependencies"
@ -85,7 +84,26 @@ ynh_add_systemd_config --service="$app" --template="pyinventory.service"
#=================================================
# UPGRADE VENV
#=================================================
setup_venv # function defined in _common.sh
ynh_script_progression --message="Upgrade project via pip..." --weight=50
# Always recreate everything fresh with current python version
ynh_secure_remove "${final_path}/venv"
# Skip pip because of: https://github.com/YunoHost/issues/issues/1960
python3 -m venv --without-pip "${final_path}/venv"
cp ../conf/requirements.txt "$final_path/requirements.txt"
chown -R "$app:" "$final_path"
#run source in a 'sub shell'
(
set +o nounset
source "${final_path}/venv/bin/activate"
set -o nounset
ynh_exec_as $app $final_path/venv/bin/python3 -m ensurepip
ynh_exec_as $app $final_path/venv/bin/pip3 install --upgrade wheel pip setuptools
ynh_exec_as $app $final_path/venv/bin/pip3 install --no-deps -r "$final_path/requirements.txt"
)
#=================================================
# copy config files