Added tuning

This commit is contained in:
anmol26s 2018-10-10 23:30:11 +05:30
parent 9de70fe32a
commit 92397046f8
5 changed files with 54 additions and 3 deletions

View File

@ -0,0 +1,8 @@
# In a video server, we are often sending files to a client
# which can't accept it as fast as our local network connection
# could produce packets. To prevent packet loss and buffer bloat,
# it's especially important to use a modern CoDel scheduler which
# knows how to delay outgoing packets to match slower client links.
net.core.default_qdisc = fq_codel
net.ipv4.tcp_congestion_control = bbr

View File

@ -26,6 +26,7 @@ path_url="/"
admin_email=$YNH_APP_ARG_EMAIL
admin_pass=$(ynh_string_random 24)
is_public=$YNH_APP_ARG_IS_PUBLIC
tuning="1"
# This is a multi-instance app, meaning it can be installed several times independently
@ -60,7 +61,7 @@ ynh_app_setting_set "$app" domain "$domain"
ynh_app_setting_set "$app" admin_email "$admin_email"
ynh_app_setting_set "$app" admin_pass "$admin_pass"
ynh_app_setting_set "$app" is_public "$is_public"
ynh_app_setting_set "$app" tuning "$tuning"
#=================================================
# STANDARD MODIFICATIONS
#=================================================
@ -190,6 +191,20 @@ ynh_store_file_checksum "$final_path/config/production.yaml"
# Use logrotate to manage application logfile(s)
ynh_use_logrotate "/home/yunohost.app/${app}/storage/logs/peertube.log"
#=================================================
# ADVERTISE SERVICE IN ADMIN PANEL
#=================================================
### `yunohost service add` is a CLI yunohost command to add a service in the admin panel.
### You'll find the service in the 'services' section of YunoHost admin panel.
### This CLI command would be useless if the app does not have any services (systemd or sysvinit)
### If you're not using these lines:
### - You can remove these files in conf/.
### - Remove the section "REMOVE SERVICE FROM ADMIN PANEL" in the remove script
### - As well as the section ADVERTISE SERVICE IN ADMIN PANEL" in the restore script
yunohost service add NAME_INIT.D --log "/home/yunohost.app/${app}/storage/logs/peertube.log"
#=================================================
# SETUP SSOWAT
#=================================================
@ -214,8 +229,6 @@ chown -R "$app":"$app" "$final_path" "$datadir"
systemctl reload nginx
#=================================================
# SETUP SYSTEMD
#=================================================
@ -237,6 +250,17 @@ systemctl start "$app"
echo $admin_pass | NODE_CONFIG_DIR="$final_path/config" NODE_ENV=production npm run reset-password -- -u root
)
#=================================================
# TUNING CONFIGURATION
#=================================================
if [ $tuning -eq 1 ]
then
# Copy 30-peertube-tcp to /etc/sysctl.d/
cp -f ../30-peertube-tcp.conf /etc/sysctl.d/
sysctl -p /etc/sysctl.d/30-peertube-tcp.conf
fi
#=================================================
# SEND A README FOR THE ADMIN
#=================================================

View File

@ -101,6 +101,14 @@ fi
# Delete a system user
ynh_system_user_delete "$app"
# Remove 30-peertube-tcp.conf
if [ -f /etc/sysctl.d/30-peertube-tcp.conf ]; then
# Remove 30-peertube-tcp from /etc/sysctl.d/
rm -f /etc/sysctl.d/30-peertube-tcp.conf
sysctl -p
fi
#=================================================
# SEND A README FOR THE ADMIN
#=================================================

View File

@ -136,6 +136,11 @@ ynh_restore_file "/etc/logrotate.d/$app"
# Set right permissions
chown -R "$app":"$app" "$final_path"
# TUNING CONFIGURATION
# Copy 30-peertube-tcp to /etc/sysctl.d/
cp -f ../30-peertube-tcp.conf /etc/sysctl.d/
sysctl -p /etc/sysctl.d/30-peertube-tcp.conf
#=================================================
# GENERIC FINALIZATION
#=================================================

View File

@ -196,6 +196,12 @@ then
ynh_app_setting_set "$app" unprotected_uris "/"
fi
# TUNING CONFIGURATION
# Copy 30-peertube-tcp to /etc/sysctl.d/
cp -f ../30-peertube-tcp.conf /etc/sysctl.d/
sysctl -p /etc/sysctl.d/30-peertube-tcp.conf
#=================================================
# RELOAD NGINX
#=================================================