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

Apply example_ynh

This commit is contained in:
yalh76 2021-08-27 00:33:56 +02:00
parent eb419dc07c
commit eed830d610
17 changed files with 101 additions and 108 deletions

View file

@ -1,13 +1,8 @@
# See here for more information
# https://github.com/YunoHost/package_check#syntax-check_process-file
# Move this file from check_process.default to check_process when you have filled it.
;; Test complet
; Manifest
domain="domain.tld" (DOMAIN)
is_public=1 (PUBLIC|public=1|private=0)
mapbox_token=
domain="domain.tld"
is_public=1
mapbox_token=""
; Checks
pkg_linter=1
setup_sub_dir=0
@ -16,6 +11,7 @@
setup_private=1
setup_public=1
upgrade=1
# Version 2.3.2
upgrade=1 from_commit=069fc840e413e1d2cf80616498bcc052e05616a1
backup_restore=1
multi_instance=1
@ -28,4 +24,3 @@ Notification=none
; commit=069fc840e413e1d2cf80616498bcc052e05616a1
name="Version 2.3.2"
manifest_arg=domain=domain.tld&is_public=1&mapbox_token=

View file

@ -3,5 +3,5 @@ SOURCE_SUM=d6fc5f1496eb698325af2844ee201db1ab55cecdbe2b4e9928e9299598ed47a8
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=v2.3.4.tar.gz
SOURCE_FILENAME=v2.3.5.tar.gz
SOURCE_EXTRACT=true

View file

@ -7,7 +7,7 @@ location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Forwarded-Port $server_port;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";

0
doc/.gitkeep Normal file
View file

2
doc/DISCLAIMER.md Normal file
View file

@ -0,0 +1,2 @@
* Any known limitations, constrains or stuff not working, such as (but not limited to):
* not-working single-sign on or LDAP integration

2
doc/DISCLAIMER_fr.md Normal file
View file

@ -0,0 +1,2 @@
* Toutes les limitations, contraintes ou éléments ne fonctionnant pas, tels que (mais sans s'y limiter) :
* authentification unique ou intégration LDAP non fonctionnelle

0
doc/screenshots/.gitkeep Normal file
View file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

View file

@ -8,6 +8,13 @@
},
"version": "2.3.5~ynh1",
"url": "https://photoview.github.io/",
"upstream": {
"license": "AGPL-3.0-only",
"website": "https://photoview.github.io/",
"demo": "https://photos.qpqp.dk/",
"admindoc": "https://photoview.github.io/docs/",
"code": "https://github.com/photoview/photoview"
},
"license": "AGPL-3.0-only",
"maintainer": {
"name": "Jules Bertholet",

View file

@ -28,9 +28,9 @@ ynh_print_info --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
data_path=$(ynh_app_setting_get --app=$app --key=data_path)
domain=$(ynh_app_setting_get --app=$app --key=domain)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
data_path=$(ynh_app_setting_get --app=$app --key=data_path)
#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
@ -69,12 +69,6 @@ ynh_backup --src_path="/etc/logrotate.d/$app"
ynh_backup --src_path="/etc/systemd/system/$app.service"
#=================================================
# BACKUP VARIOUS FILES
#=================================================
ynh_backup --src_path="/var/log/$app"
#=================================================
# BACKUP THE MYSQL DATABASE
#=================================================

View file

@ -40,7 +40,7 @@ data_path=$(ynh_app_setting_get --app=$app --key=data_path)
mapbox_token=$(ynh_app_setting_get --app=$app --key=mapbox_token)
#=================================================
# 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=35
@ -97,11 +97,14 @@ fi
#=================================================
# SPECIFIC MODIFICATIONS
#=================================================
# ADD A CONFIGURATION
# UPDATE A CONFIG FILE
#=================================================
ynh_script_progression --message="Updating a configuration file..."
ynh_add_config --template=".env" --destination="$final_path/output/.env"
set_permissions
#=================================================
# GENERIC FINALISATION
#=================================================
@ -109,6 +112,7 @@ ynh_add_config --template=".env" --destination="$final_path/output/.env"
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
# Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
#=================================================

View file

@ -56,7 +56,7 @@ ynh_app_setting_set --app=$app --key=mapbox_token --value=$mapbox_token
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# FIND PORTS
# FIND AND OPEN A PORT
#=================================================
ynh_script_progression --message="Finding an available port..." --weight=1
@ -78,7 +78,7 @@ ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ st
ynh_script_progression --message="Configuring system user..." --weight=1
# Create a system user
ynh_system_user_create --username=$app --home_dir="$final_path"
ynh_system_user_create --username=$app --home_dir=$final_path
#=================================================
# CREATE A MYSQL DATABASE
@ -131,21 +131,22 @@ ynh_script_progression --message="Building static UI files..." --weight=45
build_ui
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Adding a configuration file..."
ynh_add_config --template=".env" --destination="$final_path/output/.env"
set_permissions
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_script_progression --message="Configuring a systemd service..." --weight=1
# Create a dedicated systemd config
ynh_add_systemd_config --service=$app
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_add_config --template=".env" --destination="$final_path/output/.env"
set_permissions
ynh_add_systemd_config
#=================================================
# GENERIC FINALIZATION

View file

@ -44,6 +44,14 @@ ynh_script_progression --message="Stopping and removing the systemd service..."
# Remove the dedicated systemd config
ynh_remove_systemd_config
#=================================================
# REMOVE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Removing logrotate configuration..." --weight=1
# Remove the app-specific logrotate config
ynh_remove_logrotate
#=================================================
# REMOVE THE MYSQL DATABASE
#=================================================
@ -58,6 +66,8 @@ ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
ynh_script_progression --message="Removing dependencies..." --weight=5
# Remove metapackage and its dependencies
ynh_remove_go
ynh_remove_nodejs
ynh_remove_app_dependencies
#=================================================
@ -68,14 +78,6 @@ ynh_script_progression --message="Removing app main directory..." --weight=1
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
#=================================================
# REMOVE APP DATA DIR
#=================================================
ynh_script_progression --message="Removing app data directory..." --weight=1
# Remove the app directory securely
ynh_secure_remove --file="$data_path"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
@ -84,36 +86,23 @@ ynh_script_progression --message="Removing NGINX web server configuration..." --
# Remove the dedicated NGINX config
ynh_remove_nginx_config
#=================================================
# REMOVE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Removing logrotate configuration..." --weight=1
# Remove the app-specific logrotate config
ynh_remove_logrotate
#=================================================
# SPECIFIC REMOVE
#=================================================
# REMOVE VARIOUS FILES
#=================================================
ynh_script_progression --message="Removing various files..."
# Remove the log files
ynh_secure_remove --file="/var/log/$app"
#=================================================
# REMOVE GO
# REMOVE APP DATA DIR
#=================================================
ynh_script_progression --message="Removing Go..." --weight=1
ynh_script_progression --message="Removing app data directory..." --weight=1
ynh_remove_go
#=================================================
# REMOVE NODE
#=================================================
ynh_script_progression --message="Removing Node.js..." --weight=1
ynh_remove_nodejs
# Remove the app directory securely
ynh_secure_remove --file="$data_path"
#=================================================
# GENERIC FINALIZATION

View file

@ -52,25 +52,17 @@ 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"
#=================================================
# 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 --home_dir="$final_path"
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=30
# Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies
ynh_system_user_create --username=$app --home_dir=$final_path
#=================================================
# RESTORE THE APP MAIN DIR
@ -84,7 +76,6 @@ set_permissions
#=================================================
# RESTORE THE APP DATA DIR
#=================================================
ynh_script_progression --message="Restoring the app data directory..." --weight=1
ynh_restore_file --origin_path="$data_path" --not_mandatory
@ -93,6 +84,14 @@ set_permissions
#=================================================
# SPECIFIC RESTORATION
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=30
# Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# RESTORE THE MYSQL DATABASE
#=================================================
@ -124,6 +123,15 @@ ynh_script_progression --message="Restoring the systemd configuration..." --weig
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
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"
set_permissions
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
@ -138,20 +146,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
#=================================================
# RESTORE VARIOUS FILES
#=================================================
ynh_restore_file --origin_path="/var/log/$app"
#=================================================
# RESTORE THE LOGROTATE CONFIGURATION
#=================================================
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
set_permissions
#=================================================
# GENERIC FINALIZATION
#=================================================

View file

@ -29,6 +29,7 @@ mapbox_token=$(ynh_app_setting_get --app=$app --key=mapbox_token)
#=================================================
# CHECK VERSION
#=================================================
ynh_script_progression --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed)
@ -55,20 +56,25 @@ ynh_script_progression --message="Stopping a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..."
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
fi
#=================================================
# 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 --home_dir="$final_path"
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading dependencies..." --weight=1
ynh_install_app_dependencies $pkg_dependencies
ynh_system_user_create --username=$app --home_dir=$final_path
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
@ -89,6 +95,13 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." -
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading dependencies..." --weight=1
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# SPECIFIC UPGRADE
#=================================================
@ -116,29 +129,25 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]; then
build_ui
fi
#=================================================
# UPDATE A CONFIG FILE
#=================================================
ynh_script_progression --message="Updating a configuration file..."
ynh_add_config --template=".env" --destination="$final_path/output/.env"
set_permissions
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_script_progression --message="Upgrading systemd configuration..." --weight=1
# Create a dedicated systemd config
ynh_add_systemd_config --service=$app
#=================================================
# UPDATE A CONFIG FILE
#=================================================
ynh_add_config --template=".env" --destination="$final_path/output/.env"
ynh_add_systemd_config
#=================================================
# GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
# Set permissions on app files
set_permissions
#=================================================
# SETUP LOGROTATE
#=================================================

View file

@ -1,2 +0,0 @@
*~
*.sw[op]

View file

@ -1,2 +0,0 @@
*~
*.sw[op]