From 9148edc3615edb39552391b27732ffc1d4666c73 Mon Sep 17 00:00:00 2001 From: Tobias Ollive Date: Wed, 7 Apr 2021 08:56:15 +0200 Subject: [PATCH] update to use env config port --- conf/app.src | 4 ++-- conf/systemd.service | 2 +- scripts/install | 8 +++++--- scripts/remove | 2 -- scripts/restore | 2 +- scripts/upgrade | 9 +++++---- 6 files changed, 14 insertions(+), 13 deletions(-) diff --git a/conf/app.src b/conf/app.src index 5ff4fff..5598b36 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://framagit.org/yphil/petrolette/-/archive/e122e90dfca6db7f288c510941655522582895b4/petrolette-e122e90dfca6db7f288c510941655522582895b4.tar.gz -SOURCE_SUM=26914cb6a84d97fe88d0e06a39e926da7233d2beb9389e52641ac6a6cdb5d598 +SOURCE_URL=https://framagit.org/yphil/petrolette/-/archive/80f2c901ba4b40a12d664c7e567532ba5ea6157f/petrolette-80f2c901ba4b40a12d664c7e567532ba5ea6157f.tar.gz +SOURCE_SUM=0fc5c6bc6f850c8e348faa5c0defd25ecf7ec1e35dda3c804f201c818f867649 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/conf/systemd.service b/conf/systemd.service index 50e00b4..dfa0318 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -4,7 +4,7 @@ After=network.target [Service] Type=simple -Environment="PORT=__PORT__" +Environment="PTL_PORT_HTTP=__HTTP_PORT__" Environment="__YNH_NODE_LOAD_PATH__" User=__APP__ Group=__APP__ diff --git a/scripts/install b/scripts/install index dc2ee86..08f77f5 100644 --- a/scripts/install +++ b/scripts/install @@ -56,8 +56,10 @@ ynh_app_setting_set --app=$app --key=path_url --value=$path_url ynh_script_progression --message="Finding an available port..." # Find an available port -port=$(ynh_find_port --port=8001) -ynh_app_setting_set --app=$app --key=port --value=$port +http_port=$(ynh_find_port --port=8001) +https_port=$(ynh_find_port --port=8002) +ynh_app_setting_set --app=$app --key=http_port --value=$http_port +ynh_app_setting_set --app=$app --key=https_port --value=$https_port #================================================= # INSTALL DEPENDENCIES @@ -121,7 +123,7 @@ yunohost service add $app --description="The news reader that doesn't know you" ynh_script_progression --message="Configuring a systemd service..." # Create a dedicated systemd config -ynh_add_systemd_config --others_var="port ynh_node_load_PATH" +ynh_add_systemd_config --others_var="http_port ynh_node_load_PATH" #================================================= # START SYSTEMD SERVICE diff --git a/scripts/remove b/scripts/remove index 8a3b593..dc1b34e 100644 --- a/scripts/remove +++ b/scripts/remove @@ -16,8 +16,6 @@ ynh_script_progression --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get --app=$app --key=domain) -port=$(ynh_app_setting_get --app=$app --key=port) final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= diff --git a/scripts/restore b/scripts/restore index c56a4d4..9678126 100644 --- a/scripts/restore +++ b/scripts/restore @@ -82,7 +82,7 @@ chmod -R o-rwx $final_path ynh_script_progression --message="Reinstalling dependencies..." --weight=1 ynh_install_nodejs --nodejs_version=$NODEJS_VERSION -ynh_remove_nodejs + #================================================= # RESTORE SYSTEMD #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index dc8ba7f..02a0628 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -18,9 +18,9 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) -#admin_email=$(ynh_app_setting_get --app=$app --key=admin_email) final_path=$(ynh_app_setting_get --app=$app --key=final_path) -port=$(ynh_app_setting_get --app=$app --key=port) +http_port=$(ynh_app_setting_get --app=$app --key=http_port) +https_port=$(ynh_app_setting_get --app=$app --key=https_port) #================================================= # CHECK VERSION @@ -77,7 +77,7 @@ ynh_add_nginx_config ynh_script_progression --message="Upgrading dependencies..." --weight=2 ynh_install_nodejs --nodejs_version=$NODEJS_VERSION - +ynh_remove_nodejs #================================================= # UPDATE APP #================================================= @@ -85,7 +85,7 @@ ynh_script_progression --message="Upgrading the app..." --weight=5 pushd $final_path ynh_use_nodejs - ynh_npm update --production + ynh_npm update popd #================================================= @@ -112,6 +112,7 @@ ynh_add_systemd_config # Set permissions on app files chown -R $app:$app $final_path +chmod -R o-rwx $final_path #================================================= # INTEGRATE SERVICE IN YUNOHOST