mirror of
https://github.com/YunoHost-Apps/friendica_ynh.git
synced 2024-09-03 18:36:14 +02:00
Merge branch 'src' into fail
This commit is contained in:
commit
80ae1372d0
11 changed files with 116 additions and 104 deletions
|
@ -20,7 +20,7 @@ Friendica is a decentralised communications platform that integrates social comm
|
|||
|
||||
Friendica connects you effortlessly to a federated communications network of several thousand servers, with more than half a million user registrations. You can directly connect to anyone on Friendica, Mastodon, Diaspora, GnuSocial, Pleroma, or Hubzilla, regardless where each user profile is hosted.
|
||||
|
||||
**Shipped version:** 2023.09~ynh1
|
||||
**Shipped version:** 2023.05~ynh1
|
||||
|
||||
**Demo:** https://dir.friendica.social/servers
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ Friendica is a decentralised communications platform that integrates social comm
|
|||
|
||||
Friendica connects you effortlessly to a federated communications network of several thousand servers, with more than half a million user registrations. You can directly connect to anyone on Friendica, Mastodon, Diaspora, GnuSocial, Pleroma, or Hubzilla, regardless where each user profile is hosted.
|
||||
|
||||
**Version incluse :** 2023.09~ynh1
|
||||
**Version incluse :** 2023.05~ynh1
|
||||
|
||||
**Démo :** https://dir.friendica.social/servers
|
||||
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
# Run poller periodically to update Friendica
|
||||
*/10 * * * * __APP__ /usr/bin/php__PHPVERSION__ -f __INSTALL_DIR__/bin/worker.php
|
22
conf/systemd.service
Normal file
22
conf/systemd.service
Normal file
|
@ -0,0 +1,22 @@
|
|||
[Unit]
|
||||
Description=Friendica daemon
|
||||
After=network.target mariadb.service
|
||||
Requires=network.target remote-fs.target nss-lookup.target
|
||||
|
||||
[Service]
|
||||
User=__APP__
|
||||
Group=__APP__
|
||||
WorkingDirectory=__INSTALL_DIR__/
|
||||
Type=simple
|
||||
StandardOutput=null
|
||||
StandardError=syslog
|
||||
ExecStart=/usr/bin/php__PHPVERSION__ __INSTALL_DIR__/bin/daemon.php start
|
||||
ExecStop=/usr/bin/php__PHPVERSION__ __INSTALL_DIR__/bin/daemon.php stop
|
||||
PIDFile=friendica/daemon.pid
|
||||
PrivateTmp=true
|
||||
InaccessibleDirectories=/home /root /boot /opt /mnt /media
|
||||
ReadOnlyDirectories=/etc /usr
|
||||
Restart=always
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -5,7 +5,7 @@ name = "Friendica"
|
|||
description.en = "Social Communication Server"
|
||||
description.fr = "Serveur de Communication Social"
|
||||
|
||||
version = "2023.09~ynh1"
|
||||
version = "2023.05~ynh1"
|
||||
|
||||
maintainers = []
|
||||
|
||||
|
@ -46,6 +46,18 @@ ram.runtime = "50M"
|
|||
default = "en"
|
||||
|
||||
[resources]
|
||||
|
||||
[resources.sources]
|
||||
[resources.sources.main]
|
||||
url = "https://github.com/friendica/friendica/archive/refs/tags/2023.05.tar.gz"
|
||||
sha256 = "727a8fdab6a2f6424d3dbc895496447e750eb0f8e1e11b70f1e229a7e3c9a31d"
|
||||
autoupdate.strategy = "latest_github_tag"
|
||||
|
||||
[resources.sources.addons]
|
||||
url = "https://github.com/friendica/friendica-addons/archive/refs/tags/2023.05.tar.gz"
|
||||
sha256 = "df29aed28c0208e162c76f91949d0c3a0f77fe09853fe1a6d854b9956075d8a0"
|
||||
autoupdate.strategy = "latest_github_tag"
|
||||
|
||||
[resources.system_user]
|
||||
|
||||
[resources.install_dir]
|
||||
|
|
|
@ -4,11 +4,6 @@
|
|||
# COMMON VARIABLES
|
||||
#=================================================
|
||||
|
||||
# commit hashes
|
||||
# 2023.08
|
||||
version_commit="2dbfb070083ec395bf5d24ec89fe96b282c6a12d"
|
||||
addons_version_commit="f2cc0312ca9a95d99a8330452848180792bf9227"
|
||||
|
||||
#=================================================
|
||||
# EXPERIMENTAL HELPERS
|
||||
#=================================================
|
||||
|
|
|
@ -40,12 +40,17 @@ ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
|||
ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf"
|
||||
ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# BACKUP LOGROTATE
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="/etc/logrotate.d/$app"
|
||||
|
||||
#=================================================
|
||||
# BACKUP VARIOUS FILES
|
||||
#=================================================
|
||||
|
||||
# Backup cron job
|
||||
ynh_backup --src_path="/etc/cron.d/$app"
|
||||
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE MYSQL DATABASE
|
||||
|
|
|
@ -28,26 +28,13 @@ ynh_app_setting_set --app=$app --key=email --value=$email
|
|||
#=================================================
|
||||
ynh_script_progression --message="Setting up source files..." --weight=5
|
||||
|
||||
git config --system --add safe.directory $install_dir
|
||||
|
||||
# 1 - Clone stable repo
|
||||
git clone --quiet https://github.com/friendica/friendica.git -b stable "$install_dir"
|
||||
# Reset branch to the level of update we needed
|
||||
pushd "$install_dir"
|
||||
git reset --hard --quiet $version_commit
|
||||
popd
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$install_dir"
|
||||
ynh_setup_source --dest_dir="$install_dir/addon" --source_id="addons"
|
||||
|
||||
# Copy .htaccess-dist to ..htaccess
|
||||
cp -f "$install_dir/.htaccess-dist" "$install_dir/.htaccess"
|
||||
|
||||
# 2 - Clone addons repo
|
||||
git clone --quiet https://github.com/friendica/friendica-addons.git -b stable "$install_dir/addon"
|
||||
# Reset addons branch to the level of update we needed
|
||||
pushd "$install_dir/addon"
|
||||
git reset --hard --quiet $addons_version_commit
|
||||
popd
|
||||
|
||||
chmod 750 "$install_dir"
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R $app:www-data "$install_dir"
|
||||
|
||||
|
@ -59,6 +46,16 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=1
|
|||
# Create a dedicated nginx config
|
||||
ynh_add_nginx_config
|
||||
|
||||
# Create a dedicated PHP-FPM configy
|
||||
ynh_add_fpm_config --usage=low --footprint=low
|
||||
|
||||
ynh_add_systemd_config
|
||||
|
||||
# Use logrotate to manage application logfile(s)
|
||||
ynh_use_logrotate
|
||||
|
||||
yunohost service add $app --description="Friendica daemon" --log="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# ADD A CONFIGURATION
|
||||
#=================================================
|
||||
|
@ -67,14 +64,6 @@ ynh_script_progression --message="Adding the LDAP Auth addon configuration file.
|
|||
# LDAP addon config
|
||||
ynh_add_config --template="../conf/addon.config.php" --destination="$install_dir/config/addon.config.php"
|
||||
|
||||
#=================================================
|
||||
# PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring PHP_FPM..." --weight=4
|
||||
|
||||
# Create a dedicated PHP-FPM configy
|
||||
ynh_add_fpm_config --usage=low --footprint=low
|
||||
|
||||
# 3 - some extra folders
|
||||
mkdir -p "$install_dir/view/smarty3"
|
||||
chmod -R 775 "$install_dir/view/smarty3"
|
||||
|
@ -109,6 +98,13 @@ pushd "$install_dir"
|
|||
ynh_exec_as "$app" php$phpversion bin/console.php addon enable ldapauth
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
|
@ -10,9 +10,20 @@ source _common.sh
|
|||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# REMOVE NGINX CONFIGURATION
|
||||
# REMOVE SYSTEM CONFIGURATIONS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
|
||||
# REMOVE SYSTEMD SERVICE
|
||||
#=================================================
|
||||
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
|
||||
fi
|
||||
|
||||
ynh_remove_systemd_config
|
||||
|
||||
# Remove the dedicated nginx config
|
||||
ynh_remove_nginx_config
|
||||
|
@ -25,9 +36,6 @@ ynh_remove_fpm_config
|
|||
|
||||
ynh_remove_fail2ban_config
|
||||
|
||||
# Remove a cron file
|
||||
ynh_secure_remove --file="/etc/cron.d/$app"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
|
@ -37,9 +37,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 "/etc/cron.d/$app"
|
||||
chown root: "/etc/cron.d/$app"
|
||||
chmod 644 "/etc/cron.d/$app"
|
||||
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
||||
systemctl enable $app.service --quiet
|
||||
|
||||
yunohost service add $app --description="Friendica daemon" --log="/var/log/$app/$app.log"
|
||||
|
||||
ynh_restore_file --origin_path="/etc/fail2ban/jail.d/$app.conf"
|
||||
ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf"
|
||||
|
@ -48,11 +49,13 @@ ynh_systemd_action --action=restart --service_name=fail2ban
|
|||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# RELOAD NGINX AND PHP-FPM
|
||||
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1
|
||||
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
||||
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -22,6 +22,13 @@ timezone=$(cat /etc/timezone)
|
|||
|
||||
upgrade_type=$(ynh_check_app_version_changed)
|
||||
|
||||
#=================================================
|
||||
# STOP SYSTEMD SERVICE
|
||||
#=================================================
|
||||
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"
|
||||
|
||||
#=================================================
|
||||
# CHECK THE PATH
|
||||
#=================================================
|
||||
|
@ -32,18 +39,23 @@ if [ -f $install_dir/.htconfig.php ]; then
|
|||
ynh_secure_remove "$install_dir/.htconfig.php"
|
||||
fi
|
||||
|
||||
# Remove files for upgrade compatibilty from previous versions of Friendica
|
||||
if [ -f $install_dir/.htconfig.php ]; then
|
||||
ynh_secure_remove "$install_dir/config/local.ini.php"
|
||||
ynh_secure_remove "$install_dir/.htconfig.php"
|
||||
fi
|
||||
|
||||
if [ -f "/etc/cron.d/$app" ]; then
|
||||
ynh_secure_remove --file="/etc/cron.d/$app"
|
||||
fi
|
||||
|
||||
# If admin_mail setting doesn't exist, create it
|
||||
if [ -z $email ]; then
|
||||
if [ -z "${email:-}" ]; then
|
||||
email=$(ynh_user_get_info --username=$admin --key=mail)
|
||||
ynh_app_setting_set --app=$app --key=email --value=$email
|
||||
fi
|
||||
|
||||
# If language setting doesn't exist, create it
|
||||
if [ -z $language ]; then
|
||||
if [ -z "${language:-}" ]; then
|
||||
language=en
|
||||
ynh_app_setting_set --app=$app --key=language --value=$language
|
||||
fi
|
||||
|
@ -54,63 +66,17 @@ fi
|
|||
|
||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||
then
|
||||
ynh_script_progression --message="Upgrading source files..." --weight=3
|
||||
# Check if the repo can be updated with git
|
||||
if [ `cd $install_dir && git rev-parse --is-inside-work-tree &> /dev/null` ];
|
||||
then
|
||||
# Update through Git
|
||||
pushd "$install_dir"
|
||||
git fetch
|
||||
git checkout stable
|
||||
git pull
|
||||
git reset --hard $version_commit
|
||||
popd
|
||||
pushd "$install_dir/addon"
|
||||
git fetch
|
||||
git checkout stable
|
||||
git pull
|
||||
git reset --hard $addons_version_commit
|
||||
popd
|
||||
# If Git is not present upgrade through manual method
|
||||
else
|
||||
ynh_script_progression --message="Upgrading source files..." --weight=1
|
||||
|
||||
# Create a temporary directory and backup smarty3 folder
|
||||
tmpdir="$(mktemp -d)"
|
||||
cp -a "$install_dir/view/smarty3" "$tmpdir/smarty3"
|
||||
|
||||
# Remove the app directory securely
|
||||
ynh_secure_remove --file="$install_dir"
|
||||
|
||||
# 1 - Clone stable repo
|
||||
git clone --quiet https://github.com/friendica/friendica.git -b stable "$install_dir"
|
||||
# Reset branch to the level of update we needed
|
||||
pushd "$install_dir"
|
||||
git reset --hard --quiet $version_commit
|
||||
popd
|
||||
|
||||
# 2 - Clone addons repo
|
||||
git clone --quiet https://github.com/friendica/friendica-addons.git -b stable "$install_dir/addon"
|
||||
# Reset addons branch to the level of update we needed
|
||||
pushd "$install_dir/addon"
|
||||
git reset --hard --quiet $addons_version_commit
|
||||
popd
|
||||
|
||||
# Restore the smarty3 folder
|
||||
cp -a "$tmpdir/smarty3" "$install_dir/view/smarty3"
|
||||
ynh_secure_remove --file="$tmpdir"
|
||||
fi
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$install_dir" --keep ="config/local.config.php view/smarty3"
|
||||
ynh_setup_source --dest_dir="$install_dir/addon" --source_id="addons"
|
||||
fi
|
||||
|
||||
# Copy config file for correct place
|
||||
ynh_add_config --template="../conf/local-sample.config.php" --destination="$install_dir/config/local.config.php"
|
||||
|
||||
chmod 750 "$install_dir"
|
||||
chmod -R 775 "$install_dir/view/smarty3"
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R $app:www-data "$install_dir"
|
||||
|
||||
# 3 - some extra folders
|
||||
chmod -R 775 "$install_dir/view/smarty3"
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
@ -125,14 +91,14 @@ ynh_add_fpm_config --usage=low --footprint=low
|
|||
# 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_systemd_config
|
||||
|
||||
yunohost service add $app --description="Friendica daemon" --log="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# STORE THE CONFIG FILE CHECKSUM
|
||||
#=================================================
|
||||
|
||||
ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app"
|
||||
chown root: "/etc/cron.d/$app"
|
||||
chmod 644 "/etc/cron.d/$app"
|
||||
|
||||
# Run Composer
|
||||
pushd "$install_dir"
|
||||
ynh_exec_as "$app" php$phpversion bin/composer.phar install --no-dev --quiet
|
||||
|
@ -140,6 +106,13 @@ pushd "$install_dir"
|
|||
#ynh_exec_as "$app" bin/console config system addon ldapauth
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
Loading…
Add table
Reference in a new issue