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 #68 from YunoHost-Apps/upgrade

Apply example_ynh
This commit is contained in:
yalh76 2022-06-21 12:43:27 +02:00 committed by GitHub
commit 37976296d9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 173 additions and 133 deletions

View file

@ -5,7 +5,7 @@ It shall NOT be edited by hand.
# Lutim for YunoHost # Lutim for YunoHost
[![Integration level](https://dash.yunohost.org/integration/lutim.svg)](https://dash.yunohost.org/appci/app/lutim) ![](https://ci-apps.yunohost.org/ci/badges/lutim.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/lutim.maintain.svg) [![Integration level](https://dash.yunohost.org/integration/lutim.svg)](https://dash.yunohost.org/appci/app/lutim) ![Working status](https://ci-apps.yunohost.org/ci/badges/lutim.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/lutim.maintain.svg)
[![Install Lutim with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=lutim) [![Install Lutim with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=lutim)
*[Lire ce readme en français.](./README_fr.md)* *[Lire ce readme en français.](./README_fr.md)*
@ -18,10 +18,9 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
Lutim stores images and allows you to see them, download them or share them on social networks. 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. 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.1~ynh3 **Shipped version:** 0.12.1~ynh4
**Demo:** https://lut.im/ **Demo:** https://lut.im/
## Disclaimers / important information ## Disclaimers / important information
## Configuration ## Configuration
@ -31,21 +30,22 @@ Then reload the lutim service.
## Documentation and resources ## Documentation and resources
* Official app website: https://lut.im * Official app website: <https://lut.im>
* Official user documentation: https://framagit.org/luc/lutim/wikis/home * Official user documentation: <https://framagit.org/luc/lutim/wikis/home>
* Upstream app code repository: https://framagit.org/fiat-tux/hat-softwares/lutim * Upstream app code repository: <https://framagit.org/fiat-tux/hat-softwares/lutim>
* YunoHost documentation for this app: https://yunohost.org/app_lutim * YunoHost documentation for this app: <https://yunohost.org/app_lutim>
* Report a bug: https://github.com/YunoHost-Apps/lutim_ynh/issues * Report a bug: <https://github.com/YunoHost-Apps/lutim_ynh/issues>
## Developer info ## Developer info
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/lutim_ynh/tree/testing). Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/lutim_ynh/tree/testing).
To try the testing branch, please proceed like that. To try the testing branch, please proceed like that.
```
``` bash
sudo yunohost app install https://github.com/YunoHost-Apps/lutim_ynh/tree/testing --debug sudo yunohost app install https://github.com/YunoHost-Apps/lutim_ynh/tree/testing --debug
or or
sudo yunohost app upgrade lutim -u https://github.com/YunoHost-Apps/lutim_ynh/tree/testing --debug sudo yunohost app upgrade lutim -u https://github.com/YunoHost-Apps/lutim_ynh/tree/testing --debug
``` ```
**More info regarding app packaging:** https://yunohost.org/packaging_apps **More info regarding app packaging:** <https://yunohost.org/packaging_apps>

View file

@ -1,10 +1,14 @@
<!--
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.
-->
# Lutim pour YunoHost # Lutim pour YunoHost
[![Niveau d'intégration](https://dash.yunohost.org/integration/lutim.svg)](https://dash.yunohost.org/appci/app/lutim) ![](https://ci-apps.yunohost.org/ci/badges/lutim.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/lutim.maintain.svg) [![Niveau d'intégration](https://dash.yunohost.org/integration/lutim.svg)](https://dash.yunohost.org/appci/app/lutim) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/lutim.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/lutim.maintain.svg)
[![Installer Lutim avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=lutim) [![Installer Lutim avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=lutim)
*[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 Lutim rapidement et simplement sur un serveur YunoHost. > *Ce package vous permet d'installer Lutim 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.* Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
@ -14,10 +18,9 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour
Lutim stocke les images et vous permet de les voir, de les télécharger ou de les partager sur les réseaux sociaux. 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. 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 incluse :** 0.12.1~ynh3 **Version incluse :** 0.12.1~ynh4
**Démo :** https://lut.im/ **Démo :** https://lut.im/
## Avertissements / informations importantes ## Avertissements / informations importantes
## Configuration ## Configuration
@ -27,21 +30,22 @@ Rechargez ensuite le service Lutim.
## Documentations et ressources ## Documentations et ressources
* Site officiel de l'app : https://lut.im * Site officiel de l'app : <https://lut.im>
* Documentation officielle utilisateur : https://framagit.org/luc/lutim/wikis/home * Documentation officielle utilisateur : <https://framagit.org/luc/lutim/wikis/home>
* Dépôt de code officiel de l'app : https://framagit.org/fiat-tux/hat-softwares/lutim * Dépôt de code officiel de l'app : <https://framagit.org/fiat-tux/hat-softwares/lutim>
* Documentation YunoHost pour cette app : https://yunohost.org/app_lutim * Documentation YunoHost pour cette app : <https://yunohost.org/app_lutim>
* Signaler un bug : https://github.com/YunoHost-Apps/lutim_ynh/issues * Signaler un bug : <https://github.com/YunoHost-Apps/lutim_ynh/issues>
## Informations pour les développeurs ## Informations pour les développeurs
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/lutim_ynh/tree/testing). Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/lutim_ynh/tree/testing).
Pour essayer la branche testing, procédez comme suit. Pour essayer la branche testing, procédez comme suit.
```
``` bash
sudo yunohost app install https://github.com/YunoHost-Apps/lutim_ynh/tree/testing --debug sudo yunohost app install https://github.com/YunoHost-Apps/lutim_ynh/tree/testing --debug
ou ou
sudo yunohost app upgrade lutim -u https://github.com/YunoHost-Apps/lutim_ynh/tree/testing --debug sudo yunohost app upgrade lutim -u https://github.com/YunoHost-Apps/lutim_ynh/tree/testing --debug
``` ```
**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps **Plus d'infos sur le packaging d'applications :** <https://yunohost.org/packaging_apps>

View file

@ -15,10 +15,11 @@
upgrade=1 from_commit=ec8858ed0d054049a0c8f46c6126ee8ae0798e8f upgrade=1 from_commit=ec8858ed0d054049a0c8f46c6126ee8ae0798e8f
backup_restore=1 backup_restore=1
multi_instance=0 multi_instance=0
port_already_use=0
change_url=1 change_url=1
;;; Options ;;; Options
Email= Email=
Notification=change Notification=none
;;; Upgrade options ;;; Upgrade options
; commit=ec8858ed0d054049a0c8f46c6126ee8ae0798e8f ; commit=ec8858ed0d054049a0c8f46c6126ee8ae0798e8f
name=22 May 2020 ec8858ed0d054049a0c8f46c6126ee8ae0798e8f name=22 May 2020 ec8858ed0d054049a0c8f46c6126ee8ae0798e8f

View file

@ -4,3 +4,4 @@ SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true SOURCE_IN_SUBDIR=true
SOURCE_FILENAME= SOURCE_FILENAME=
SOURCE_EXTRACT=true

View file

@ -6,7 +6,6 @@
# see http://mojolicio.us/perldoc/Mojo/Server/Hypnotoad for a full list of settings # see http://mojolicio.us/perldoc/Mojo/Server/Hypnotoad for a full list of settings
hypnotoad => { hypnotoad => {
# array of IP addresses and ports you want to listen to # array of IP addresses and ports you want to listen to
#listen => ['http://127.0.0.1:8080'],
listen => ['http://127.0.0.1:__PORT__'], listen => ['http://127.0.0.1:__PORT__'],
# if you use Lutim behind a reverse proxy like Nginx, you want to set proxy to 1 # if you use Lutim behind a reverse proxy like Nginx, you want to set proxy to 1
# if you use Lutim directly, let it commented # if you use Lutim directly, let it commented
@ -106,6 +105,29 @@
# optional, default is 0 # optional, default is 0
always_encrypt => __ENCRYPT__, always_encrypt => __ENCRYPT__,
# you can allow to use a watermark on the uploaded images (or enforce its use)
# define a path to the watermark image (provide an image with alpha channel)
# you can define the path relative to lutim directory or set an absolute path
# to disable the usage of a watermark, leave it blank or commented
# optional, no default
#watermark_path => '',
# the watermark can be a tiling one or a single one
# when using a small one, you can choose where to place it
# valid values are 'Center', 'North', 'NorthEast', 'East', 'SouthEast', 'South', 'SouthWest', 'West' and 'NorthWest' (case insensitive)
# optional, default is 'SouthEast'
#watermark_placement => 'SouthEast',
# choose which watermark (tiling, single or none) should be used by default
# valid values are 'tiling', 'single' or 'none' (case insensitive)
# optional, default is 'none'
#watermark_default => 'none',
# choose which watermark (tiling, single or none) should be enforced (users will always have a watermark and wont be able to disable it)
# valid values are 'tiling', 'single' or 'none' (case insensitive)
# optional, default is 'none'
#watermark_enforce => 'none',
# length of the image's delete token # length of the image's delete token
# optional, default is 24 # optional, default is 24
#token_length => 24, #token_length => 24,
@ -114,7 +136,6 @@
# example: you want to have Lutim under https://example.org/lutim/ # example: you want to have Lutim under https://example.org/lutim/
# => set prefix to '/lutim' or to '/lutim/', it doesn't matter # => set prefix to '/lutim' or to '/lutim/', it doesn't matter
# optional, defaut is / # optional, defaut is /
#prefix => '/',
prefix => '__PATH__', prefix => '__PATH__',
# choose what database you want to use # choose what database you want to use
@ -284,7 +305,6 @@
# max size of the files directory, in octets # max size of the files directory, in octets
# used by script/lutim cron watch to trigger an action # used by script/lutim cron watch to trigger an action
# optional, no default # optional, no default
#max_total_size => 10*1024*1024*1024, # (=10 Go)
max_total_size => 1024*1024*1024, # (=1 Go) max_total_size => 1024*1024*1024, # (=1 Go)
# default action when files directory is over max_total_size (used with script/lutim cron watch) # default action when files directory is over max_total_size (used with script/lutim cron watch)

View file

@ -1,7 +1,5 @@
location __PATH__ { #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
location __PATH__/ {
# Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc;
# This is important for user's privacy ! # This is important for user's privacy !
access_log off; access_log off;
@ -22,4 +20,7 @@ location __PATH__ {
# We expect the downsteam servers to redirect to the right hostname, so don't do any rewrite # We expect the downsteam servers to redirect to the right hostname, so don't do any rewrite
proxy_redirect off; proxy_redirect off;
# Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc;
} }

View file

@ -6,7 +6,7 @@
"en": "Anonymous image hosting service", "en": "Anonymous image hosting service",
"fr": "Service d'hébergement anonyme d'images" "fr": "Service d'hébergement anonyme d'images"
}, },
"version": "0.12.1~ynh3", "version": "0.12.1~ynh4",
"url": "https://lut.im", "url": "https://lut.im",
"upstream": { "upstream": {
"license": "AGPL-3.0-only", "license": "AGPL-3.0-only",
@ -32,7 +32,7 @@
"nginx" "nginx"
], ],
"arguments": { "arguments": {
"install" : [ "install": [
{ {
"name": "domain", "name": "domain",
"type": "domain" "type": "domain"

View file

@ -28,6 +28,8 @@ ynh_script_progression --message="Loading installation settings..." --weight=2
# Needed for helper "ynh_add_nginx_config" # Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
# Add settings here as needed by your application
is_public=$(ynh_app_setting_get --app=$app --key=is_public) is_public=$(ynh_app_setting_get --app=$app --key=is_public)
port=$(ynh_app_setting_get --app=$app --key=port) port=$(ynh_app_setting_get --app=$app --key=port)
@ -40,7 +42,6 @@ ynh_script_progression --message="Backing up the app before changing its URL (ma
ynh_backup_before_upgrade ynh_backup_before_upgrade
ynh_clean_setup () { ynh_clean_setup () {
ynh_clean_check_starting 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. # 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" ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
@ -77,6 +78,13 @@ fi
#================================================= #=================================================
# STANDARD MODIFICATIONS # STANDARD MODIFICATIONS
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping a systemd service..."
ynh_systemd_action --service_name=$app --action="stop"
#================================================= #=================================================
# MODIFY URL IN NGINX CONF # MODIFY URL IN NGINX CONF
#================================================= #=================================================
@ -134,12 +142,12 @@ ynh_replace_string --match_string="\(^ *prefix.*=> '\).*" --replace_string="\1$n
#================================================= #=================================================
# GENERIC FINALISATION # GENERIC FINALISATION
#================================================= #=================================================
# START AND CHECK LUTIM BOOTING # START SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Restarting Lutim..." --weight=3 ynh_script_progression --message="Starting a systemd service..." --weight=3
# Wait for lutim to be fully started # Start a systemd service
ynh_systemd_action --action=restart --line_match="Manager.*started" --log_path="/var/log/$app/production.log" --timeout="120" ynh_systemd_action --service_name=$app --action="start" --line_match="Manager.*started" --log_path="/var/log/$app/production.log" --timeout="120"
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX

View file

@ -14,7 +14,6 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
ynh_clean_setup () { ynh_clean_setup () {
# Clean installation remaining that are not handle by the remove script.
ynh_clean_check_starting ynh_clean_check_starting
} }
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
@ -31,6 +30,8 @@ always_encrypt=$YNH_APP_ARG_ALWAYS_ENCRYPT
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
secret=$(ynh_string_random)
#================================================= #=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#================================================= #=================================================
@ -51,6 +52,7 @@ ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=is_public --value=$is_public ynh_app_setting_set --app=$app --key=is_public --value=$is_public
ynh_app_setting_set --app=$app --key=always_encrypt --value=$always_encrypt ynh_app_setting_set --app=$app --key=always_encrypt --value=$always_encrypt
ynh_app_setting_set --app=$app --key=secret --value="$secret"
ynh_app_setting_set --app=$app --key=overwrite_settings --value=1 ynh_app_setting_set --app=$app --key=overwrite_settings --value=1
ynh_app_setting_set --app=$app --key=overwrite_nginx --value=1 ynh_app_setting_set --app=$app --key=overwrite_nginx --value=1
@ -81,7 +83,7 @@ ynh_install_app_dependencies $pkg_dependencies
ynh_script_progression --message="Configuring system user..." --weight=2 ynh_script_progression --message="Configuring system user..." --weight=2
# Create a system user # Create a system user
ynh_system_user_create --username=$app --home_dir=$final_path ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
@ -117,9 +119,9 @@ ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --targ
ynh_replace_string --match_string="__PATH__" --replace_string="$path_url" --target_file="$final_path/lutim.conf" ynh_replace_string --match_string="__PATH__" --replace_string="$path_url" --target_file="$final_path/lutim.conf"
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/lutim.conf" ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/lutim.conf"
ynh_replace_string --match_string="__ENCRYPT__" --replace_string="$always_encrypt" --target_file="$final_path/lutim.conf" ynh_replace_string --match_string="__ENCRYPT__" --replace_string="$always_encrypt" --target_file="$final_path/lutim.conf"
secret=$(ynh_string_random)
ynh_replace_string --match_string="__SECRET__" --replace_string="$secret" --target_file="$final_path/lutim.conf" ynh_replace_string --match_string="__SECRET__" --replace_string="$secret" --target_file="$final_path/lutim.conf"
ynh_app_setting_set --app=$app --key=secret --value="$secret"
# Set the number of process for Lutim to twice the number of CPU core. # Set the number of process for Lutim to twice the number of CPU core.
ynh_replace_string --match_string="__WORKERS__" --replace_string="$(( $(nproc) * 2 ))" --target_file="$final_path/lutim.conf" ynh_replace_string --match_string="__WORKERS__" --replace_string="$(( $(nproc) * 2 ))" --target_file="$final_path/lutim.conf"
# Calculate and store the config file checksum into the app settings # Calculate and store the config file checksum into the app settings
@ -174,7 +176,7 @@ chown $app -R /var/log/$app
ln -s /var/log/$app/production.log "$final_path/log/production.log" ln -s /var/log/$app/production.log "$final_path/log/production.log"
#================================================= #=================================================
# GENERIC FINALISATION # GENERIC FINALIZATION
#================================================= #=================================================
# SETUP LOGROTATE # SETUP LOGROTATE
#================================================= #=================================================

View file

@ -41,12 +41,12 @@ ynh_script_progression --message="Stopping and removing the systemd service..."
ynh_remove_systemd_config ynh_remove_systemd_config
#================================================= #=================================================
# REMOVE DEPENDENCIES # REMOVE LOGROTATE CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Removing dependencies..." --weight=20 ynh_script_progression --message="Removing logrotate configuration..."
# Remove metapackage and its dependencies # Remove the app-specific logrotate config
ynh_remove_app_dependencies ynh_remove_logrotate
#================================================= #=================================================
# REMOVE APP MAIN DIR # REMOVE APP MAIN DIR
@ -65,12 +65,12 @@ ynh_script_progression --message="Removing NGINX web server configuration..."
ynh_remove_nginx_config ynh_remove_nginx_config
#================================================= #=================================================
# REMOVE LOGROTATE CONFIGURATION # REMOVE DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Removing logrotate configuration..." ynh_script_progression --message="Removing dependencies..." --weight=20
# Remove the app-specific logrotate config # Remove metapackage and its dependencies
ynh_remove_logrotate ynh_remove_app_dependencies
#================================================= #=================================================
# SPECIFIC REMOVE # SPECIFIC REMOVE

View file

@ -15,7 +15,6 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
ynh_clean_setup () { ynh_clean_setup () {
# Clean installation remaining that are not handle by the remove script.
ynh_clean_check_starting ynh_clean_check_starting
} }
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
@ -49,20 +48,13 @@ ynh_maintenance_mode_ON
#================================================= #=================================================
# STANDARD RESTORATION STEPS # STANDARD RESTORATION STEPS
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX configuration..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# RECREATE THE DEDICATED USER # RECREATE THE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Recreating the dedicated system user..." --weight=2 ynh_script_progression --message="Recreating the dedicated system user..." --weight=2
# Create the dedicated user (if not existing) # Create the 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"
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # RESTORE THE APP MAIN DIR
@ -82,18 +74,23 @@ chown -R $app:$app "$final_path"
#================================================= #=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=60 ynh_script_progression --message="Reinstalling dependencies..." --weight=60
# Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies ynh_install_app_dependencies $pkg_dependencies
#================================================= #=================================================
# RESTORE THE CRON FILE # RESTORE THE NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Restoring the NGINX configuration..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RESTORE VARIOUS FILES
#=================================================
ynh_script_progression --message="Restoring various files..."
ynh_restore_file --origin_path="/etc/cron.d/$app" ynh_restore_file --origin_path="/etc/cron.d/$app"
#=================================================
# SETUP LOG FILE
#=================================================
# Making log a symbolic link to /var/log # Making log a symbolic link to /var/log
mkdir -p /var/log/$app/ mkdir -p /var/log/$app/
touch /var/log/$app/production.log touch /var/log/$app/production.log
@ -107,10 +104,18 @@ ynh_script_progression --message="Restoring the systemd configuration..."
ynh_restore_file --origin_path="/etc/systemd/system/$app.service" ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable $app.service --quiet systemctl enable $app.service --quiet
#=================================================
# RESTORE THE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the logrotate configuration..."
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#================================================= #=================================================
# INTEGRATE SERVICE IN YUNOHOST # INTEGRATE SERVICE IN YUNOHOST
#================================================= #=================================================
ynh_script_progression --message="Integrating service in YunoHost..." ynh_script_progression --message="Integrating service in YunoHost..."
yunohost service add $app --log="$final_path/log/production.log" yunohost service add $app --log="$final_path/log/production.log"
#================================================= #=================================================
@ -118,16 +123,8 @@ yunohost service add $app --log="$final_path/log/production.log"
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=3 ynh_script_progression --message="Starting a systemd service..." --weight=3
# Wait for lutim to be fully started
ynh_systemd_action --action=restart --line_match="Manager.*started" --log_path="/var/log/$app/production.log" --timeout="120" ynh_systemd_action --action=restart --line_match="Manager.*started" --log_path="/var/log/$app/production.log" --timeout="120"
#=================================================
# RESTORE THE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the logrotate configuration..."
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================

View file

@ -48,9 +48,8 @@ ynh_script_progression --message="Backing up the app before upgrading (may take
# Backup the current version of the app # Backup the current version of the app
ynh_backup_before_upgrade ynh_backup_before_upgrade
ynh_clean_setup () { ynh_clean_setup () {
# Clean installation remaining that are not handle by the remove script.
ynh_clean_check_starting ynh_clean_check_starting
# restore it if the upgrade fails # Restore it if the upgrade fails
ynh_restore_upgradebackup ynh_restore_upgradebackup
} }
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
@ -65,6 +64,13 @@ ynh_maintenance_mode_ON
#================================================= #=================================================
# STANDARD UPGRADE STEPS # STANDARD UPGRADE STEPS
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping a systemd service..."
ynh_systemd_action --service_name=$app --action="stop"
#================================================= #=================================================
# ENSURE DOWNWARD COMPATIBILITY # ENSURE DOWNWARD COMPATIBILITY
#================================================= #=================================================
@ -165,7 +171,7 @@ ynh_app_setting_set --app=$app --key=unprotected_uris --value="/"
ynh_script_progression --message="Making sure dedicated system user exists..." 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"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
@ -183,6 +189,13 @@ chmod 750 "$final_path"
chmod -R o-rwx "$final_path" chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path" chown -R $app:www-data "$final_path"
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading dependencies..." --weight=9
ynh_install_app_dependencies $pkg_dependencies
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
@ -194,13 +207,6 @@ then
ynh_add_nginx_config ynh_add_nginx_config
fi fi
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading dependencies..." --weight=9
ynh_install_app_dependencies $pkg_dependencies
#================================================= #=================================================
# SPECIFIC UPGRADE # SPECIFIC UPGRADE
#================================================= #=================================================
@ -245,17 +251,6 @@ fi
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../hooks/post_app_addaccess" ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../hooks/post_app_addaccess"
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../hooks/post_app_removeaccess" ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../hooks/post_app_removeaccess"
#=================================================
# SETUP SYSTEMD
#=================================================
# Overwrite the systemd configuration only if it's allowed
if [ $overwrite_systemd -eq 1 ]
then
ynh_script_progression --message="Upgrading systemd configuration..." --weight=2
ynh_add_systemd_config
fi
#================================================= #=================================================
# SETUP CRON # SETUP CRON
#================================================= #=================================================
@ -275,6 +270,17 @@ then
popd popd
fi fi
#=================================================
# SETUP SYSTEMD
#=================================================
# Overwrite the systemd configuration only if it's allowed
if [ $overwrite_systemd -eq 1 ]
then
ynh_script_progression --message="Upgrading systemd configuration..." --weight=2
ynh_add_systemd_config
fi
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================
@ -290,15 +296,15 @@ chown $app -R /var/log/$app
# INTEGRATE SERVICE IN YUNOHOST # INTEGRATE SERVICE IN YUNOHOST
#================================================= #=================================================
ynh_script_progression --message="Integrating service in YunoHost..." ynh_script_progression --message="Integrating service in YunoHost..."
yunohost service add $app --log="$final_path/log/production.log" yunohost service add $app --log="$final_path/log/production.log"
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service...." --weight=4 ynh_script_progression --message="Starting a systemd service..." --weight=4
# Wait for lutim to be fully started ynh_systemd_action --service_name=$app --action="start" --line_match="Manager.*started" --log_path="/var/log/$app/production.log" --timeout="120"
ynh_systemd_action --action=restart --line_match="Manager.*started" --log_path="/var/log/$app/production.log" --timeout="120"
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX