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

Merge pull request #31 from YunoHost-Apps/install-sub-path

Install sub path
This commit is contained in:
Clément 2021-04-17 16:35:06 +02:00 committed by GitHub
commit 8861f3e0e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 163 additions and 13 deletions

View file

@ -31,10 +31,6 @@ How to configure this app:
LDAP is not supported (blocked until Gotify core upstream implements it). LDAP is not supported (blocked until Gotify core upstream implements it).
## Limitations
* Require dedicated domain like `gotify.domain.tld`
## Links ## Links
* Report a bug: https://github.com/YunoHost-Apps/gotify_ynh/issues * Report a bug: https://github.com/YunoHost-Apps/gotify_ynh/issues

View file

@ -11,7 +11,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour
## Vue d'ensemble ## Vue d'ensemble
Gotify est un serveur simple permettant d'envoyer et de recevoir des messages via websocket. Gotify est un serveur simple permettant d'envoyer et de recevoir des messages via websocket.
**Version incluse :** 2.0.20 **Version incluse :** 2.0.22
## Captures d'écran ## Captures d'écran
@ -31,10 +31,6 @@ Pour configurer Gotify :
Pas de support de LDAP (non implémenté upstream) Pas de support de LDAP (non implémenté upstream)
## Limitations
* Nécessite un domaine dédié comme par exemple `gotify.domain.tld`
## Liens ## Liens
* Signaler un bug : https://github.com/YunoHost-Apps/gotify_ynh/issues * Signaler un bug : https://github.com/YunoHost-Apps/gotify_ynh/issues

View file

@ -6,12 +6,13 @@
;; Test complet ;; Test complet
; Manifest ; Manifest
domain="domain.tld" (DOMAIN) domain="domain.tld" (DOMAIN)
path="/path" (PATH)
admin="john" (USER) admin="john" (USER)
password="pass" password="pass"
port="666" (PORT) port="666" (PORT)
; Checks ; Checks
pkg_linter=1 pkg_linter=1
setup_sub_dir=0 setup_sub_dir=1
setup_root=1 setup_root=1
setup_nourl=0 setup_nourl=0
setup_private=0 setup_private=0
@ -21,7 +22,7 @@
backup_restore=1 backup_restore=1
multi_instance=1 multi_instance=1
port_already_use=1 port_already_use=1
change_url=0 change_url=1
;;; Upgrade options ;;; Upgrade options
; commit=e0fbbb9a6d2fd87b4d42e85c0fc8f4e479689abc ; commit=e0fbbb9a6d2fd87b4d42e85c0fc8f4e479689abc
name=Mon Feb 18 21:55:49 2019 +0100 Merge branch 'master' of github.com:YunoHost-Apps/gotify_ynh name=Mon Feb 18 21:55:49 2019 +0100 Merge branch 'master' of github.com:YunoHost-Apps/gotify_ynh

View file

@ -18,6 +18,7 @@ location __PATH__/stream {
location __PATH__/ { location __PATH__/ {
proxy_pass http://127.0.0.1:__PORT__/; proxy_pass http://127.0.0.1:__PORT__/;
#sub_path_only rewrite ^/__PATH__(/.*) $1 break;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_buffering off; proxy_buffering off;
fastcgi_param REMOTE_USER $remote_user; fastcgi_param REMOTE_USER $remote_user;

View file

@ -6,7 +6,7 @@
"en": "A simple server for sending and receiving messages.", "en": "A simple server for sending and receiving messages.",
"fr": "Un simple serveur pour envoyer et recevoir des messages." "fr": "Un simple serveur pour envoyer et recevoir des messages."
}, },
"version": "2.0.22~ynh1", "version": "2.0.22~ynh2",
"url": "http://gotify.net", "url": "http://gotify.net",
"license": "MIT", "license": "MIT",
"maintainer": { "maintainer": {
@ -32,6 +32,16 @@
}, },
"example": "example.com" "example": "example.com"
}, },
{
"name": "path",
"type": "path",
"ask": {
"en": "Choose a path for Gotify",
"fr": "Choisissez un chemin pour Gotify"
},
"example": "/gotify",
"default": "/gotify"
},
{ {
"name": "admin", "name": "admin",
"type": "user", "type": "user",

18
pull_request_template.md Normal file
View file

@ -0,0 +1,18 @@
## Problem
- *Description of why you made this PR*
## Solution
- *And how do you fix that problem*
## PR Status
- [ ] Code finished.
- [ ] Tested with Package_check.
- [ ] Fix or enhancement tested.
- [ ] Upgrade from last version tested.
- [ ] Can be reviewed and tested.
## Package_check results
---
*If you have access to [App Continuous Integration for packagers](https://yunohost.org/#/packaging_apps_ci) you can provide a link to the package_check results like below, replacing '-NUM-' in this link by the PR number and USERNAME by your username on the ci-apps-dev. Or you provide a screenshot or a pastebin of the results*
[![Build Status](https://ci-apps-dev.yunohost.org/jenkins/job/gotify_ynh%20PR-NUM-%20(USERNAME)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/gotify_ynh%20PR-NUM-%20(USERNAME)/)

128
scripts/change_url Normal file
View file

@ -0,0 +1,128 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
old_domain=$YNH_APP_OLD_DOMAIN
old_path=$YNH_APP_OLD_PATH
new_domain=$YNH_APP_NEW_DOMAIN
new_path=$YNH_APP_NEW_PATH
app=$YNH_APP_INSTANCE_NAME
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --time --weight=1
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
port=$(ynh_app_setting_get $app port)
#=================================================
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --time --weight=1
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# 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"
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# CHECK WHICH PARTS SHOULD BE CHANGED
#=================================================
change_domain=0
if [ "$old_domain" != "$new_domain" ]
then
change_domain=1
fi
change_path=0
if [ "$old_path" != "$new_path" ]
then
change_path=1
fi
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping a systemd service..." --time --weight=1
ynh_systemd_action --service_name=$app --action="stop"
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
ynh_script_progression --message="Updating NGINX web server configuration..." --time --weight=1
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
# 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
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
# Set global variables for NGINX helper
domain="$old_domain"
path_url="$new_path"
# Create a dedicated NGINX config
ynh_add_nginx_config
fi
# Change the domain for NGINX
if [ $change_domain -eq 1 ]
then
# Delete file checksum for the old conf file location
ynh_delete_file_checksum --file="$nginx_conf_path"
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
# Store file checksum for the new config file location
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
fi
#=================================================
# SPECIFIC MODIFICATIONS
#=================================================
#=================================================
#=================================================
# GENERIC FINALISATION
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --time --weight=1
ynh_systemd_action --service_name=$app --action="start"
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --time --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Change of URL completed for $app" --time --last

View file

@ -21,7 +21,7 @@ ynh_abort_if_errors
#================================================= #=================================================
domain=$YNH_APP_ARG_DOMAIN domain=$YNH_APP_ARG_DOMAIN
path_url=/ path_url=$YNH_APP_ARG_PATH
admin=$YNH_APP_ARG_ADMIN admin=$YNH_APP_ARG_ADMIN
is_public=1 is_public=1
password=$YNH_APP_ARG_PASSWORD password=$YNH_APP_ARG_PASSWORD