1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/friendica_ynh.git synced 2024-09-03 18:36:14 +02:00
This commit is contained in:
Éric Gaspar 2024-08-23 17:53:02 +02:00
parent b92486b153
commit aea3bad55a
5 changed files with 22 additions and 10 deletions

View file

@ -4,12 +4,10 @@ After=network.target mariadb.service
Requires=network.target remote-fs.target nss-lookup.target Requires=network.target remote-fs.target nss-lookup.target
[Service] [Service]
Type=simple
User=__APP__ User=__APP__
Group=__APP__ Group=__APP__
WorkingDirectory=__INSTALL_DIR__/ WorkingDirectory=__INSTALL_DIR__/
Type=simple
StandardOutput=append:/var/log/__APP__/daemon.log
StandardError=inherit
ExecStart=/usr/bin/php__PHPVERSION__ __INSTALL_DIR__/bin/daemon.php start ExecStart=/usr/bin/php__PHPVERSION__ __INSTALL_DIR__/bin/daemon.php start
ExecStop=/usr/bin/php__PHPVERSION__ __INSTALL_DIR__/bin/daemon.php stop ExecStop=/usr/bin/php__PHPVERSION__ __INSTALL_DIR__/bin/daemon.php stop
PIDFile=__INSTALL_DIR__/daemon.pid PIDFile=__INSTALL_DIR__/daemon.pid

View file

@ -9,6 +9,13 @@
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping $app's systemd service..." --weight=1
ynh_systemd_action --service_name="$app" --action="stop" --log_path="systemd"
#================================================= #=================================================
# MODIFY URL IN NGINX CONF # MODIFY URL IN NGINX CONF
#================================================= #=================================================
@ -25,6 +32,13 @@ ynh_print_info --message="Updating the Friendica config..."
ynh_replace_string --match_string="'url' => 'https://.*'," --replace_string="'url' => 'https://$domain'," --target_file="$install_dir/config/local.config.php" ynh_replace_string --match_string="'url' => 'https://.*'," --replace_string="'url' => 'https://$domain'," --target_file="$install_dir/config/local.config.php"
ynh_store_file_checksum --file="$install_dir/config/local.config.php" ynh_store_file_checksum --file="$install_dir/config/local.config.php"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting $app's systemd service..." --weight=1
ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================

View file

@ -53,7 +53,7 @@ ynh_add_systemd_config --service="$app-daemon"
# Create a dedicated nginx config # Create a dedicated nginx config
ynh_add_nginx_config ynh_add_nginx_config
yunohost service add "$app-daemon" --description="Friendica daemon" --log="/var/log/$app/daemon.log" yunohost service add "$app-daemon" --description="Decentralized Social Network" --log="/var/log/$app/daemon.log"
# Use logrotate to manage application logfile(s) # Use logrotate to manage application logfile(s)
ynh_use_logrotate ynh_use_logrotate
@ -90,7 +90,7 @@ popd
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name="$app-daemon" --action="start" --log_path="/var/log/$app/daemon.log" ynh_systemd_action --service_name="$app-daemon" --action="start" --log_path="systemd"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT

View file

@ -44,7 +44,7 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_restore_file --origin_path="/etc/systemd/system/$app-daemon.service" ynh_restore_file --origin_path="/etc/systemd/system/$app-daemon.service"
systemctl enable "$app-daemon.service" --quiet systemctl enable "$app-daemon.service" --quiet
yunohost service add "$app-daemon" --description="Friendica daemon" --log="/var/log/$app/daemon.log" yunohost service add "$app-daemon" --description="Decentralized Social Network" --log="/var/log/$app/daemon.log"
ynh_restore_file --origin_path="/var/log/$app" ynh_restore_file --origin_path="/var/log/$app"
@ -65,7 +65,7 @@ ynh_systemd_action --service_name="php$phpversion-fpm" --action=reload
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload
ynh_systemd_action --service_name="$app-daemon" --action="start" --log_path="/var/log/$app/daemon.log" ynh_systemd_action --service_name="$app-daemon" --action="start" --log_path="systemd"
#============== #==============
# FINALIZATION # FINALIZATION

View file

@ -14,7 +14,7 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=1 ynh_script_progression --message="Stopping a systemd service..." --weight=1
ynh_systemd_action --service_name="$app-daemon" --action="stop" --log_path="/var/log/$app/daemon.log" ynh_systemd_action --service_name="$app-daemon" --action="stop" --log_path="systemd"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
@ -54,7 +54,7 @@ fi
ynh_add_systemd_config --service="$app-daemon" ynh_add_systemd_config --service="$app-daemon"
yunohost service add "$app-daemon" --description="Friendica daemon" --log="/var/log/$app/daemon.log" yunohost service add "$app-daemon" --description="Decentralized Social Network" --log="/var/log/$app/daemon.log"
# Create a dedicated Fail2Ban config # Create a dedicated Fail2Ban config
ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="^.*authenticate\: failed login attempt.*\"ip\"\:\"<HOST>\".*$" ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="^.*authenticate\: failed login attempt.*\"ip\"\:\"<HOST>\".*$"
@ -100,7 +100,7 @@ popd
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name="$app-daemon" --action="start" --log_path="/var/log/$app/daemon.log" ynh_systemd_action --service_name="$app-daemon" --action="start" --log_path="systemd"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT