1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/petrolette_ynh.git synced 2024-09-03 19:56:26 +02:00

update to use env config port

This commit is contained in:
Tobias Ollive 2021-04-07 08:56:15 +02:00
parent 8fd1533f7e
commit 9148edc361
6 changed files with 14 additions and 13 deletions

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://framagit.org/yphil/petrolette/-/archive/e122e90dfca6db7f288c510941655522582895b4/petrolette-e122e90dfca6db7f288c510941655522582895b4.tar.gz SOURCE_URL=https://framagit.org/yphil/petrolette/-/archive/80f2c901ba4b40a12d664c7e567532ba5ea6157f/petrolette-80f2c901ba4b40a12d664c7e567532ba5ea6157f.tar.gz
SOURCE_SUM=26914cb6a84d97fe88d0e06a39e926da7233d2beb9389e52641ac6a6cdb5d598 SOURCE_SUM=0fc5c6bc6f850c8e348faa5c0defd25ecf7ec1e35dda3c804f201c818f867649
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true SOURCE_IN_SUBDIR=true

View file

@ -4,7 +4,7 @@ After=network.target
[Service] [Service]
Type=simple Type=simple
Environment="PORT=__PORT__" Environment="PTL_PORT_HTTP=__HTTP_PORT__"
Environment="__YNH_NODE_LOAD_PATH__" Environment="__YNH_NODE_LOAD_PATH__"
User=__APP__ User=__APP__
Group=__APP__ Group=__APP__

View file

@ -56,8 +56,10 @@ ynh_app_setting_set --app=$app --key=path_url --value=$path_url
ynh_script_progression --message="Finding an available port..." ynh_script_progression --message="Finding an available port..."
# Find an available port # Find an available port
port=$(ynh_find_port --port=8001) http_port=$(ynh_find_port --port=8001)
ynh_app_setting_set --app=$app --key=port --value=$port 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 # 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..." ynh_script_progression --message="Configuring a systemd service..."
# Create a dedicated systemd config # 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 # START SYSTEMD SERVICE

View file

@ -16,8 +16,6 @@ ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME 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) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#================================================= #=================================================

View file

@ -82,7 +82,7 @@ chmod -R o-rwx $final_path
ynh_script_progression --message="Reinstalling dependencies..." --weight=1 ynh_script_progression --message="Reinstalling dependencies..." --weight=1
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
ynh_remove_nodejs
#================================================= #=================================================
# RESTORE SYSTEMD # RESTORE SYSTEMD
#================================================= #=================================================

View file

@ -18,9 +18,9 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path) 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) 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 # CHECK VERSION
@ -77,7 +77,7 @@ ynh_add_nginx_config
ynh_script_progression --message="Upgrading dependencies..." --weight=2 ynh_script_progression --message="Upgrading dependencies..." --weight=2
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
ynh_remove_nodejs
#================================================= #=================================================
# UPDATE APP # UPDATE APP
#================================================= #=================================================
@ -85,7 +85,7 @@ ynh_script_progression --message="Upgrading the app..." --weight=5
pushd $final_path pushd $final_path
ynh_use_nodejs ynh_use_nodejs
ynh_npm update --production ynh_npm update
popd popd
#================================================= #=================================================
@ -112,6 +112,7 @@ ynh_add_systemd_config
# Set permissions on app files # Set permissions on app files
chown -R $app:$app $final_path chown -R $app:$app $final_path
chmod -R o-rwx $final_path
#================================================= #=================================================
# INTEGRATE SERVICE IN YUNOHOST # INTEGRATE SERVICE IN YUNOHOST