1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/lutim_ynh.git synced 2024-09-03 19:36:24 +02:00

Merge pull request #52 from ericgaspar/v.0.12.0

Upgrade to v.0.12.1
This commit is contained in:
Éric Gaspar 2020-10-21 23:51:17 +02:00 committed by GitHub
commit 35898ace16
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 83 additions and 248 deletions

View file

@ -1,8 +1,8 @@
Changelog
=========
## Unreleased
- Nothing for now...
## [0.12.1~ynh1](https://github.com/YunoHost-Apps/lutim_ynh/pull/46) - 2020-10-18
* [Update to Lutim 0.12.1](https://github.com/YunoHost-Apps/lutim_ynh/pull/52)
## [0.11.6~ynh4](https://github.com/YunoHost-Apps/lutim_ynh/pull/46) - 2020-04-25

View file

@ -13,7 +13,7 @@ If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to
Lutim stores images and allows you to see them, download them or share them on social networks.
Images are indefinitely stored unless you request that they will be deleted at first view or after 24 hours / one week / one month / one year.
**Shipped version:** 0.12.0
**Shipped version:** 0.12.1
## Screenshots
@ -23,7 +23,7 @@ Images are indefinitely stored unless you request that they will be deleted at f
## Configuration
Edit the file `/var/www/lutim/lutim.conf` to edit the configuration of Lutim.
Edit the file `/var/www/lutim/lutim.conf` to configure Lutim.
Then reload the lutim service.
## Documentation
@ -39,9 +39,8 @@ Not relevant.
#### Supported architectures
* x86-64b - [![](https://ci-apps.yunohost.org/ci/logs/lutim%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/lutim/)
* x86-64 - [![](https://ci-apps.yunohost.org/ci/logs/lutim%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/lutim/)
* ARMv8-A - [![](https://ci-apps-arm.yunohost.org/ci/logs/lutim%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/lutim/)
* Buster x86-64b - [![](https://ci-buster.nohost.me/ci/logs/lutim%20%28Apps%29.svg)](https://ci-buster.nohost.me/ci/apps/lutim/)
## Limitations
@ -56,8 +55,7 @@ Not relevant.
---
Developers infos
----------------
## Developers infos
Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/lutim_ynh/tree/testing).

View file

@ -8,12 +8,12 @@
> *Ce package vous permet d'installer Lutim rapidement et simplement sur un serveur YunoHost.
Si vous n'avez pas YunoHost, merci de regarder [ici](https://yunohost.org/#/install_fr) pour savoir comment l'installer et en profiter.*
## Résumé
## Vue d'ensemble
Lutim stocke les images et vous permet de les voir, de les télécharger ou de les partager sur les réseaux sociaux.
Les images sont stockées indéfiniment à moins que vous ne demandiez qu'elles soient effacées à la première vue ou après 24 heures / une semaine / un mois / un an.
**Version embarquée:** 0.12.0
**Version embarquée :** 0.12.1
## Captures d'écran
@ -23,13 +23,13 @@ Les images sont stockées indéfiniment à moins que vous ne demandiez qu'elles
## Configuration
Editez le fichier `/var/www/lutim/lutim.conf` pour éditer la configuration de Lutim.
Rechargez ensuite le service lutim.
Éditez le fichier `/var/www/lutim/lutim.conf` pour configurer Lutim.
Rechargez ensuite le service Lutim.
## Documentation
* Documentation officielle: https://framagit.org/luc/lutim/wikis/home
* Documentation YunoHost: Il n'y a pas d'autre documentation, n'hésitez pas à contribuer.
* Documentation officielle : https://framagit.org/luc/lutim/wikis/home
* Documentation YunoHost : https://yunohost.org/#/app_lutim_fr
## Fonctionnalités spécifiques à YunoHost
@ -39,9 +39,8 @@ Non applicable.
#### Architectures supportées.
* x86-64b - [![](https://ci-apps.yunohost.org/ci/logs/lutim%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/lutim/)
* x86-64 - [![](https://ci-apps.yunohost.org/ci/logs/lutim%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/lutim/)
* ARMv8-A - [![](https://ci-apps-arm.yunohost.org/ci/logs/lutim%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/lutim/)
* Buster x86-64b - [![](https://ci-buster.nohost.me/ci/logs/lutim%20%28Apps%29.svg)](https://ci-buster.nohost.me/ci/apps/lutim/)
## Limitations
@ -49,15 +48,14 @@ Non applicable.
## Liens
* Reporter un bug: https://github.com/YunoHost-Apps/lutim_ynh/issues
* Site de Lutim: https://lut.im/
* Dépôt de Lutim: https://framagit.org/fiat-tux/hat-softwares/lutim
* Site de YunoHost: https://yunohost.org/
* Reporter un bug : https://github.com/YunoHost-Apps/lutim_ynh/issues
* Site de Lutim : https://lut.im/
* Dépôt de Lutim : https://framagit.org/fiat-tux/hat-softwares/lutim
* Site de YunoHost : https://yunohost.org/
---
Informations à l'intention des développeurs
----------------
## Informations à l'intention des développeurs
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/lutim_ynh/tree/testing).

View file

@ -1,6 +1,6 @@
SOURCE_URL=https://framagit.org/fiat-tux/hat-softwares/lutim/-/archive/0.12.0/lutim-0.12.0.tar.gz
SOURCE_SUM=682eed6ddd9ba0421a5df87c555cd54e
SOURCE_SUM_PRG=md5sum
SOURCE_URL=https://framagit.org/fiat-tux/hat-softwares/lutim/-/archive/0.12.1/lutim-0.12.1.tar.gz
SOURCE_SUM=141f142d47e3a8367e0c292304ddbecfc34b49ae7e561e2c3526000040318973
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=

View file

@ -6,15 +6,19 @@
"en": "Self hosting images and sharing anonymous application",
"fr": "Application d'hébergement et de partage d'images anonyme"
},
"version": "0.12.0~ynh1",
"version": "0.12.1~ynh1",
"url": "https://lut.im",
"license": "AGPL-3.0",
"maintainer": {
"name": "None...",
"email": ""
},
"previous_maintainers": [{
"name": "Maniack Crudelis et matlink",
"email": "maniackc_dev@crudelis.fr"
},
}],
"requirements": {
"yunohost": ">= 3.7"
"yunohost": ">= 3.8.1"
},
"multi_instance": false,
"services": [
@ -50,7 +54,8 @@
},
"default": false,
"help": {
"en": "If you set Lutim as public, everyone will be able to upload images and share them.<br>But even if not public, everyone can see an image from a link shared with your Lutim."
"en": "If you set Lutim as public, everyone will be able to upload images and share them.<br>But even if not public, everyone can see an image from a link shared with your Lutim.",
"fr": "Si vous définissez Lutim comme public, tout le monde pourra télécharger des images et les partager.<br>Mais même si ce n'est pas public, tout le monde peut voir une image à partir d'un lien partagé avec votre Lutim."
}
},
{

View file

@ -1,9 +1,11 @@
#!/bin/bash
#=================================================
# PERSONAL HELPERS
# COMMON VARIABLES
#=================================================
app_depencencies="carton perlmagick libpq-dev shared-mime-info"
#=================================================
# BACKUP
#=================================================
@ -265,27 +267,27 @@ __PRE_TAG1__$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/service
#=================================================
ynh_debian_release () {
lsb_release --codename --short
}
# ynh_debian_release () {
# lsb_release --codename --short
# }
is_stretch () {
if [ "$(ynh_debian_release)" == "stretch" ]
then
return 0
else
return 1
fi
}
# is_stretch () {
# if [ "$(ynh_debian_release)" == "stretch" ]
# then
# return 0
# else
# return 1
# fi
# }
is_jessie () {
if [ "$(ynh_debian_release)" == "jessie" ]
then
return 0
else
return 1
fi
}
# is_jessie () {
# if [ "$(ynh_debian_release)" == "jessie" ]
# then
# return 0
# else
# return 1
# fi
# }
#=================================================
@ -579,160 +581,6 @@ ynh_check_ram () {
fi
}
#=================================================
# Define the values to configure php-fpm
#
# usage: ynh_get_scalable_phpfpm --usage=usage --footprint=footprint [--print]
# | arg: -f, --footprint - Memory footprint of the service (low/medium/high).
# low - Less than 20Mb of ram by pool.
# medium - Between 20Mb and 40Mb of ram by pool.
# high - More than 40Mb of ram by pool.
# Or specify exactly the footprint, the load of the service as Mb by pool instead of having a standard value.
# To have this value, use the following command and stress the service.
# watch -n0.5 ps -o user,cmd,%cpu,rss -u APP
#
# | arg: -u, --usage - Expected usage of the service (low/medium/high).
# low - Personal usage, behind the sso.
# medium - Low usage, few people or/and publicly accessible.
# high - High usage, frequently visited website.
#
# | arg: -p, --print - Print the result
#
#
#
# The footprint of the service will be used to defined the maximum footprint we can allow, which is half the maximum RAM.
# So it will be used to defined 'pm.max_children'
# A lower value for the footprint will allow more children for 'pm.max_children'. And so for
# 'pm.start_servers', 'pm.min_spare_servers' and 'pm.max_spare_servers' which are defined from the
# value of 'pm.max_children'
# NOTE: 'pm.max_children' can't exceed 4 times the number of processor's cores.
#
# The usage value will defined the way php will handle the children for the pool.
# A value set as 'low' will set the process manager to 'ondemand'. Children will start only if the
# service is used, otherwise no child will stay alive. This config gives the lower footprint when the
# service is idle. But will use more proc since it has to start a child as soon it's used.
# Set as 'medium', the process manager will be at dynamic. If the service is idle, a number of children
# equal to pm.min_spare_servers will stay alive. So the service can be quick to answer to any request.
# The number of children can grow if needed. The footprint can stay low if the service is idle, but
# not null. The impact on the proc is a little bit less than 'ondemand' as there's always a few
# children already available.
# Set as 'high', the process manager will be set at 'static'. There will be always as many children as
# 'pm.max_children', the footprint is important (but will be set as maximum a quarter of the maximum
# RAM) but the impact on the proc is lower. The service will be quick to answer as there's always many
# children ready to answer.
ynh_get_scalable_phpfpm () {
local legacy_args=ufp
# Declare an array to define the options of this helper.
declare -Ar args_array=( [u]=usage= [f]=footprint= [p]=print )
local usage
local footprint
local print
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
# Set all characters as lowercase
footprint=${footprint,,}
usage=${usage,,}
print=${print:-0}
if [ "$footprint" = "low" ]
then
footprint=20
elif [ "$footprint" = "medium" ]
then
footprint=35
elif [ "$footprint" = "high" ]
then
footprint=50
fi
# Define the way the process manager handle child processes.
if [ "$usage" = "low" ]
then
php_pm=ondemand
elif [ "$usage" = "medium" ]
then
php_pm=dynamic
elif [ "$usage" = "high" ]
then
php_pm=static
else
ynh_die --message="Does not recognize '$usage' as an usage value."
fi
# Get the total of RAM available, except swap.
local max_ram=$(ynh_check_ram --no_swap)
less0() {
# Do not allow value below 1
if [ $1 -le 0 ]
then
echo 1
else
echo $1
fi
}
# Define pm.max_children
# The value of pm.max_children is the total amount of ram divide by 2 and divide again by the footprint of a pool for this app.
# So if php-fpm start the maximum of children, it won't exceed half of the ram.
php_max_children=$(( $max_ram / 2 / $footprint ))
# If process manager is set as static, use half less children.
# Used as static, there's always as many children as the value of pm.max_children
if [ "$php_pm" = "static" ]
then
php_max_children=$(( $php_max_children / 2 ))
fi
php_max_children=$(less0 $php_max_children)
# To not overload the proc, limit the number of children to 4 times the number of cores.
local core_number=$(nproc)
local max_proc=$(( $core_number * 4 ))
if [ $php_max_children -gt $max_proc ]
then
php_max_children=$max_proc
fi
if [ "$php_pm" = "dynamic" ]
then
# Define pm.start_servers, pm.min_spare_servers and pm.max_spare_servers for a dynamic process manager
php_min_spare_servers=$(( $php_max_children / 8 ))
php_min_spare_servers=$(less0 $php_min_spare_servers)
php_max_spare_servers=$(( $php_max_children / 2 ))
php_max_spare_servers=$(less0 $php_max_spare_servers)
php_start_servers=$(( $php_min_spare_servers + ( $php_max_spare_servers - $php_min_spare_servers ) /2 ))
php_start_servers=$(less0 $php_start_servers)
else
php_min_spare_servers=0
php_max_spare_servers=0
php_start_servers=0
fi
if [ $print -eq 1 ]
then
ynh_debug --message="Footprint=${footprint}Mb by pool."
ynh_debug --message="Process manager=$php_pm"
ynh_debug --message="Max RAM=${max_ram}Mb"
if [ "$php_pm" != "static" ]; then
ynh_debug --message="\nMax estimated footprint=$(( $php_max_children * $footprint ))"
ynh_debug --message="Min estimated footprint=$(( $php_min_spare_servers * $footprint ))"
fi
if [ "$php_pm" = "dynamic" ]; then
ynh_debug --message="Estimated average footprint=$(( $php_max_spare_servers * $footprint ))"
elif [ "$php_pm" = "static" ]; then
ynh_debug --message="Estimated footprint=$(( $php_max_children * $footprint ))"
fi
ynh_debug --message="\nRaw php-fpm values:"
ynh_debug --message="pm.max_children = $php_max_children"
if [ "$php_pm" = "dynamic" ]; then
ynh_debug --message="pm.start_servers = $php_start_servers"
ynh_debug --message="pm.min_spare_servers = $php_min_spare_servers"
ynh_debug --message="pm.max_spare_servers = $php_max_spare_servers"
fi
fi
}
#=================================================

View file

@ -1,4 +0,0 @@
#!/bin/bash
# Dependencies
app_depencencies="carton perlmagick libpq-dev shared-mime-info"

View file

@ -19,7 +19,7 @@ ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=2
ynh_print_info --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
@ -27,11 +27,13 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain)
#=================================================
# STANDARD BACKUP STEPS
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
ynh_print_info --message="Declaring files to be backed up..."
#=================================================
# BACKUP THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Backing up the main app directory..."
CHECK_SIZE "$final_path"
ynh_backup --src_path="$final_path"
@ -39,30 +41,24 @@ ynh_backup --src_path="$final_path"
#=================================================
# BACKUP NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Backing up nginx web server configuration..."
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# SPECIFIC BACKUP
#=================================================
# BACKUP LOGROTATE
#=================================================
ynh_script_progression --message="Backing up logrotate configuration"
ynh_backup --src_path="/etc/logrotate.d/$app"
#=================================================
# BACKUP SYSTEMD
#=================================================
ynh_script_progression --message="Backing up systemd configuration"
ynh_backup --src_path="/etc/systemd/system/$app.service"
#=================================================
# BACKUP A CRON FILE
#=================================================
ynh_script_progression --message="Backing up cron file"
ynh_backup --src_path="/etc/cron.d/$app"
@ -70,4 +66,4 @@ ynh_backup --src_path="/etc/cron.d/$app"
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --last
ynh_print_info --message="Backup script completed for Lutim. (YunoHost will then actually copy those files to the archive)."

View file

@ -33,7 +33,7 @@ port=$(ynh_app_setting_get --app=$app --key=port)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before changing its url (may take a while)..." --weight=20
ynh_script_progression --message="Backing up Lutim before changing its URL (may take a while)..." --weight=20
# Backup the current version of the app
ynh_backup_before_upgrade
@ -79,21 +79,21 @@ fi
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
ynh_script_progression --message="Updating nginx web server configuration..." --weight=2
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=2
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
# Change the path in the nginx config file
# Change the path in the NGINX config file
if [ $change_path -eq 1 ]
then
# Make a backup of the original nginx config file if modified
# Make a backup of the original NGINX config file if modified
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
# Set global variables for nginx helper
# Set global variables for NGINX helper
domain="$old_domain"
path_url="$new_path"
# Create a dedicated nginx config
# Create a dedicated NGINX config
ynh_add_nginx_config
fi
@ -138,7 +138,7 @@ ynh_replace_string --match_string="\(^ *prefix.*=> '\).*" --replace_string="\1$n
#=================================================
# 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
@ -163,4 +163,4 @@ ynh_maintenance_mode_OFF
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Change of URL completed for $app" --last
ynh_script_progression --message="Change of URL completed for Lutim" --last

View file

@ -7,8 +7,6 @@
#=================================================
# Load common variables for all scripts.
source _variables
source _common.sh
source /usr/share/yunohost/helpers
@ -88,9 +86,9 @@ ynh_install_app_dependencies $app_depencencies
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring nginx web server..." --weight=2
ynh_script_progression --message="Configuring NGINX web server..." --weight=2
# Create a dedicated nginx config
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
@ -225,7 +223,7 @@ fi
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading nginx web server..." --weight=2
ynh_script_progression --message="Reloading NGINX web server..." --weight=2
ynh_systemd_action --service_name=nginx --action=reload
@ -248,7 +246,7 @@ ynh_systemd_action --action=restart --line_match="Manager.*started" --log_path="
# SEND A README FOR THE ADMIN
#=================================================
# Get main domain and buid the url of the admin panel of the app.
# Get main domain and buid the URL of the admin panel of the app.
admin_panel="https://$(grep portal_domain /etc/ssowat/conf.json | cut -d'"' -f4)/yunohost/admin/#/apps/$app"
echo "You can find a config file at $final_path/lutim.conf
@ -264,4 +262,4 @@ ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="root" --type
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of $app completed" --last
ynh_script_progression --message="Installation of Lutim completed" --last

View file

@ -36,7 +36,7 @@ ynh_remove_systemd_config
# Check if the service is declared in YunoHost
if ynh_exec_fully_quiet yunohost service status $app
then
ynh_script_progression --message="Removing $app service..."
ynh_script_progression --message="Removing Lutim service..."
yunohost service remove $app
fi
@ -51,7 +51,7 @@ ynh_remove_app_dependencies
#=================================================
# REMOVE APP MAIN DIR
#=================================================
ynh_script_progression --message="Removing app main directory..." --weight=2
ynh_script_progression --message="Removing Lutim main directory..." --weight=2
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
@ -59,9 +59,9 @@ ynh_secure_remove --file="$final_path"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Removing nginx web server configuration..."
ynh_script_progression --message="Removing NGINX web server configuration..."
# Remove the dedicated nginx config
# Remove the dedicated NGINX config
ynh_remove_nginx_config
#=================================================
@ -94,4 +94,4 @@ ynh_system_user_delete --username=$app
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Removal of $app completed" --last
ynh_script_progression --message="Removal of Lutim completed" --last

View file

@ -7,8 +7,6 @@
#=================================================
# Load common variables for all scripts.
source ../settings/scripts/_variables
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
@ -62,7 +60,7 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring the app main directory..."
ynh_script_progression --message="Restoring Lutim main directory..."
ynh_restore_file --origin_path="$final_path"
@ -130,7 +128,7 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading nginx web server..." --weight=2
ynh_script_progression --message="Reloading NGINX web server..." --weight=2
ynh_systemd_action --service_name=nginx --action=reload
@ -169,4 +167,4 @@ ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="root" --type
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Restoration completed for $app" --last
ynh_script_progression --message="Restoration completed for Lutim" --last

View file

@ -7,8 +7,6 @@
#=================================================
# Load common variables for all scripts.
source _variables
source _common.sh
source /usr/share/yunohost/helpers
@ -139,7 +137,7 @@ ynh_app_setting_set --app=$app --key=unprotected_uris --value="/"
#=================================================
# 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 Lutim before upgrading (may take a while)..." --weight=15
# Backup the current version of the app
ynh_backup_before_upgrade
@ -193,7 +191,7 @@ ynh_install_app_dependencies $app_depencencies
# Overwrite the nginx configuration only if it's allowed
if [ $overwrite_nginx -eq 1 ]
then
ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=2
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2
ynh_add_nginx_config
fi
@ -299,7 +297,7 @@ chown $app -R /var/log/$app
#=================================================
# 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
@ -346,4 +344,4 @@ ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="root" --type
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Upgrade of $app completed" --last
ynh_script_progression --message="Upgrade of Lutim completed" --last