mirror of
https://github.com/YunoHost-Apps/zeronet_ynh.git
synced 2024-09-03 17:46:12 +02:00
Introduces fs_port enabling multi instance
each newly installed instance listens on it's own unique fileserver port
This commit is contained in:
parent
59c6a457a8
commit
19d84e743c
2 changed files with 7 additions and 3 deletions
|
@ -4,7 +4,7 @@ After=network.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
User=__USER__
|
User=__USER__
|
||||||
ExecStart=/usr/bin/python2 ./zeronet.py --ui_port __UI_PORT__ --ui_host __UI_HOST__ --data_dir __DATA_DIR__ --log_dir __LOG_DIR__
|
ExecStart=/usr/bin/python2 ./zeronet.py --ui_port __UI_PORT__ --ui_host __UI_HOST__ --fileserver_port __FS_PORT__ --data_dir __DATA_DIR__ --log_dir __LOG_DIR__
|
||||||
WorkingDirectory=__WORKING_DIRECTORY__
|
WorkingDirectory=__WORKING_DIRECTORY__
|
||||||
ExecReload=/bin/kill -HUP $MAINPID
|
ExecReload=/bin/kill -HUP $MAINPID
|
||||||
KillMode=process
|
KillMode=process
|
||||||
|
|
|
@ -49,6 +49,7 @@ update_systemd_configuration() {
|
||||||
local symlink_to_deploy_path=$7
|
local symlink_to_deploy_path=$7
|
||||||
local zeronet_dir=$8
|
local zeronet_dir=$8
|
||||||
local ui_host=$9
|
local ui_host=$9
|
||||||
|
local fs_port=${10} # only works with bash
|
||||||
|
|
||||||
# create zeronet user data location
|
# create zeronet user data location
|
||||||
local data_dir=$zeronet_dir/data
|
local data_dir=$zeronet_dir/data
|
||||||
|
@ -63,6 +64,7 @@ update_systemd_configuration() {
|
||||||
|
|
||||||
sudo sed --in-place "s@__USER__@$user@g" $service_file
|
sudo sed --in-place "s@__USER__@$user@g" $service_file
|
||||||
sudo sed --in-place "s@__UI_PORT__@$ui_port@g" $service_file
|
sudo sed --in-place "s@__UI_PORT__@$ui_port@g" $service_file
|
||||||
|
sudo sed --in-place "s@__FS_PORT__@$fs_port@g" $service_file
|
||||||
sudo sed --in-place "s@__UI_HOST__@$ui_host@g" $service_file
|
sudo sed --in-place "s@__UI_HOST__@$ui_host@g" $service_file
|
||||||
sudo sed --in-place "s@__APP_NAME__@$app@g" $service_file
|
sudo sed --in-place "s@__APP_NAME__@$app@g" $service_file
|
||||||
sudo sed --in-place "s@__WORKING_DIRECTORY__@$symlink_to_deploy_path@g" $service_file
|
sudo sed --in-place "s@__WORKING_DIRECTORY__@$symlink_to_deploy_path@g" $service_file
|
||||||
|
@ -100,7 +102,8 @@ main() {
|
||||||
local domain=$YNH_APP_ARG_DOMAIN
|
local domain=$YNH_APP_ARG_DOMAIN
|
||||||
local user=$YNH_APP_ARG_ADMIN
|
local user=$YNH_APP_ARG_ADMIN
|
||||||
|
|
||||||
local ui_port=$( ynh_find_port 43110 ) # the port zeronet listens on
|
local ui_port=$( ynh_find_port 43110 ) # the port zeronet ui listens on
|
||||||
|
local fs_port=$( ynh_find_port 15441 ) # the port zeronet fileserver listens on
|
||||||
|
|
||||||
local path="/"
|
local path="/"
|
||||||
local is_public=0 # by defaut access to zeronet is private
|
local is_public=0 # by defaut access to zeronet is private
|
||||||
|
@ -132,6 +135,7 @@ main() {
|
||||||
ynh_app_setting_set $app deploy_path $deploy_path
|
ynh_app_setting_set $app deploy_path $deploy_path
|
||||||
ynh_app_setting_set $app symlink_to_deploy_path $symlink_to_deploy_path
|
ynh_app_setting_set $app symlink_to_deploy_path $symlink_to_deploy_path
|
||||||
ynh_app_setting_set $app ui_port $ui_port
|
ynh_app_setting_set $app ui_port $ui_port
|
||||||
|
ynh_app_setting_set $app fs_port $fs_port
|
||||||
ynh_app_setting_set $app installed_version $source_version
|
ynh_app_setting_set $app installed_version $source_version
|
||||||
ynh_app_setting_set $app nginx_config_file $nginx_config_file
|
ynh_app_setting_set $app nginx_config_file $nginx_config_file
|
||||||
ynh_app_setting_set $app user $user
|
ynh_app_setting_set $app user $user
|
||||||
|
@ -145,7 +149,7 @@ main() {
|
||||||
|
|
||||||
update_nginx_configuration $app $nginx_config_template $nginx_config_file $path $ui_port
|
update_nginx_configuration $app $nginx_config_template $nginx_config_file $path $ui_port
|
||||||
update_systemd_configuration $app $systemd_service_template $systemd_service_name $systemd_service_file \
|
update_systemd_configuration $app $systemd_service_template $systemd_service_name $systemd_service_file \
|
||||||
$user $ui_port $symlink_to_deploy_path $user_zeronet_dir $domain
|
$user $ui_port $symlink_to_deploy_path $user_zeronet_dir $domain $fs_port
|
||||||
}
|
}
|
||||||
|
|
||||||
main
|
main
|
||||||
|
|
Loading…
Reference in a new issue