diff --git a/conf/nginx.conf b/conf/nginx.conf index fdf77fe..4b1b6d1 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -4,7 +4,7 @@ location / { proxy_set_header Host $host; proxy_set_header X-NginX-Proxy true; - proxy_pass http://localhost:9220; + proxy_pass http://localhost:__WEB_ADMIN_PORT__; proxy_redirect off; # Socket.io support @@ -18,18 +18,18 @@ location / { access_by_lua_file /usr/share/ssowat/access.lua; location ~ \.(js|css|woff|woff2|ttf|png) { - proxy_pass http://localhost:9220; + proxy_pass http://localhost:__WEB_ADMIN_PORT__; } location ~ /webmin { - proxy_pass http://localhost:9220$uri; + proxy_pass http://localhost:__WEB_ADMIN_PORT__$uri; } location ~ ^/bma(.*)$ { - proxy_pass http://localhost:__PORT__$1$is_args$args; + proxy_pass http://localhost:__LOCAL_BMA_PORT__$1$is_args$args; } location /ws2p { - proxy_pass http://localhost:20901; + proxy_pass http://localhost:__LOCAL_WS2P_PORT__; } } diff --git a/scripts/_common.sh b/scripts/_common.sh index 425d41b..d63e445 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -11,8 +11,8 @@ pkg_dependencies="deb1 deb2 php$YNH_DEFAULT_PHP_VERSION-deb1 php$YNH_DEFAULT_PHP # PERSONAL HELPERS #================================================= CONFIGURE_DUNITER() { - ynh_exec_as duniter duniter --home $datadir config --bma --ipv4 127.0.0.1 --port $port --remoteh $domain --remotep 443 --noupnp - ynh_exec_as duniter duniter --home $datadir config --ws2p-host 127.0.0.1 --ws2p-port 20901 --ws2p-remote-host $domain --ws2p-remote-port 443 --ws2p-remote-path "/ws2p" --ws2p-noupnp + ynh_exec_as duniter duniter --home $datadir config --bma --ipv4 127.0.0.1 --port $bma_local_port --remoteh $domain --remotep 443 --noupnp + ynh_exec_as duniter duniter --home $datadir config --ws2p-host 127.0.0.1 --ws2p-port $ws2p_local_port --ws2p-remote-host $domain --ws2p-remote-port 443 --ws2p-remote-path "/ws2p" --ws2p-noupnp # Add BMAS with path, remove auto-generated BMAS endpoint ynh_exec_as duniter duniter --home $datadir config --addep "BMAS $domain 443 /bma" --remep "BMAS $domain 443" diff --git a/scripts/install b/scripts/install index cf121f9..3762c77 100644 --- a/scripts/install +++ b/scripts/install @@ -48,13 +48,19 @@ ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=admin --value=$admin #================================================= -# FIND AND OPEN A PORT +# FIND AVAILABLE PORTS #================================================= -ynh_script_progression --message="Finding an available port…" +ynh_script_progression --message="Finding available ports…" -# Find an available port -port=$(ynh_find_port --port=10901) -ynh_app_setting_set --app=$app --key=port --value=$port +# Find available ports +local_bma_port=$(ynh_find_port --port=10901) +ynh_app_setting_set --app=$app --key=local_bma_port --value=$local_bma_port + +local_ws2p_port=$(ynh_find_port --port=20901) +ynh_app_setting_set --app=$app --key=local_ws2p_port --value=$local_ws2p_port + +web_admin_port=$(ynh_find_port --port=9220) +ynh_app_setting_set --app=$app --key=web_admin_port --value=$web_admin_port #================================================= # CREATE DEDICATED USER diff --git a/scripts/remove b/scripts/remove index a4cca63..b7aa37f 100644 --- a/scripts/remove +++ b/scripts/remove @@ -17,7 +17,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) datadir=$(ynh_app_setting_get --app=$app --key=datadir) #================================================= diff --git a/scripts/restore b/scripts/restore index 4031cb3..854b12c 100644 --- a/scripts/restore +++ b/scripts/restore @@ -30,7 +30,8 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) datadir=$(ynh_app_setting_get --app=$app --key=datadir) -port=$(ynh_app_setting_get --app=$app --key=port) +local_bma_port=$(ynh_app_setting_get --app=$app --key=local_bma_port) +local_ws2p_port=$(ynh_app_setting_get --app=$app --key=local_ws2p_port) architecture=$YNH_ARCH #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 398b528..6c77c3a 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -20,7 +20,9 @@ domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) admin=$(ynh_app_setting_get --app=$app --key=admin) datadir=$(ynh_app_setting_get --app=$app --key=datadir) -port=$(ynh_app_setting_get --app=$app --key=port) +local_bma_port=$(ynh_app_setting_get --app=$app --key=local_bma_port) +local_ws2p_port=$(ynh_app_setting_get --app=$app --key=local_ws2p_port) +webadmin_port=$(ynh_app_setting_get --app=$app --key=webadmin_port) architecture=$YNH_ARCH #=================================================