mirror of
https://github.com/YunoHost-Apps/rustdesk-server_ynh.git
synced 2024-09-03 20:16:24 +02:00
commit
f46ab28146
12 changed files with 109 additions and 58 deletions
|
@ -1,7 +1,7 @@
|
|||
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
|
||||
location __PATH__/ {
|
||||
|
||||
proxy_pass http://127.0.0.1:__PORT_HBBS__/;
|
||||
proxy_pass http://127.0.0.1:__PORT_HBBSBIS__;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
[Unit]
|
||||
Description=Rustdesk Signal Server
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=__APP__
|
||||
Group=__APP__
|
||||
Restart=always
|
||||
LimitNOFILE=1000000
|
||||
WorkingDirectory=__INSTALL_DIR__/
|
||||
ExecStart=__INSTALL_DIR__/hbbs -r 127.0.0.1 -p __PORT_HBBS__
|
||||
#StandardOutput=append:__INSTALL_DIR__/hbbs.log
|
||||
#StandardError=append:__INSTALL_DIR__/hbbs.error
|
||||
# Restart service after 10 seconds if node service crashes
|
||||
RestartSec=10
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -5,13 +5,12 @@ Description=Rustdesk Relay Server
|
|||
Type=simple
|
||||
User=__APP__
|
||||
Group=__APP__
|
||||
LimitNOFILE=1000000
|
||||
ExecStart=__INSTALL_DIR__/hbbr -p __PORT_HBBR__
|
||||
WorkingDirectory=__INSTALL_DIR__/
|
||||
Restart=always
|
||||
#StandardOutput=append:rustdesk-server/hbbr.log
|
||||
#StandardError=append:rustdesk-server/hbbr.error
|
||||
# Restart service after 10 seconds if node service crashes
|
||||
LimitNOFILE=1000000
|
||||
WorkingDirectory=__INSTALL_DIR__/
|
||||
ExecStart=__INSTALL_DIR__/hbbr -p __PORT_HBBR__
|
||||
StandardOutput=append:/var/log/__APP__/hbbr.log
|
||||
StandardError=append:/var/log/__APP__/hbbr.error
|
||||
RestartSec=10
|
||||
|
||||
[Install]
|
17
conf/rustdesksignal.service
Normal file
17
conf/rustdesksignal.service
Normal file
|
@ -0,0 +1,17 @@
|
|||
[Unit]
|
||||
Description=Rustdesk Signal Server
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=__APP__
|
||||
Group=__APP__
|
||||
Restart=always
|
||||
LimitNOFILE=1000000
|
||||
WorkingDirectory=__INSTALL_DIR__/
|
||||
ExecStart=__INSTALL_DIR__/hbbs -r __DOMAIN__ -p __PORT_HBBSBIS__
|
||||
StandardOutput=append:/var/log/__APP__/hbbs.log
|
||||
StandardError=append:/var/log/__APP__/hbbs.error
|
||||
RestartSec=10
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -59,9 +59,13 @@ ram.runtime = "50M"
|
|||
main.url = "/"
|
||||
|
||||
[resources.ports]
|
||||
main.default = 21115
|
||||
main.exposed = "TCP"
|
||||
hbbs.default = 21116
|
||||
hbbs.exposed = "Both"
|
||||
hbbs.default = 21115
|
||||
hbbs.exposed = "TCP"
|
||||
hbbsbis.default = 21116
|
||||
hbbsbis.exposed = "Both"
|
||||
hbbster.default = 21118
|
||||
hbbster.exposed = "TCP"
|
||||
hbbr.default = 21117
|
||||
hbbr.exposed = "TCP"
|
||||
hbbrbis.default = 21119
|
||||
hbbrbis.exposed = "TCP"
|
||||
|
|
|
@ -27,12 +27,18 @@ ynh_backup --src_path="$install_dir"
|
|||
|
||||
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# BACKUP LOGROTATE
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="/etc/logrotate.d/$app"
|
||||
|
||||
#=================================================
|
||||
# BACKUP SYSTEMD
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="/etc/systemd/system/rustdesk-server.service"
|
||||
ynh_backup --src_path="/etc/systemd/system/rustdesk-hbbs.service"
|
||||
ynh_backup --src_path="/etc/systemd/system/rustdeskrelay.service"
|
||||
ynh_backup --src_path="/etc/systemd/system/rustdesksignal.service"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
|
@ -16,8 +16,8 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=rustdesk-server --action="stop" --log_path="systemd"
|
||||
ynh_systemd_action --service_name=rustdesk-hbbs --action="stop" --log_path="systemd"
|
||||
ynh_systemd_action --service_name=rustdeskrelay --action="stop" --log_path="systemd"
|
||||
ynh_systemd_action --service_name=rustdesksignal --action="stop" --log_path="systemd"
|
||||
|
||||
#=================================================
|
||||
# MODIFY URL IN NGINX CONF
|
||||
|
@ -33,8 +33,8 @@ ynh_change_url_nginx_config
|
|||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=rustdesk-server --action="start" --log_path="systemd"
|
||||
ynh_systemd_action --service_name=rustdesk-hbbs --action="start" --log_path="systemd"
|
||||
ynh_systemd_action --service_name=rustdeskrelay --action="start" --log_path="systemd"
|
||||
ynh_systemd_action --service_name=rustdesksignal --action="start" --log_path="systemd"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
|
@ -19,6 +19,7 @@ ynh_script_progression --message="Setting up source files..." --weight=1
|
|||
# Download, check integrity, uncompress and patch the source from manifest.toml
|
||||
ynh_setup_source --dest_dir="$install_dir"
|
||||
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R $app:www-data "$install_dir"
|
||||
chmod +x "$install_dir/hbbr"
|
||||
chmod +x "$install_dir/hbbs"
|
||||
|
@ -32,11 +33,24 @@ ynh_script_progression --message="Adding system configurations related to $app..
|
|||
ynh_add_nginx_config
|
||||
|
||||
# Create a dedicated systemd config
|
||||
ynh_add_systemd_config --service=rustdesk-server --template=rustdesk-server.service
|
||||
ynh_add_systemd_config --service=rustdesk-hbbs --template=rustdesk-hbbs.service
|
||||
ynh_add_systemd_config --service=rustdeskrelay --template=rustdeskrelay.service
|
||||
ynh_add_systemd_config --service=rustdesksignal --template=rustdesksignal.service
|
||||
|
||||
yunohost service add rustdesk-server --description="Remote control alternative for self-hosting" --log="/var/log/$app/$app.log"
|
||||
yunohost service add rustdesk-hbbs --description="Remote control alternative for self-hosting" --log="/var/log/$app/$app.log"
|
||||
yunohost service add rustdeskrelay --description="Rustdesk Relay Server" --log="/var/log/$app/$app.log"
|
||||
yunohost service add rustdesksignal --description="Rustdesk Signal Server" --log="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# HANDLE LOG FILES AND LOGROTATE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring log rotation..." --weight=1
|
||||
|
||||
# Create log directory
|
||||
mkdir -p /var/log/$app
|
||||
touch /var/log/$app/$app.log
|
||||
chown $app -R /var/log/$app
|
||||
|
||||
# Use logrotate to manage application logfile(s)
|
||||
ynh_use_logrotate
|
||||
|
||||
#=================================================
|
||||
# APP INITIAL CONFIGURATION
|
||||
|
@ -58,8 +72,8 @@ yunohost service add rustdesk-hbbs --description="Remote control alternative for
|
|||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||
|
||||
# Start a systemd service
|
||||
ynh_systemd_action --service_name=rustdesk-server --action="start" --log_path="systemd"
|
||||
ynh_systemd_action --service_name=rustdesk-hbbs --action="start" --log_path="systemd"
|
||||
ynh_systemd_action --service_name=rustdeskrelay --action="start" --log_path="systemd"
|
||||
ynh_systemd_action --service_name=rustdesksignal --action="start" --log_path="systemd"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
|
@ -17,22 +17,28 @@ source /usr/share/yunohost/helpers
|
|||
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
|
||||
|
||||
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
||||
if ynh_exec_warn_less yunohost service status $rustdesk-server >/dev/null
|
||||
if ynh_exec_warn_less yunohost service status rustdeskrelay >/dev/null
|
||||
then
|
||||
ynh_script_progression --message="Removing $rustdesk-server service integration..." --weight=1
|
||||
yunohost service remove $rustdesk-server
|
||||
ynh_script_progression --message="Removing rustdeskrelay service integration..." --weight=1
|
||||
yunohost service remove rustdeskrelay
|
||||
fi
|
||||
if ynh_exec_warn_less yunohost service status $rustdesk-hbbs >/dev/null
|
||||
if ynh_exec_warn_less yunohost service status rustdesksignal >/dev/null
|
||||
then
|
||||
ynh_script_progression --message="Removing $rustdesk-hbbs service integration..." --weight=1
|
||||
yunohost service remove $rustdesk-hbbs
|
||||
ynh_script_progression --message="Removing rustdesksignal service integration..." --weight=1
|
||||
yunohost service remove rustdesksignal
|
||||
fi
|
||||
|
||||
ynh_remove_systemd_config --service=rustdesk-server
|
||||
ynh_remove_systemd_config --service=rustdesk-hbbs
|
||||
ynh_remove_systemd_config --service=rustdeskrelay
|
||||
ynh_remove_systemd_config --service=rustdesksignal
|
||||
|
||||
ynh_remove_nginx_config
|
||||
|
||||
# Remove the app-specific logrotate config
|
||||
ynh_remove_logrotate
|
||||
|
||||
# Remove the log files
|
||||
ynh_secure_remove --file="/var/log/$app"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
|
@ -17,7 +17,10 @@ ynh_script_progression --message="Restoring the app main directory..." --weight=
|
|||
|
||||
ynh_restore_file --origin_path="$install_dir"
|
||||
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R $app:www-data "$install_dir"
|
||||
chmod +x "$install_dir/hbbr"
|
||||
chmod +x "$install_dir/hbbs"
|
||||
|
||||
#=================================================
|
||||
# RESTORE SYSTEM CONFIGURATIONS
|
||||
|
@ -28,10 +31,23 @@ ynh_script_progression --message="Restoring system configurations related to $ap
|
|||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
||||
systemctl enable $app.service --quiet
|
||||
# Create log directory
|
||||
mkdir -p /var/log/$app
|
||||
touch /var/log/$app/$app.log
|
||||
chown $app -R /var/log/$app
|
||||
|
||||
yunohost service add $app --description="Remote control alternative for self-hosting" --log="/var/log/$app/$app.log"
|
||||
ynh_restore_file --origin_path="/etc/systemd/system/$rustdeskrelay.service"
|
||||
systemctl enable $rustdeskrelay.service --quiet
|
||||
|
||||
ynh_restore_file --origin_path="/etc/systemd/system/$ --description="Rustdesk Signal Server" --log="/var/log/$app/$app.log"
|
||||
.service"
|
||||
systemctl enable $ --description="Rustdesk Signal Server" --log="/var/log/$app/$app.log"
|
||||
.service --quiet
|
||||
|
||||
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||
|
||||
yunohost service add rustdeskrelay --description="Rustdesk Relay Server" --log="/var/log/$app/$app.log"
|
||||
yunohost service add rustdesksignal --description="Rustdesk Signal Server" --log="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
|
@ -40,8 +56,9 @@ yunohost service add $app --description="Remote control alternative for self-hos
|
|||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
|
||||
|
||||
# Typically you only have either $app or php-fpm but not both at the same time...
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
|
||||
# Typically you only have either $app but not both at the same time...
|
||||
ynh_systemd_action --service_name=rustdeskrelay --action="start" --log_path="systemd"
|
||||
ynh_systemd_action --service_name=rustdesksignal --action="start" --log_path="systemd"
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
|
|
|
@ -16,7 +16,8 @@ upgrade_type=$(ynh_check_app_version_changed)
|
|||
#=================================================
|
||||
ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
|
||||
ynh_systemd_action --service_name=rustdeskrelay --action="stop" --log_path="systemd"
|
||||
ynh_systemd_action --service_name=rustdesksignal --action="stop" --log_path="systemd"
|
||||
|
||||
#=================================================
|
||||
# "REBUILD" THE APP (DEPLOY NEW SOURCES, RERUN NPM BUILD...)
|
||||
|
@ -32,6 +33,7 @@ then
|
|||
ynh_setup_source --dest_dir="$install_dir"
|
||||
fi
|
||||
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R $app:www-data "$install_dir"
|
||||
chmod +x "$install_dir/hbbr"
|
||||
chmod +x "$install_dir/hbbs"
|
||||
|
@ -43,9 +45,12 @@ ynh_script_progression --message="Upgrading system configurations related to $ap
|
|||
|
||||
ynh_add_nginx_config
|
||||
|
||||
ynh_add_systemd_config
|
||||
# Create a dedicated systemd config
|
||||
ynh_add_systemd_config --service=rustdeskrelay --template=rustdeskrelay.service
|
||||
ynh_add_systemd_config --service=rustdesksignal --template=rustdesksignal.service
|
||||
|
||||
yunohost service add $app --description="Remote control alternative for self-hosting" --log="/var/log/$app/$app.log"
|
||||
yunohost service add rustdeskrelay --description="Rustdesk Relay Server" --log="/var/log/$app/$app.log"
|
||||
yunohost service add rustdesksignal --description="Rustdesk Signal Server" --log="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# RECONFIGURE THE APP (UPDATE CONF, APPLY MIGRATIONS...)
|
||||
|
@ -64,7 +69,8 @@ yunohost service add $app --description="Remote control alternative for self-hos
|
|||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
|
||||
ynh_systemd_action --service_name=rustdeskrelay --action="start" --log_path="systemd"
|
||||
ynh_systemd_action --service_name=rustdesksignal --action="start" --log_path="systemd"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
Loading…
Reference in a new issue