mirror of
https://github.com/YunoHost-Apps/distbin_ynh.git
synced 2024-09-03 18:26:10 +02:00
commit
66388111b0
6 changed files with 43 additions and 14 deletions
|
@ -6,21 +6,21 @@
|
||||||
;; Test complet
|
;; Test complet
|
||||||
; Manifest
|
; Manifest
|
||||||
domain="domain.tld" (DOMAIN)
|
domain="domain.tld" (DOMAIN)
|
||||||
|
path="/path" (PATH)
|
||||||
is_public=1 (PUBLIC|public=1|private=0)
|
is_public=1 (PUBLIC|public=1|private=0)
|
||||||
; 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=1
|
setup_private=1
|
||||||
setup_public=1
|
setup_public=1
|
||||||
upgrade=1
|
upgrade=1
|
||||||
upgrade=1 from_commit=d39e8118603e1cc7e00d1c414ad9b55da68bfc7a
|
|
||||||
backup_restore=1
|
backup_restore=1
|
||||||
multi_instance=1
|
multi_instance=1
|
||||||
incorrect_path=1
|
incorrect_path=1
|
||||||
port_already_use=0
|
port_already_use=0
|
||||||
change_url=0
|
change_url=1
|
||||||
;;; Levels
|
;;; Levels
|
||||||
Level 1=auto
|
Level 1=auto
|
||||||
Level 2=auto
|
Level 2=auto
|
||||||
|
|
|
@ -8,7 +8,7 @@ PORT=__PORT__
|
||||||
DB_DIR=__FINALPATH__/distbin-db
|
DB_DIR=__FINALPATH__/distbin-db
|
||||||
|
|
||||||
# The external URL
|
# The external URL
|
||||||
EXTERNAL_URL=https://__DOMAIN_URI__
|
EXTERNAL_URL=https://__DOMAIN_URI__/
|
||||||
|
|
||||||
# The internal URL
|
# The internal URL
|
||||||
INTERNAL_URL=http://localhost:__PORT__/
|
INTERNAL_URL=http://localhost:__PORT__/
|
||||||
|
|
|
@ -7,8 +7,12 @@ location __PATH__/ {
|
||||||
}
|
}
|
||||||
|
|
||||||
proxy_pass http://127.0.0.1:__PORT__/;
|
proxy_pass http://127.0.0.1:__PORT__/;
|
||||||
proxy_set_header Host $host;
|
proxy_pass_request_headers on;
|
||||||
# proxy_buffering off;
|
proxy_redirect ~^/(.*) $scheme://$http_host__PATH__/$1;
|
||||||
|
proxy_set_header Host $http_host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
|
||||||
# Include SSOWAT user panel.
|
# Include SSOWAT user panel.
|
||||||
include conf.d/yunohost_panel.conf.inc;
|
include conf.d/yunohost_panel.conf.inc;
|
||||||
|
|
|
@ -30,6 +30,16 @@
|
||||||
},
|
},
|
||||||
"example": "distbin.example.com"
|
"example": "distbin.example.com"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "path",
|
||||||
|
"type": "path",
|
||||||
|
"ask": {
|
||||||
|
"en": "Choose a path for distbin",
|
||||||
|
"fr": "Choisissez un chemin pour distbin"
|
||||||
|
},
|
||||||
|
"example": "/distbin",
|
||||||
|
"default": "/distbin"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "is_public",
|
"name": "is_public",
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
source _common.sh
|
source _common.sh
|
||||||
|
source ynh_systemd_action
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -17,7 +18,7 @@ old_domain=$YNH_APP_OLD_DOMAIN
|
||||||
old_path=$YNH_APP_OLD_PATH
|
old_path=$YNH_APP_OLD_PATH
|
||||||
|
|
||||||
new_domain=$YNH_APP_NEW_DOMAIN
|
new_domain=$YNH_APP_NEW_DOMAIN
|
||||||
new_path="/"
|
new_path=$YNH_APP_NEW_PATH
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
@ -32,6 +33,7 @@ final_path=$(ynh_app_setting_get $app final_path)
|
||||||
# Add settings here as needed by your application
|
# Add settings here as needed by your application
|
||||||
#db_name=$(ynh_app_setting_get "$app" db_name)
|
#db_name=$(ynh_app_setting_get "$app" db_name)
|
||||||
#db_pwd=$(ynh_app_setting_get $app db_pwd)
|
#db_pwd=$(ynh_app_setting_get $app db_pwd)
|
||||||
|
port=$(ynh_app_setting_get $app port)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK THE SYNTAX OF THE PATHS
|
# CHECK THE SYNTAX OF THE PATHS
|
||||||
|
@ -95,14 +97,22 @@ fi
|
||||||
# STOP SERVICE
|
# STOP SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_systemd_action --action=stop --service_name=$app
|
ynh_systemd_action --action=stop --service_name=$app --log_path=systemd --line_match="Stopped Distbin Service"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MODIFY A CONFIG FILE
|
# MODIFY A CONFIG FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Change the URL in the configuration file
|
# Change the URL in the configuration file
|
||||||
ynh_replace_string "EXTERNAL_URL=.*" "EXTERNAL_URL=https://$new_domain$new_path" "$final_path/.env"
|
|
||||||
|
if [ "$new_path" == "/" ]
|
||||||
|
then
|
||||||
|
new_domain_uri="$new_domain"
|
||||||
|
else
|
||||||
|
new_domain_uri="$new_domain$new_path"
|
||||||
|
fi
|
||||||
|
|
||||||
|
ynh_replace_string "EXTERNAL_URL=.*" "EXTERNAL_URL=https://$new_domain_uri/" "$final_path/.env"
|
||||||
|
|
||||||
### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script.
|
### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script.
|
||||||
### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it.
|
### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it.
|
||||||
|
@ -114,8 +124,7 @@ ynh_store_file_checksum "$final_path/.env"
|
||||||
# START SERVICE
|
# START SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_systemd_action --action=start --service_name=$app
|
ynh_systemd_action --action=start --service_name=$app --line_match="http"
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALISATION
|
# GENERIC FINALISATION
|
||||||
|
|
|
@ -26,7 +26,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=$YNH_APP_ARG_IS_PUBLIC
|
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||||
#language=$YNH_APP_ARG_LANGUAGE
|
#language=$YNH_APP_ARG_LANGUAGE
|
||||||
|
@ -196,10 +196,16 @@ ynh_add_systemd_config
|
||||||
### (It's compatible with sed regular expressions syntax)
|
### (It's compatible with sed regular expressions syntax)
|
||||||
|
|
||||||
cp "../conf/.env" "$final_path/.env"
|
cp "../conf/.env" "$final_path/.env"
|
||||||
|
if [ "$path_url" == "/" ]
|
||||||
|
then
|
||||||
|
domain_uri="$domain"
|
||||||
|
else
|
||||||
|
domain_uri="$domain$path_url"
|
||||||
|
fi
|
||||||
|
|
||||||
ynh_replace_string "__NODEJS_PATH__" "$nodejs_path" "$final_path/.env"
|
ynh_replace_string "__NODEJS_PATH__" "$nodejs_path" "$final_path/.env"
|
||||||
ynh_replace_string "__PORT__" "$port" "$final_path/.env"
|
ynh_replace_string "__PORT__" "$port" "$final_path/.env"
|
||||||
ynh_replace_string "__DOMAIN_URI__" "$domain$path_url" "$final_path/.env"
|
ynh_replace_string "__DOMAIN_URI__" "$domain_uri" "$final_path/.env"
|
||||||
ynh_replace_string "__FINALPATH__" "$final_path" "$final_path/.env"
|
ynh_replace_string "__FINALPATH__" "$final_path" "$final_path/.env"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -281,7 +287,7 @@ systemctl reload nginx
|
||||||
# START SERVICE
|
# START SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_systemd_action --action=start --service_name=$app --log_path=systemd --line_match="Started Distbin Service"
|
ynh_systemd_action --action=start --service_name=$app --line_match="http"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
|
|
Loading…
Add table
Reference in a new issue