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:
parent
14ff19b095
commit
72fcc4244f
5 changed files with 27 additions and 19 deletions
|
@ -4,7 +4,7 @@ location / {
|
||||||
proxy_set_header Host $http_host;
|
proxy_set_header Host $http_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__;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
|
@ -103,8 +109,8 @@ chown -R $app:www-data "$datadir"
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Adding a configuration file…"
|
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 --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 20901 --ws2p-remote-host $domain --ws2p-remote-port 443 --ws2p-remote-path "/ws2p" --ws2p-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
|
# SETUP SYSTEMD
|
||||||
|
|
|
@ -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)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -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_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 --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 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 $local_ws2p_port --ws2p-remote-host $domain --ws2p-remote-port 443 --ws2p-remote-path "/ws2p" --ws2p-noupnp
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE SYSTEMD
|
# RESTORE SYSTEMD
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -113,8 +115,8 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Updating a configuration file…"
|
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 --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 20901 --ws2p-remote-host $domain --ws2p-remote-port 443 --ws2p-remote-path "/ws2p" --ws2p-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
|
# SETUP SYSTEMD
|
||||||
|
|
Loading…
Add table
Reference in a new issue