| Both sides previous revisionPrevious revisionNext revision | Previous revision |
| servers:linux:nginx:friendica [2025/10/17 00:26] – [Git Fix] Sean Rhone | servers:linux:nginx:friendica [2025/12/22 02:35] (current) – Sean Rhone |
|---|
| ===== Prerequisites ===== | ===== Prerequisites ===== |
| |
| * [[linux:distros:server:opensuse_tumbleweed_server|openSUSE Tumbleweed (Server)]] | * [[linux:distros:server:ubuntu_server|Ubuntu Server]] |
| * [[servers:linux:nginx_php_php-fpm|nginx + PHP + PHP-FPM]] | * [[servers:linux:nginx_php_php-fpm|nginx + PHP + PHP-FPM]] |
| * [[servers:linux:nginx:lets_encrypt|Certbot (Let's Encrypt)]] | * [[servers:linux:nginx:lets_encrypt|Certbot (Let's Encrypt)]] |
| * https://wiki.friendi.ca/docs/install#requirements | * https://wiki.friendi.ca/docs/install#requirements |
| |
| sudo zypper install php-composer2 php8-curl php-gd php8-gmp php8-pdo php8-mbstring php8-intl php8-mysql php8-zip php8-openssl php8-fileinfo php8-posix | sudo apt install composer php-curl php-gd php-gmp php-mbstring php-intl php-mysql php-zip |
| |
| ====== Download Source ====== | ====== Download Source ====== |
| * https://github.com/friendica/friendica/commits/develop/ | * https://github.com/friendica/friendica/commits/develop/ |
| |
| sudo git clone --branch 'develop' --depth '1' --recurse-submodules 'https://github.com/friendica/friendica.git' '/srv/www/social' && sudo chown -R 'wwwrun':'www' '/srv/www/social' && sudo chmod -R '0755' '/srv/www/social' | sudo git clone --branch 'develop' --depth '1' --recurse-submodules 'https://github.com/friendica/friendica.git' '/var/www/social' && sudo chown -R 'www-data':'www-data' '/var/www/social' && sudo chmod -R '0755' '/var/www/social' |
| |
| ===== Addons ===== | ===== Addons ===== |
| |
| * https://github.com/friendica/friendica-addons/commits/develop/ | * https://github.com/friendica/friendica-addons/commits/develop/ |
| * Required for ''composer install'' even without addons actively used | * :!: Required for ''composer install'' even without any addons enabled |
| |
| sudo git clone --branch 'develop' --depth '1' --recurse-submodules 'https://github.com/friendica/friendica-addons.git' '/srv/www/social/addon' && sudo chown -R 'wwwrun':'www' '/srv/www/social/addon' && sudo chmod -R '0755' '/srv/www/social/addon' | sudo git clone --branch 'develop' --depth '1' --recurse-submodules 'https://github.com/friendica/friendica-addons.git' '/var/www/social/addon' && sudo chown -R 'www-data':'www-data' '/var/www/social/addon' && sudo chmod -R '0755' '/var/www/social/addon' |
| |
| ====== Environment ====== | ====== Environment ====== |
| ===== Composer ===== | ===== Composer ===== |
| |
| sudo su 'wwwrun' -s '/bin/bash' | sudo su 'www-data' -s '/bin/bash' |
| |
| cd '/tmp' && '/usr/bin/composer' --working-dir='/srv/www/social' --no-cache install --no-dev | cd '/tmp' && '/usr/bin/composer' --working-dir='/var/www/social' --no-cache install --no-dev |
| |
| exit | exit |
| | |
| | ===== php-json-ld Fix ===== |
| | |
| | * 2025/12/22: ''git.friendi.ca'' requires authentication and fails during ''composer install'' |
| | * [[https://github.com/friendica/friendica/issues/15340|#15340]] |
| | |
| | nano '/var/www/social/composer.lock' |
| | |
| | <code> |
| | "url": "https://github.com/digitalbazaar/php-json-ld.git", |
| | "reference": "fe18c3f2ce47f30ace904ef58e7416f933be25e1"</code> |
| | |
| | friendica/json-ld |
| | |
| | <code> |
| | "name": "friendica/json-ld", |
| | "version": "1.1.4", |
| | "source": { |
| | "type": "git", |
| | "url": "https://github.com/digitalbazaar/php-json-ld.git", |
| | "reference": "fe18c3f2ce47f30ace904ef58e7416f933be25e1" |
| | },</code> |
| | |
| | ==== sed Test ==== |
| | |
| | sudo su 'www-data' -s '/bin/bash' |
| | |
| | sed -i 's|https://git.friendi.ca/friendica/php-json-ld|https://github.com/digitalbazaar/php-json-ld.git|g' '/var/www/social/composer.lock' |
| | |
| | sed -i 's/1f33c8766b5cfbecfbc2122238873debeed35fb6/fe18c3f2ce47f30ace904ef58e7416f933be25e1/g' '/var/www/social/composer.lock' |
| |
| ====== Database ====== | ====== Database ====== |
| ===== PHP-FPM Socket ===== | ===== PHP-FPM Socket ===== |
| |
| sudo -e '/etc/php8/fpm/php-fpm.d/social.conf' && sudo systemctl restart 'php-fpm' | sudo -e '/etc/php/8.4/fpm/pool.d/social.conf' && sudo systemctl restart 'php8.4-fpm' |
| |
| <code> | <code> |
| |
| ; User/Group | ; User/Group |
| user = "wwwrun" | user = "www-data" |
| group = "www" | group = "www-data" |
| |
| ; Socket | ; Socket |
| listen = "/run/php-fpm/social.sock" | listen = "/run/php/social.sock" |
| listen.owner = "wwwrun" | listen.owner = "www-data" |
| listen.group = "www" | listen.group = "www-data" |
| listen.mode = "0662" | listen.mode = "0662" |
| |
| pm.process_idle_timeout = "30" | pm.process_idle_timeout = "30" |
| |
| ; openSUSE php.ini Defaults | ; Logging |
| php_value[session.save_path] = "/var/lib/php8/sessions" | |
| | |
| ; General | |
| php_value[log_errors] = "0" | php_value[log_errors] = "0" |
| php_value[error_reporting] = "~E_ALL" | php_value[error_reporting] = "~E_ALL" |
| | |
| | ; General |
| php_value[date.timezone] = "America/New_York" | php_value[date.timezone] = "America/New_York" |
| | |
| | ; Friendica |
| php_value[max_execution_time] = "200" | php_value[max_execution_time] = "200" |
| php_value[memory_limit] = "512M" | php_value[memory_limit] = "512M" |
| ===== FastCGI ===== | ===== FastCGI ===== |
| |
| * ''social.sock'' | sudo -e '/etc/nginx/snippets/social.conf' |
| | |
| sudo -e '/etc/nginx/default.d/social.conf' | |
| |
| <code> | <code> |
| location ~ \.(php|phar)(/.*)?$ { | location '~' '\.(php|phar)(/.*)?$' { |
| fastcgi_split_path_info ^(.+\.(?:php|phar))(/.*)$; | |
| fastcgi_intercept_errors on; | fastcgi_split_path_info '^(.+\.(?:php|phar))(/.*)$'; |
| fastcgi_index index.php; | fastcgi_intercept_errors 'on'; |
| include fastcgi_params; | fastcgi_index 'index.php'; |
| fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | include 'fastcgi_params'; |
| fastcgi_param PATH_INFO $fastcgi_path_info; | fastcgi_param 'SCRIPT_FILENAME' '$document_root$fastcgi_script_name'; |
| fastcgi_pass unix:/run/php-fpm/social.sock; | fastcgi_param 'PATH_INFO' '$fastcgi_path_info'; |
| | fastcgi_param 'HTTPS' 'on'; |
| | |
| | fastcgi_pass 'unix:/run/php/social.sock'; |
| } | } |
| |
| ===== Server Block ===== | ===== Server Block ===== |
| |
| sudo -e '/etc/nginx/vhosts.d/social.conf' && sudo systemctl reload 'nginx' | * :!: ''sites-enabled'' should be done after [[#initialize]] |
| | |
| | sudo -e '/etc/nginx/sites-available/social.conf' |
| |
| <code> | <code> |
| server { | server { |
| listen '443' 'ssl'; | |
| http2 'on'; | |
| server_name 'social.realmofespionage.xyz'; | |
| root '/srv/www/social'; | |
| index 'index.php'; | |
| |
| include '/etc/nginx/default.d/social.conf'; | listen '443' 'ssl'; |
| include '/etc/nginx/default.d/headers.conf'; | http2 'on'; |
| | server_name 'social.realmofespionage.xyz'; |
| | root '/var/www/social'; |
| | index 'index.php'; |
| |
| client_max_body_size '10M'; | include '/etc/nginx/snippets/social.conf'; |
| | include '/etc/nginx/snippets/headers.conf'; |
| |
| # access_log /var/log/nginx/social-access.log; | client_max_body_size '10M'; |
| # error_log /var/log/nginx/social-error.log; | |
| |
| location / { | # access_log '/var/log/nginx/social-access.log'; |
| try_files $uri /index.php?pagename=$uri&$args; | # error_log '/var/log/nginx/social-error.log'; |
| } | |
| |
| location ^~ /.well-known/ { | location '/' { |
| allow all; | try_files '$uri' '/index.php?pagename=$uri&$args'; |
| rewrite ^ /index.php?pagename=$uri; | } |
| } | |
| |
| location ~* \.(tpl|md|tgz|log|out)$ { | location '^~' '/.well-known/' { |
| deny all; | allow 'all'; |
| } | rewrite '^' '/index.php?pagename=$uri'; |
| | } |
| | |
| | location '~*' '\.(tpl|md|tgz|log|out)$' { |
| | deny 'all'; |
| | } |
| | |
| | location '~' '/\.' { |
| | deny 'all'; |
| | } |
| |
| location ~ /\. { | |
| deny all; | |
| } | |
| } | } |
| |
| # End</code> | # End</code> |
| | |
| | sudo ln -s -f '/etc/nginx/sites-available/social.conf' '/etc/nginx/sites-enabled/social.conf' && sudo systemctl reload 'nginx' |
| |
| ====== Initial Setup ====== | ====== Initial Setup ====== |
| |
| ===== Initialize ===== | ===== Initialize ===== |
| | |
| | * https://wiki.friendi.ca/docs/install#option_brun_the_automatic_install_script |
| |
| * :!: Change ''--dbpass'', and ''--admin'' to email | * :!: Change ''--dbpass'', and ''--admin'' to email |
| | * :?: Might be able to use ''--file'' on manually-created [[#localconfigphp|local.config.php]] instead |
| |
| sudo su 'wwwrun' -s '/bin/bash' | sudo su 'www-data' -s '/bin/bash' |
| |
| cd '/srv/www/social' && '/srv/www/social/bin/console' autoinstall --dbhost 'localhost' --dbport '3365' --dbuser 'friendica' --dbdata 'friendica' --url 'https://social.realmofespionage.xyz' --dbpass 'x' --admin 'x' | cd '/var/www/social' && '/var/www/social/bin/console' autoinstall --dbhost 'localhost' --dbport '3365' --dbdata 'friendica' --dbuser 'friendica' --url 'https://social.realmofespionage.xyz' --basepath '/var/www/social' --dbpass 'x' --admin 'x' |
| |
| ===== Website ===== | ===== Account Create ===== |
| |
| * https://social.realmofespionage.xyz | * https://social.realmofespionage.xyz/register |
| * :!: Be sure the email matches what was used on the above command | * :!: Be sure the email matches what was used on the above command |
| |
| ===== User ===== | ===== User ===== |
| |
| * :!: ''x'' is the **nickname** chosen at website registration, lower-case | * :!: ''x'' is the **nickname** chosen at website registration |
| |
| sudo su 'wwwrun' -s '/bin/bash' | sudo su 'www-data' -s '/bin/bash' |
| |
| cd '/srv/www/social' && '/srv/www/social/bin/console' user password x | cd '/var/www/social' && '/var/www/social/bin/console' user password 'x' |
| | |
| | ===== Disable Registration ===== |
| | |
| | sudo su 'www-data' -s '/bin/bash' |
| | |
| | cd '/var/www/social' && '/usr/bin/php' '/var/www/social/bin/console.php' config 'config' 'register_policy' '0' |
| |
| ===== Etc ===== | ===== Etc ===== |
| |
| cd '/srv/www/social' && '/usr/bin/php' '/srv/www/social/bin/console.php' -h | sudo su 'www-data' -s '/bin/bash' |
| |
| cd '/srv/www/social' && '/usr/bin/php' '/srv/www/social/bin/console.php' worker | cd '/var/www/social' && '/usr/bin/php' '/var/www/social/bin/console.php' worker |
| |
| cd '/srv/www/social' && '/usr/bin/php' '/srv/www/social/bin/console.php' dbstructure update --force | cd '/var/www/social' && '/usr/bin/php' '/var/www/social/bin/console.php' dbstructure update --force |
| |
| cd '/srv/www/social' && '/usr/bin/php' '/srv/www/social/bin/console.php' dbstructure drop --execute | cd '/var/www/social' && '/usr/bin/php' '/var/www/social/bin/console.php' dbstructure drop --execute |
| |
| cd '/srv/www/social' && '/usr/bin/php' '/srv/www/social/bin/console.php' postupdate | cd '/var/www/social' && '/usr/bin/php' '/var/www/social/bin/console.php' postupdate |
| |
| cd '/srv/www/social' && '/usr/bin/php' '/srv/www/social/bin/console.php' cache clear | cd '/var/www/social' && '/usr/bin/php' '/var/www/social/bin/console.php' cache clear |
| |
| cd '/srv/www/social' && '/usr/bin/php' '/srv/www/social/bin/console.php' clearavatarcache | cd '/var/www/social' && '/usr/bin/php' '/var/www/social/bin/console.php' clearavatarcache |
| |
| nano '/srv/www/social/config/local.config.php' | cd '/var/www/social' && '/usr/bin/php' '/var/www/social/bin/console.php' config 'config' 'info' 'https://wiki.realmofespionage.xyz/servers:linux:nginx:friendica' |
| | |
| | exit |
| |
| ====== Settings ====== | ====== Settings ====== |
| |
| <code>{"nav_bg":"#3d8bff","nav_icon_color":"#ffffff","link_color":"#3d8bff","background_color":"#dedede","background_image":"","contentbg_transp":"100","login_bg_image":"","login_bg_color":"#484848"}</code> | <code>{"nav_bg":"#3d8bff","nav_icon_color":"#ffffff","link_color":"#3d8bff","background_color":"#dedede","background_image":"","contentbg_transp":"100","login_bg_image":"","login_bg_color":"#484848"}</code> |
| | |
| | ===== local.config.php ===== |
| | |
| | * :!: Change database ''password'' and config ''admin_email'' |
| | |
| | sudo -u 'www-data' -e '/var/www/social/config/local.config.php' |
| | |
| | <code> |
| | <?php |
| | |
| | return [ |
| | 'database' => [ |
| | 'hostname' => 'localhost', |
| | 'username' => 'friendica', |
| | 'password' => 'x', |
| | 'database' => 'friendica', |
| | 'charset' => 'utf8mb4', |
| | ], |
| | |
| | 'config' => [ |
| | 'php_path' => '/usr/bin/php', |
| | 'admin_email' => 'espionage724@x', |
| | 'sitename' => 'RoE | Social', |
| | 'register_policy' => \Friendica\Module\Register::CLOSED, |
| | 'max_import_size' => 200000, |
| | ], |
| | 'system' => [ |
| | 'url' => 'https://social.realmofespionage.xyz', |
| | 'basepath' => '/var/www/social', |
| | 'default_timezone' => 'America/New_York', |
| | 'language' => 'en', |
| | ], |
| | ]; |
| | |
| | // End</code> |
| | |
| | ====== Scripts ====== |
| | |
| | ===== Git Fix ===== |
| | |
| | * :!: Set email for **both** ''user.email'' |
| | |
| | sudo mkdir -p '/etc/nginx/scripts/social' && sudo -e '/etc/nginx/scripts/social/git-fix.sh' && sudo chmod '0500' '/etc/nginx/scripts/social/git-fix.sh' && sudo chown 'www-data':'www-data' '/etc/nginx/scripts/social/git-fix.sh' |
| | |
| | <code> |
| | #!/bin/bash |
| | |
| | cd '/tmp' |
| | |
| | '/usr/bin/rm' -Rf '/var/www/social/.git' |
| | '/usr/bin/git' -C '/var/www/social' init --initial-branch='develop' |
| | '/usr/bin/git' -C '/var/www/social' add '.' |
| | |
| | ######################################## |
| | '/usr/bin/git' -C '/var/www/social' config 'user.email' 'espionage724@x' |
| | ######################################## |
| | |
| | '/usr/bin/git' -C '/var/www/social' commit --message='x' |
| | |
| | '/usr/bin/git' -C '/var/www/social' remote add 'origin' 'https://github.com/friendica/friendica.git' |
| | '/usr/bin/git' -C '/var/www/social' pull --depth '1' --recurse-submodules 'origin' 'develop' --rebase |
| | |
| | '/usr/bin/git' -C '/var/www/social' reset --hard 'origin/develop' |
| | '/usr/bin/git' -C '/var/www/social' gc --aggressive --prune='all' |
| | '/usr/bin/git' -C '/var/www/social' fsck --full --strict |
| | |
| | '/usr/bin/rm' -Rf '/var/www/social/addon/.git' |
| | '/usr/bin/git' -C '/var/www/social/addon' init --initial-branch='develop' |
| | '/usr/bin/git' -C '/var/www/social/addon' add '.' |
| | |
| | ######################################## |
| | '/usr/bin/git' -C '/var/www/social/addon' config 'user.email' 'espionage724@x' |
| | ######################################## |
| | |
| | '/usr/bin/git' -C '/var/www/social/addon' commit --message='x' |
| | |
| | '/usr/bin/git' -C '/var/www/social/addon' remote add 'origin' 'https://github.com/friendica/friendica-addons.git' |
| | '/usr/bin/git' -C '/var/www/social/addon' pull --depth '1' --recurse-submodules 'origin' 'develop' --rebase |
| | |
| | '/usr/bin/git' -C '/var/www/social/addon' reset --hard 'origin/develop' |
| | '/usr/bin/git' -C '/var/www/social/addon' gc --aggressive --prune='all' |
| | '/usr/bin/git' -C '/var/www/social/addon' fsck --full --strict |
| | |
| | # End</code> |
| | |
| | sudo -u 'www-data' '/etc/nginx/scripts/social/git-fix.sh' |
| |
| ====== Services ====== | ====== Services ====== |
| |
| ===== Worker ===== | ===== Worker ===== |
| | |
| | * https://wiki.friendi.ca/docs/install#required_background_tasks |
| |
| ==== Service ==== | ==== Service ==== |
| <code> | <code> |
| [Service] | [Service] |
| User=wwwrun | User=www-data |
| Group=www | Group=www-data |
| Type=oneshot | Type=oneshot |
| |
| WorkingDirectory=/srv/www/social | WorkingDirectory=/var/www/social |
| |
| ExecStart='/usr/bin/php' '/srv/www/social/bin/console.php' worker | ExecStart='/usr/bin/php' '/var/www/social/bin/console.php' worker |
| | |
| ExecStartPost='/usr/bin/sync' | |
| |
| # End</code> | # End</code> |
| ==== Timer ==== | ==== Timer ==== |
| |
| * Every 12 hours | * Every 10 minutes |
| |
| sudo -e '/etc/systemd/system/social-d.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'social-d.timer' --now && sudo systemctl start 'social-d' && sudo systemctl status 'social-d' -l | sudo -e '/etc/systemd/system/social-d.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'social-d.timer' --now && sudo systemctl start 'social-d' && sudo systemctl status 'social-d' -l |
| |
| [Timer] | [Timer] |
| OnBootSec=12h | OnBootSec=10m |
| OnUnitActiveSec=12h | OnUnitActiveSec=10m |
| |
| [Install] | [Install] |
| <code> | <code> |
| [Service] | [Service] |
| User=wwwrun | User=www-data |
| Group=www | Group=www-data |
| Type=oneshot | Type=oneshot |
| |
| WorkingDirectory=/srv/www/social | WorkingDirectory=/var/www/social |
| Environment="COMPOSER_CACHE_DIR=/dev/null" | Environment="COMPOSER_CACHE_DIR=/dev/null" |
| |
| ExecStart='/usr/bin/git' -C '/srv/www/social' pull origin 'develop' | ExecStart='/usr/bin/git' -C '/var/www/social' reset --hard 'origin/develop' |
| ExecStart='/usr/bin/git' -C '/srv/www/social/addon' pull origin 'develop' | ExecStart='/usr/bin/git' -C '/var/www/social' pull origin 'develop' --rebase |
| |
| ExecStart='/usr/bin/composer' --working-dir='/srv/www/social' --no-cache install --no-dev | ExecStart='/usr/bin/git' -C '/var/www/social/addon' reset --hard 'origin/develop' |
| | ExecStart='/usr/bin/git' -C '/var/www/social/addon' pull origin 'develop' --rebase |
| |
| ExecStart='/usr/bin/php' '/srv/www/social/bin/console.php' dbstructure update --force | # Temp php-json-ld Fix (#15340) |
| ExecStart='/usr/bin/php' '/srv/www/social/bin/console.php' dbstructure drop --execute | ExecStart='/usr/bin/sed' -i 's|https://git.friendi.ca/friendica/php-json-ld|https://github.com/digitalbazaar/php-json-ld.git|g' '/var/www/social/composer.lock' |
| ExecStart='/usr/bin/php' '/srv/www/social/bin/console.php' postupdate | ExecStart='/usr/bin/sed' -i 's/1f33c8766b5cfbecfbc2122238873debeed35fb6/fe18c3f2ce47f30ace904ef58e7416f933be25e1/g' '/var/www/social/composer.lock' |
| ExecStart='/usr/bin/php' '/srv/www/social/bin/console.php' cache clear | |
| ExecStart='/usr/bin/php' '/srv/www/social/bin/console.php' clearavatarcache | |
| |
| | ExecStart='/usr/bin/composer' --working-dir='/var/www/social' --no-cache install --no-dev |
| | |
| | ExecStart='/usr/bin/php' '/var/www/social/bin/console.php' dbstructure update --force |
| | ExecStart='/usr/bin/php' '/var/www/social/bin/console.php' dbstructure drop --execute |
| | |
| | ExecStartPost='/usr/bin/php' '/var/www/social/bin/console.php' postupdate |
| ExecStartPost='/usr/bin/sync' | ExecStartPost='/usr/bin/sync' |
| |
| ==== Timer ==== | ==== Timer ==== |
| |
| * Every day at ''04:00:00'' | * Daily ''04:00:00 AM'' |
| |
| sudo -e '/etc/systemd/system/social-up.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'social-up.timer' --now && sudo systemctl start 'social-up' && sudo systemctl status 'social-up' -l | sudo -e '/etc/systemd/system/social-up.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'social-up.timer' --now && sudo systemctl start 'social-up' && sudo systemctl status 'social-up' -l |
| Type=oneshot | Type=oneshot |
| |
| ExecStart='/usr/bin/bash' -c '"/usr/bin/tar" -czf "/home/CHANGEME/backups/friendica-files-auto-"$$(date +%%Y-%%m-%%d)".tar.gz" -C "/srv/www" "social"' | WorkingDirectory=/var/www/social |
| | |
| | ExecStart='/usr/bin/bash' -c '"/usr/bin/tar" -czf "/home/CHANGEME/backups/friendica-files-auto-"$$(date +%%Y-%%m-%%d)".tar.gz" -C "/var/www" "social"' |
| |
| ExecStartPost='/usr/bin/sync' | ExecStartPost='/usr/bin/sync' |
| === Timer === | === Timer === |
| |
| * ''01'' day of every month at ''04:15:00'' | * Monthly (5th) ''04:15:00 AM'' |
| |
| sudo -e '/etc/systemd/system/social-fb.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'social-fb.timer' --now | sudo -e '/etc/systemd/system/social-fb.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'social-fb.timer' --now |
| |
| [Timer] | [Timer] |
| OnCalendar=*-*-01 04:15:00 | OnCalendar=*-*-05 04:15:00 |
| Persistent=true | Persistent=true |
| |
| Group=mysql | Group=mysql |
| Type=oneshot | Type=oneshot |
| | |
| | WorkingDirectory=/var/lib/mysql |
| |
| ExecStart='/usr/bin/bash' -c '"/usr/bin/mariadb-dump" --defaults-extra-file="/var/lib/mysql/auth/friendica" --single-transaction --quick "friendica" -r "/home/CHANGEME/backups/friendica-database-auto-"$$(date +%%Y-%%m-%%d)".sql"' | ExecStart='/usr/bin/bash' -c '"/usr/bin/mariadb-dump" --defaults-extra-file="/var/lib/mysql/auth/friendica" --single-transaction --quick "friendica" -r "/home/CHANGEME/backups/friendica-database-auto-"$$(date +%%Y-%%m-%%d)".sql"' |
| === Timer === | === Timer === |
| |
| * ''01'' day of every month at ''04:10:00'' | * Monthly (5th) ''04:10:00 AM'' |
| |
| sudo -e '/etc/systemd/system/social-db.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'social-db.timer' --now && sudo systemctl start 'social-db' && sudo systemctl status 'social-db' -l | sudo -e '/etc/systemd/system/social-db.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'social-db.timer' --now && sudo systemctl start 'social-db' && sudo systemctl status 'social-db' -l |
| |
| [Timer] | [Timer] |
| OnCalendar=*-*-01 04:10:00 | OnCalendar=*-*-05 04:10:00 |
| Persistent=true | Persistent=true |
| |
| <code> | <code> |
| [Service] | [Service] |
| User=wwwrun | User=www-data |
| Group=www | Group=www-data |
| Type=oneshot | Type=oneshot |
| |
| ExecStart='/usr/bin/git' -C '/srv/www/social' reset --hard | WorkingDirectory=/var/www/social |
| ExecStart='/usr/bin/git' -C '/srv/www/social' gc --aggressive --prune='all' | |
| ExecStart='/usr/bin/git' -C '/srv/www/social' fsck --full --strict | |
| |
| ExecStart='/usr/bin/git' -C '/srv/www/social/addon' reset --hard | ExecStart='/usr/bin/git' -C '/var/www/social' gc --aggressive --prune='all' |
| ExecStart='/usr/bin/git' -C '/srv/www/social/addon' gc --aggressive --prune='all' | ExecStart='/usr/bin/git' -C '/var/www/social' fsck --full --strict |
| ExecStart='/usr/bin/git' -C '/srv/www/social/addon' fsck --full --strict | |
| | ExecStart='/usr/bin/git' -C '/var/www/social/addon' gc --aggressive --prune='all' |
| | ExecStart='/usr/bin/git' -C '/var/www/social/addon' fsck --full --strict |
| | |
| | ExecStart='/usr/bin/php' '/var/www/social/bin/console.php' cache clear |
| | ExecStart='/usr/bin/php' '/var/www/social/bin/console.php' clearavatarcache |
| |
| ExecStartPost='/usr/bin/sync' | ExecStartPost='/usr/bin/sync' |
| ==== Timer ==== | ==== Timer ==== |
| |
| * ''01'' day of every month at ''04:30:00'' | * Monthly (5th) ''04:30:00 AM'' |
| |
| sudo -e '/etc/systemd/system/social-m.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'social-m.timer' --now | sudo -e '/etc/systemd/system/social-m.timer' && sudo systemctl daemon-reload && sudo systemctl enable 'social-m.timer' --now |
| |
| [Timer] | [Timer] |
| OnCalendar=*-*-01 04:30:00 | OnCalendar=*-*-05 04:30:00 |
| Persistent=true | Persistent=true |
| |
| **** | **** |
| |
| sudo tar -czf ~/'friendica-files-manual-'$(date +%Y-%m-%d)'.tar.gz' -C '/srv/www' 'social' | sudo tar -czf ~/'friendica-files-manual-'$(date +%Y-%m-%d)'.tar.gz' -C '/var/www' 'social' |
| |
| ===== Database ===== | ===== Database ===== |
| **** | **** |
| |
| ls ~/'friendica-files-'*'.tar.gz' && sudo rm -Rf '/srv/www/social' | ls ~/'friendica-files-'*'.tar.gz' && sudo rm -Rf '/var/www/social' |
| |
| ===== Restore Files ===== | ===== Restore Files ===== |
| **** | **** |
| |
| sudo tar -xzf ~/'friendica-files-'*'.tar.gz' -C '/srv/www' 'social' && sudo chown -R 'wwwrun':'www' '/srv/www/social' && sudo chmod -R '0755' '/srv/www/social' | sudo tar -xzf ~/'friendica-files-'*'.tar.gz' -C '/var/www' 'social' && sudo chown -R 'www-data':'www-data' '/var/www/social' && sudo chmod -R '0755' '/var/www/social' |
| |
| ===== Git Fix ===== | ===== Git Fix ===== |
| * :!: Requires [[#etc|Etc]] commands afterwards ((https://social.realmofespionage.xyz doesn't redirect to single-profile URL and shows an error)) | * :!: Requires [[#etc|Etc]] commands afterwards ((https://social.realmofespionage.xyz doesn't redirect to single-profile URL and shows an error)) |
| |
| sudo su 'wwwrun' -s '/bin/bash' | sudo su 'www-data' -s '/bin/bash' |
| |
| rm -Rf '/srv/www/social/.git' | rm -Rf '/var/www/social/.git' |
| |
| git -C '/srv/www/social' init --initial-branch='develop' | git -C '/var/www/social' init --initial-branch='develop' |
| |
| git -C '/srv/www/social' add '.' | git -C '/var/www/social' add '.' |
| |
| git -C '/srv/www/social' config 'user.email' 'espionage724@x' | git -C '/var/www/social' config 'user.email' 'espionage724@x' |
| |
| git -C '/srv/www/social' commit --message='x' | git -C '/var/www/social' commit --message='x' |
| |
| git -C '/srv/www/social' remote add 'origin' 'https://github.com/friendica/friendica.git' | git -C '/var/www/social' remote add 'origin' 'https://github.com/friendica/friendica.git' |
| |
| git -C '/srv/www/social' pull --depth '1' --recurse-submodules 'origin' 'develop' --rebase | git -C '/var/www/social' pull --depth '1' --recurse-submodules 'origin' 'develop' --rebase |
| |
| git -C '/srv/www/social' reset --hard 'origin/develop' | git -C '/var/www/social' reset --hard 'origin/develop' |
| |
| git -C '/srv/www/social' gc --aggressive --prune='all' | git -C '/var/www/social' gc --aggressive --prune='all' |
| |
| git -C '/srv/www/social' fsck --full --strict | git -C '/var/www/social' fsck --full --strict |
| |
| ==== Addons ==== | ==== Addons ==== |
| * :!: Set email for ''user.email'' | * :!: Set email for ''user.email'' |
| |
| rm -Rf '/srv/www/social/addon/.git' | rm -Rf '/var/www/social/addon/.git' |
| |
| git -C '/srv/www/social/addon' init --initial-branch='develop' | git -C '/var/www/social/addon' init --initial-branch='develop' |
| |
| git -C '/srv/www/social/addon' add '.' | git -C '/var/www/social/addon' add '.' |
| |
| git -C '/srv/www/social/addon' config 'user.email' 'espionage724@x' | git -C '/var/www/social/addon' config 'user.email' 'espionage724@x' |
| |
| git -C '/srv/www/social/addon' commit --message='x' | git -C '/var/www/social/addon' commit --message='x' |
| |
| git -C '/srv/www/social/addon' remote add 'origin' 'https://github.com/friendica/friendica-addons.git' | git -C '/var/www/social/addon' remote add 'origin' 'https://github.com/friendica/friendica-addons.git' |
| |
| git -C '/srv/www/social/addon' pull --depth '1' --recurse-submodules 'origin' 'develop' --rebase | git -C '/var/www/social/addon' pull --depth '1' --recurse-submodules 'origin' 'develop' --rebase |
| |
| git -C '/srv/www/social/addon' reset --hard 'origin/develop' | git -C '/var/www/social/addon' reset --hard 'origin/develop' |
| |
| git -C '/srv/www/social/addon' gc --aggressive --prune='all' | git -C '/var/www/social/addon' gc --aggressive --prune='all' |
| |
| git -C '/srv/www/social/addon' fsck --full --strict | git -C '/var/www/social/addon' fsck --full --strict |
| |
| exit | exit |
| ===== Database Connection ===== | ===== Database Connection ===== |
| |
| sudo -e '/srv/www/social/config/local.config.php' && sudo chown -v 'wwwrun':'www' '/srv/www/social/config/local.config.php' | sudo -u 'www-data' -e '/var/www/social/config/local.config.php' |
| |
| <code> | <code> |
| <code> | <code> |
| 'system' => [ | 'system' => [ |
| 'basepath' => '/srv/www/social',</code> | 'basepath' => '/var/www/social',</code> |
| |
| ===== Restore Database ===== | ===== Restore Database ===== |
| |
| rm -fv ~/'friendica-files-'*'.tar.gz' ~/'friendica'*'.sql' | rm -fv ~/'friendica-files-'*'.tar.gz' ~/'friendica'*'.sql' |
| | |
| | ====== Quick Commands ====== |
| | |
| | ===== Commands ===== |
| | |
| | sudo su 'www-data' -s '/bin/bash' |
| | |
| | cd '/var/www/social' && '/usr/bin/php' '/var/www/social/bin/console.php' -h |
| | |
| | ===== Show Config ===== |
| | |
| | sudo su 'www-data' -s '/bin/bash' |
| | |
| | cd '/var/www/social' && '/usr/bin/php' '/var/www/social/bin/console.php' config |
| |