mirror of
https://github.com/YunoHost-Apps/grafana_ynh.git
synced 2024-09-03 20:36:29 +02:00
[fix] upgrade port settings (#8)
* [fix]set port on upgrade * [fix] set port settings on install * [fix] Better check port * [enh] Add restart service * [fix] restart with sudo
This commit is contained in:
parent
ac71922b54
commit
0dee15e9a7
2 changed files with 13 additions and 1 deletions
|
@ -30,6 +30,7 @@ sudo yunohost app checkurl "${domain}${path}" -a "$app" \
|
||||||
# Save app settings
|
# Save app settings
|
||||||
ynh_app_setting_set "$app" admin "$admin"
|
ynh_app_setting_set "$app" admin "$admin"
|
||||||
ynh_app_setting_set "$app" is_public "$is_public"
|
ynh_app_setting_set "$app" is_public "$is_public"
|
||||||
|
ynh_app_setting_set "$app" port "$port"
|
||||||
|
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
install_dependencies
|
install_dependencies
|
||||||
|
|
|
@ -18,6 +18,13 @@ source /usr/share/yunohost/helpers
|
||||||
domain=$(ynh_app_setting_get "$app" domain)
|
domain=$(ynh_app_setting_get "$app" domain)
|
||||||
path=$(ynh_app_setting_get "$app" path)
|
path=$(ynh_app_setting_get "$app" path)
|
||||||
is_public=$(ynh_app_setting_get "$app" is_public)
|
is_public=$(ynh_app_setting_get "$app" is_public)
|
||||||
|
port=$(ynh_app_setting_get "$app" port)
|
||||||
|
|
||||||
|
# test port settings
|
||||||
|
if [[ -z "$port" ]]; then
|
||||||
|
port=3000
|
||||||
|
ynh_app_setting_set $app port $port
|
||||||
|
fi
|
||||||
|
|
||||||
# Fix path if needed
|
# Fix path if needed
|
||||||
path=$(fix_path $path)
|
path=$(fix_path $path)
|
||||||
|
@ -25,6 +32,9 @@ path=$(fix_path $path)
|
||||||
# There's currently nothing else to upgrade than packaging files
|
# There's currently nothing else to upgrade than packaging files
|
||||||
# as InfluxDB/Grafana updates are managed through APT
|
# as InfluxDB/Grafana updates are managed through APT
|
||||||
|
|
||||||
|
# Restart service
|
||||||
|
sudo systemctl restart grafana-server
|
||||||
|
|
||||||
# Modify Nginx configuration file and copy it to Nginx conf directory
|
# Modify Nginx configuration file and copy it to Nginx conf directory
|
||||||
if [[ "$path" == "/" ]] ; then
|
if [[ "$path" == "/" ]] ; then
|
||||||
nginx_conf=$SRCPATH/../conf/nginx_root.conf
|
nginx_conf=$SRCPATH/../conf/nginx_root.conf
|
||||||
|
@ -33,6 +43,7 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sed -i "s@YNH_WWW_PATH@${path}@g" $nginx_conf
|
sed -i "s@YNH_WWW_PATH@${path}@g" $nginx_conf
|
||||||
|
sed -i "s@YNH_WWW_PORT@$port@g" $nginx_conf
|
||||||
sudo cp $nginx_conf /etc/nginx/conf.d/$domain.d/$app.conf
|
sudo cp $nginx_conf /etc/nginx/conf.d/$domain.d/$app.conf
|
||||||
|
|
||||||
# If app is public, add url to SSOWat conf as skipped_uris
|
# If app is public, add url to SSOWat conf as skipped_uris
|
||||||
|
|
Loading…
Reference in a new issue