1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/duniter_ynh.git synced 2024-09-03 18:26:35 +02:00

[mod] #100: Define clearly ports variable names

Check ports are available locally
This commit is contained in:
Moul 2022-05-02 21:04:38 +02:00 committed by Félix Piédallu
parent 1d30a54025
commit d0ec6502f2
6 changed files with 23 additions and 15 deletions

View file

@ -4,7 +4,7 @@ location / {
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-NginX-Proxy true; proxy_set_header X-NginX-Proxy true;
proxy_pass http://localhost:9220; proxy_pass http://localhost:__WEB_ADMIN_PORT__;
proxy_redirect off; proxy_redirect off;
# Socket.io support # Socket.io support
@ -18,18 +18,18 @@ location / {
access_by_lua_file /usr/share/ssowat/access.lua; access_by_lua_file /usr/share/ssowat/access.lua;
location ~ \.(js|css|woff|woff2|ttf|png) { location ~ \.(js|css|woff|woff2|ttf|png) {
proxy_pass http://localhost:9220; proxy_pass http://localhost:__WEB_ADMIN_PORT__;
} }
location ~ /webmin { location ~ /webmin {
proxy_pass http://localhost:9220$uri; proxy_pass http://localhost:__WEB_ADMIN_PORT__$uri;
} }
location ~ ^/bma(.*)$ { location ~ ^/bma(.*)$ {
proxy_pass http://localhost:__PORT__$1$is_args$args; proxy_pass http://localhost:__LOCAL_BMA_PORT__$1$is_args$args;
} }
location /ws2p { location /ws2p {
proxy_pass http://localhost:20901; proxy_pass http://localhost:__LOCAL_WS2P_PORT__;
} }
} }

View file

@ -11,8 +11,8 @@ pkg_dependencies="deb1 deb2 php$YNH_DEFAULT_PHP_VERSION-deb1 php$YNH_DEFAULT_PHP
# PERSONAL HELPERS # PERSONAL HELPERS
#================================================= #=================================================
CONFIGURE_DUNITER() { 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 --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 20901 --ws2p-remote-host $domain --ws2p-remote-port 443 --ws2p-remote-path "/ws2p" --ws2p-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 # 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" ynh_exec_as duniter duniter --home $datadir config --addep "BMAS $domain 443 /bma" --remep "BMAS $domain 443"

View file

@ -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 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 # Find available ports
port=$(ynh_find_port --port=10901) local_bma_port=$(ynh_find_port --port=10901)
ynh_app_setting_set --app=$app --key=port --value=$port 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 # CREATE DEDICATED USER

View file

@ -17,7 +17,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) 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) datadir=$(ynh_app_setting_get --app=$app --key=datadir)
#================================================= #=================================================

View file

@ -30,7 +30,8 @@ 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)
datadir=$(ynh_app_setting_get --app=$app --key=datadir) 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 architecture=$YNH_ARCH
#================================================= #=================================================

View file

@ -20,7 +20,9 @@ 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=$(ynh_app_setting_get --app=$app --key=admin) admin=$(ynh_app_setting_get --app=$app --key=admin)
datadir=$(ynh_app_setting_get --app=$app --key=datadir) 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 architecture=$YNH_ARCH
#================================================= #=================================================