diff --git a/conf/nginx.conf b/conf/nginx.conf index e8aea12..b5c6a65 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -4,7 +4,7 @@ location / { proxy_set_header Host $http_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/install b/scripts/install index 893cac7..57ea87e 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 @@ -103,8 +109,8 @@ chown -R $app:www-data "$datadir" #================================================= ynh_script_progression --message="Adding a configuration file…" -ynh_exec_as duniter duniter config --bma --ipv4 127.0.0.1 --port $port --remoteh $domain --remotep 443 --noupnp -ynh_exec_as duniter duniter 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 config --bma --ipv4 127.0.0.1 --port $bma_local_port --remoteh $domain --remotep 443 --noupnp +ynh_exec_as duniter duniter 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 #================================================= # SETUP SYSTEMD 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 dc13cb5..a1370fa 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 #================================================= @@ -80,8 +81,8 @@ ynh_exec_warn_less dpkg -i $tempdir/duniter-server-v1.8.*-linux-*.deb #================================================= ynh_script_progression --message="Adding a configuration file…" -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 $local_bma_port --remoteh $domain --remotep 443 --noupnp +ynh_exec_as duniter duniter --home $datadir config --ws2p-host 127.0.0.1 --ws2p-port $local_ws2p_port --ws2p-remote-host $domain --ws2p-remote-port 443 --ws2p-remote-path "/ws2p" --ws2p-noupnp #================================================= # RESTORE SYSTEMD diff --git a/scripts/upgrade b/scripts/upgrade index 400d441..796fdd7 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 #================================================= @@ -113,8 +115,8 @@ fi #================================================= ynh_script_progression --message="Updating a configuration file…" -ynh_exec_as duniter duniter config --bma --ipv4 127.0.0.1 --port $port --remoteh $domain --remotep 443 --noupnp -ynh_exec_as duniter duniter 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 config --bma --ipv4 127.0.0.1 --port $local_bmaport --remoteh $domain --remotep 443 --noupnp +ynh_exec_as duniter duniter config --ws2p-host 127.0.0.1 --ws2p-port $local_ws2p_port --ws2p-remote-host $domain --ws2p-remote-port 443 --ws2p-remote-path "/ws2p" --ws2p-noupnp #================================================= # SETUP SYSTEMD