mirror of
https://github.com/YunoHost-Apps/friendica_ynh.git
synced 2024-09-03 18:36:14 +02:00
Merge 28312b0890
into bb7b5beb92
This commit is contained in:
commit
e9447466e7
10 changed files with 50 additions and 49 deletions
|
@ -20,7 +20,7 @@ return [
|
|||
// ****************************************************************
|
||||
|
||||
'config' => [
|
||||
'php_path' => '/usr/bin/php',
|
||||
'php_path' => '/usr/bin/php__PHPVERSION__',
|
||||
'admin_email' => '__EMAIL__',
|
||||
'sitename' => 'Friendica Social Network',
|
||||
'register_policy' => \Friendica\Module\Register::OPEN,
|
||||
|
@ -35,7 +35,7 @@ return [
|
|||
'pidfile' => '__INSTALL_DIR__/daemon.pid',
|
||||
// Blocks search for users who are not logged in to prevent crawlers from blocking your system.
|
||||
'local_search' => false,
|
||||
'logfile' => '/var/log/friendica/friendica.log',
|
||||
'logfile' => '/var/log/__APP__/__APP__.log',
|
||||
'loglevel' => 'notice',
|
||||
],
|
||||
];
|
||||
|
|
|
@ -6,7 +6,7 @@ location __PATH__/ {
|
|||
rewrite ^(.*)$ /index.php?pagename=$1;
|
||||
}
|
||||
|
||||
#allow uploads up to 20MB in size
|
||||
#allow uploads up to 50MB in size
|
||||
client_max_body_size 50M;
|
||||
client_body_buffer_size 128k;
|
||||
|
||||
|
|
|
@ -1,21 +1,16 @@
|
|||
[Unit]
|
||||
Description=Friendica daemon
|
||||
Description=Friendica: decentralized Social Network
|
||||
After=network.target mariadb.service
|
||||
Requires=network.target remote-fs.target nss-lookup.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=__APP__
|
||||
Group=__APP__
|
||||
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
|
||||
ExecStop=/usr/bin/php__PHPVERSION__ __INSTALL_DIR__/bin/daemon.php stop
|
||||
PIDFile=__INSTALL_DIR__/daemon.pid
|
||||
PrivateTmp=true
|
||||
InaccessibleDirectories=/home /root /boot /opt /mnt /media
|
||||
ReadOnlyDirectories=/etc /usr
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
StartLimitBurst=1
|
||||
|
|
|
@ -20,7 +20,7 @@ userdoc = "https://wiki.friendi.ca/"
|
|||
code = "https://github.com/friendica/friendica"
|
||||
|
||||
[integration]
|
||||
yunohost = ">= 11.2"
|
||||
yunohost = ">= 11.2.27"
|
||||
architectures = "all"
|
||||
multi_instance = true
|
||||
ldap = true
|
||||
|
@ -68,7 +68,7 @@ main.allowed = [ "visitors", "all_users" ]
|
|||
main.protected = true
|
||||
|
||||
[resources.apt]
|
||||
packages = "mariadb-server, php8.2-curl, php8.2-mbstring, php8.2-imagick, php8.2-xml, php8.2-zip, php8.2-mysql, php8.2-gd, php8.2-gmp, php8.2-intl"
|
||||
packages = "mariadb-server, php8.3-curl, php8.3-mbstring, php8.3-imagick, php8.3-xml, php8.3-zip, php8.3-mysql, php8.3-gd, php8.3-gmp, php8.3-intl"
|
||||
|
||||
[resources.database]
|
||||
type = "mysql"
|
||||
|
|
|
@ -39,7 +39,8 @@ ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf"
|
|||
ynh_backup --src_path="/etc/logrotate.d/$app"
|
||||
|
||||
ynh_backup --src_path="/var/log/$app"
|
||||
ynh_backup --src_path="/etc/systemd/system/$app-daemon.service"
|
||||
|
||||
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE MYSQL DATABASE
|
||||
|
|
|
@ -9,6 +9,13 @@
|
|||
source _common.sh
|
||||
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
|
||||
#=================================================
|
||||
|
@ -19,12 +26,18 @@ ynh_change_url_nginx_config
|
|||
#=================================================
|
||||
# MODIFY URL IN FRIENDICA CONF
|
||||
#=================================================
|
||||
|
||||
ynh_print_info --message="Updating the Friendica config..."
|
||||
ynh_print_info --message="Updating the $app config..."
|
||||
|
||||
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"
|
||||
|
||||
#=================================================
|
||||
# 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
|
||||
#=================================================
|
||||
|
|
|
@ -16,13 +16,6 @@ source /usr/share/yunohost/helpers
|
|||
email=$(ynh_user_get_info --username="$admin" --key=mail)
|
||||
timezone=$(cat /etc/timezone)
|
||||
|
||||
#=================================================
|
||||
# STORE SETTINGS FROM MANIFEST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Storing installation settings..." --weight=1
|
||||
|
||||
ynh_app_setting_set --app="$app" --key=email --value="$email"
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
|
@ -38,8 +31,16 @@ chmod -R 775 "$install_dir/view/smarty3"
|
|||
chmod -R o-rwx "$install_dir"
|
||||
chown -R "$app:www-data" "$install_dir"
|
||||
|
||||
#=================================================
|
||||
# APP INITIAL CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Adding $app's configuration files..." --weight=1
|
||||
|
||||
ynh_add_config --template="local-sample.config.php" --destination="$install_dir/config/local.config.php"
|
||||
|
||||
chmod 600 "$install_dir/config/local.config.php"
|
||||
chown "$app:$app" "$install_dir/config/local.config.php"
|
||||
|
||||
#=================================================
|
||||
# SYSTEM CONFIGURATION
|
||||
#=================================================
|
||||
|
@ -48,12 +49,12 @@ ynh_script_progression --message="Adding system configurations related to $app..
|
|||
# Create a dedicated PHP-FPM configy
|
||||
ynh_add_fpm_config
|
||||
|
||||
ynh_add_systemd_config --service="$app-daemon"
|
||||
ynh_add_systemd_config
|
||||
|
||||
# Create a dedicated nginx config
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
yunohost service add "$app-daemon" --description="Friendica daemon" --log="/var/log/$app/daemon.log"
|
||||
yunohost service add "$app" --description="Decentralized Social Network" --log="/var/log/$app/$app.log"
|
||||
|
||||
# Use logrotate to manage application logfile(s)
|
||||
ynh_use_logrotate
|
||||
|
@ -72,14 +73,14 @@ ynh_add_config --template="addon.config.php" --destination="$install_dir/config/
|
|||
#=================================================
|
||||
# INSTALL FRIENDICA
|
||||
#=================================================
|
||||
ynh_script_progression --message="Install Friendica..." --weight=1
|
||||
ynh_script_progression --message="Installing $app..." --weight=1
|
||||
|
||||
pushd "$install_dir"
|
||||
# Import Composer dependencies
|
||||
ynh_exec_as "$app" "php$phpversion" bin/composer.phar install --no-dev --quiet
|
||||
|
||||
# Install application
|
||||
ynh_exec_as "$app" "php$phpversion" bin/console.php -f "$install_dir/config/local.config.php"
|
||||
ynh_exec_as "$app" "php$phpversion" bin/console.php autoinstall -f "$install_dir/config/local.config.php"
|
||||
|
||||
# Enable LDAP Auth addon
|
||||
ynh_exec_as "$app" "php$phpversion" bin/console.php addon enable ldapauth
|
||||
|
@ -90,7 +91,7 @@ popd
|
|||
#=================================================
|
||||
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" --action="start" --log_path="systemd"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
|
@ -12,21 +12,15 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
# REMOVE SYSTEM CONFIGURATIONS
|
||||
#=================================================
|
||||
# REMOVE SERVICE INTEGRATION IN YUNOHOST
|
||||
#=================================================
|
||||
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 "$app" >/dev/null
|
||||
then
|
||||
ynh_script_progression --message="Removing $app service integration..." --weight=1
|
||||
yunohost service remove "$app-daemon"
|
||||
yunohost service remove "$app"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# REMOVE SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
|
||||
|
||||
# Remove the dedicated nginx config
|
||||
ynh_remove_nginx_config
|
||||
|
||||
|
@ -38,7 +32,7 @@ ynh_remove_logrotate
|
|||
|
||||
ynh_remove_fail2ban_config
|
||||
|
||||
ynh_remove_systemd_config --service="$app-daemon"
|
||||
ynh_remove_systemd_config
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
|
@ -41,10 +41,10 @@ ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
|||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
ynh_restore_file --origin_path="/etc/systemd/system/$app-daemon.service"
|
||||
systemctl enable "$app-daemon.service" --quiet
|
||||
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
||||
systemctl enable "$app.service" --quiet
|
||||
|
||||
yunohost service add "$app-daemon" --description="Friendica daemon" --log="/var/log/$app/daemon.log"
|
||||
yunohost service add "$app" --description="Decentralized Social Network" --log="/var/log/$app/$app.log"
|
||||
|
||||
ynh_restore_file --origin_path="/var/log/$app"
|
||||
|
||||
|
@ -54,22 +54,19 @@ ynh_restore_file --origin_path="/etc/fail2ban/jail.d/$app.conf"
|
|||
ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf"
|
||||
ynh_systemd_action --action=restart --service_name=fail2ban
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd"
|
||||
ynh_systemd_action --service_name="php$phpversion-fpm" --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"
|
||||
|
||||
#==============
|
||||
#=================================================
|
||||
# FINALIZATION
|
||||
#==============
|
||||
#=================================================
|
||||
|
||||
# exit maintenance mode since the app was backed up while in maintenance mode
|
||||
(cd "$install_dir" && ynh_exec_as "$app" "php$phpversion" bin/console.php maintenance 0)
|
||||
|
|
|
@ -14,7 +14,7 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
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" --action="stop" --log_path="systemd"
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
|
@ -54,7 +54,7 @@ fi
|
|||
|
||||
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" --description="Decentralized Social Network" --log="/var/log/$app/$app.log"
|
||||
|
||||
# Create a dedicated Fail2Ban config
|
||||
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_systemd_action --service_name="$app-daemon" --action="start" --log_path="/var/log/$app/daemon.log"
|
||||
ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
Loading…
Add table
Reference in a new issue