====== Information ====== * Friendica ((https://friendi.ca/)) * [[information;realm_of_espionage|Realm of Espionage]] * https://social.realmofespionage.xyz ===== Prerequisites ===== * [[windows;10_ltsc_server|Windows 10 (21H2)]] * [[servers;windows;nginx_php_php-cgi|nginx]] * [[servers;windows;nginx;lets_encrypt|Certbot (Let's Encrypt)]] * [[servers;windows;mariadb|MariaDB]] ==== WSL ==== * [[windows;notes;wsl|WSL]] * [[windows;opensuse_tumbleweed_wsl|openSUSE Tumbleweed (WSL)]] * [[servers;windows;php_php-fpm_wsl|PHP + PHP-FPM (WSL)]] ((PHP ''posix'' is required, [[https://github.com/friendica/friendica/issues/14676|#14676]])) ====== Dependencies ====== * https://friendi.ca/resources/requirements/ * https://wiki.friendi.ca/docs/install#requirements "wsl.exe" --distribution openSUSE-Tumbleweed --cd "/tmp" --user root -- '/usr/bin/zypper' install git-core tar php-composer2 php8-curl php-gd php8-gmp php8-pdo php8-mbstring php8-intl php8-mysql php8-zip php8-openssl php8-fileinfo php8-posix ====== Download Source ====== * https://github.com/friendica/friendica/commits/develop/ * https://github.com/friendica/friendica-addons/commits/develop/ "wsl.exe" --distribution openSUSE-Tumbleweed --cd "/tmp" --user root -- '/usr/bin/git' clone --branch 'develop' --depth '1' --recurse-submodules 'https://github.com/friendica/friendica.git' '/srv/www/social' "wsl.exe" --distribution openSUSE-Tumbleweed --cd "/tmp" --user root -- '/usr/bin/git' clone --branch 'develop' --depth '1' --recurse-submodules 'https://github.com/friendica/friendica-addons.git' '/srv/www/social/addon' "wsl.exe" --distribution openSUSE-Tumbleweed --cd "/tmp" --user root -- '/usr/bin/chown' -R "%USERNAME%":"%USERNAME%" '/srv/www/social' "wsl.exe" --distribution openSUSE-Tumbleweed --cd "/tmp" --user root -- '/usr/bin/chmod' -R '0660' '/srv/www/social' ====== Database ====== "%ProgramFiles%\MariaDB 12.2\bin\mariadb.exe" -u "root" CREATE DATABASE friendica; CREATE USER 'friendica'@'172.28.112.0/255.255.240.0' IDENTIFIED BY 'x'; GRANT ALL PRIVILEGES ON friendica.* to 'friendica'@'172.28.112.0/255.255.240.0'; FLUSH PRIVILEGES;EXIT; ===== Firewall ===== * [[servers;windows;mariadb#firewall|MariaDB notes]] * Removes block and allows WSL subnet connection "netsh.exe" advfirewall firewall delete rule name="MariaDB Server" CD "%ProgramFiles%\MariaDB "*"\bin" && "netsh.exe" advfirewall firewall add rule name="MariaDB Server" dir="in" action="allow" profile="any" remoteip="172.28.112.0/20" program="%CD%\mysqld.exe" ====== Environment ====== ===== PHP ===== "wsl.exe" --distribution openSUSE-Tumbleweed --cd "/tmp" --user root -- '/usr/bin/nano' '/etc/php8/fpm/php-fpm.d/social.conf' [social] ; User/Group user = "espionage724" group = "espionage724" ; Socket listen = "127.0.0.1:9005" listen.allowed_clients = "127.0.0.1" ; Process Management pm = "ondemand" pm.max_children = "8" pm.process_idle_timeout = "30" ; Logging php_value[log_errors] = "Off" php_value[error_reporting] = "~E_ALL" php_value[display_errors] = "Off" php_value[display_startup_errors] = "Off" php_value[html_errors] = "Off" ; General php_value[date.timezone] = "America/New_York" ; openSUSE php.ini Defaults php_value[session.save_path] = "/var/lib/php8/sessions" ; Friendica php_value[max_execution_time] = "200" php_value[memory_limit] = "512M" php_value[post_max_size] = "10M" php_value[upload_max_filesize] = "10M" php_value[max_file_uploads] = "100" php_value[register_argc_argv] = "On" ; End ===== Composer ===== **** "wsl.exe" --distribution openSUSE-Tumbleweed --cd "/tmp" -- '/usr/bin/composer2' --working-dir='/srv/www/social' --no-cache install --no-dev ====== nginx + PHP-FPM Configuration ====== ===== PHP-FPM ===== "notepad.exe" "%SystemDrive%\www\nginx\default.d\social.conf" location "~" "\.(php)(/.*)?$" { fastcgi_split_path_info "^(.+\.(?:php))(/.*)$"; fastcgi_intercept_errors "on"; fastcgi_index "index.php"; include "C:/www/nginx/conf/fastcgi_params"; fastcgi_param "SCRIPT_FILENAME" "/srv/www/social$fastcgi_script_name"; fastcgi_param "PATH_INFO" "$fastcgi_path_info"; fastcgi_param "HTTPS" "on"; fastcgi_pass "127.0.0.1:9005"; } # End ===== Server Block ===== "notepad.exe" "%SystemDrive%\www\nginx\vhosts.d\social.conf" server { listen "443" "ssl"; http2 "on"; server_name "social.realmofespionage.xyz"; root "//wsl.localhost/openSUSE-Tumbleweed/srv/www/social"; index "index.php"; include "C:/www/nginx/default.d/social.conf"; include "C:/www/nginx/default.d/headers.conf"; client_max_body_size "10M"; # access_log "logs/social-access.log"; # error_log "logs/social-error.log"; location "/" { try_files "$uri" "/index.php?pagename=$uri&$args"; } location "^~" "/.well-known/" { allow "all"; rewrite "^" "/index.php?pagename=$uri"; } location "~*" "\.(tpl|md|tgz|log|out)$" { deny "all"; } location "~" "/\." { deny "all"; } } # End "%SystemDrive%\www\scripts\nginx\Reload.bat" ====== Scripts ====== ===== Folder ===== MKDIR "%SystemDrive%\www\scripts\social" "explorer.exe" "%SystemDrive%\www\scripts\social" ===== PHP-FPM ===== "notepad.exe" "%SystemDrive%\www\scripts\social\PHP-FPM.bat" @echo off CD "%Temp%" START "Social PHP-FPM" /MIN "wsl.exe" --distribution openSUSE-Tumbleweed --cd "/tmp" --user root -- '/usr/sbin/php-fpm' -c '/etc/php8/fpm/php-fpm.d/social.conf' -F :: End "%SystemDrive%\www\scripts\social\PHP-FPM.bat" ===== Worker ===== "notepad.exe" "%SystemDrive%\www\scripts\social\Worker.bat" @echo off TITLE Social Worker CD "%Temp%" "wsl.exe" --distribution openSUSE-Tumbleweed --cd "\\wsl.localhost\openSUSE-Tumbleweed\srv\www\social" -- '/usr/bin/php' -c '/etc/php8/fpm/php-fpm.d/social.conf' '/srv/www/social/bin/console.php' worker :: End "%SystemDrive%\www\scripts\social\Worker.bat" ===== Update ===== "notepad.exe" "%SystemDrive%\www\scripts\social\Update.bat" @echo off TITLE Social Updater CD "%Temp%" "wsl.exe" --distribution openSUSE-Tumbleweed --cd "/tmp" -- '/usr/bin/git' -C '/srv/www/social' reset --hard 'origin/develop' "wsl.exe" --distribution openSUSE-Tumbleweed --cd "/tmp" -- '/usr/bin/git' -C '/srv/www/social' pull origin 'develop' --rebase "wsl.exe" --distribution openSUSE-Tumbleweed --cd "/tmp" -- '/usr/bin/git' -C '/srv/www/social/addon' reset --hard 'origin/develop' "wsl.exe" --distribution openSUSE-Tumbleweed --cd "/tmp" -- '/usr/bin/git' -C '/srv/www/social/addon' pull origin 'develop' --rebase "wsl.exe" --distribution openSUSE-Tumbleweed --cd "/tmp" -- '/usr/bin/composer2' --working-dir='/srv/www/social' --no-cache install --no-dev "wsl.exe" --distribution openSUSE-Tumbleweed --cd "\\wsl.localhost\openSUSE-Tumbleweed\srv\www\social" -- '/usr/bin/php' -c '/etc/php8/fpm/php-fpm.d/social.conf' '/srv/www/social/bin/console.php' dbstructure update --force "wsl.exe" --distribution openSUSE-Tumbleweed --cd "\\wsl.localhost\openSUSE-Tumbleweed\srv\www\social" -- '/usr/bin/php' -c '/etc/php8/fpm/php-fpm.d/social.conf' '/srv/www/social/bin/console.php' dbstructure drop --execute "wsl.exe" --distribution openSUSE-Tumbleweed --cd "\\wsl.localhost\openSUSE-Tumbleweed\srv\www\social" -- '/usr/bin/php' -c '/etc/php8/fpm/php-fpm.d/social.conf' '/srv/www/social/bin/console.php' postupdate :: End "%SystemDrive%\www\scripts\social\Update.bat" ===== Back-up ===== "notepad.exe" "%SystemDrive%\www\scripts\social\Back-up.bat" @echo off TITLE Social Back-up CD "%Temp%" "tar.exe" -czf "D:\Servers\Scheduled Backups\friendica-files-auto-%RANDOM%.tar.gz" -C "\\wsl.localhost\openSUSE-Tumbleweed\srv\www" "social" "%ProgramFiles%\MariaDB 12.2\bin\mariadb-dump.exe" -u "root" --opt -r "D:\Servers\Scheduled Backups\%RANDOM%-friendica.sql" "friendica" ::"tar.exe" -czf "%UserProfile%\Downloads\friendica-files-auto-%RANDOM%.tar.gz" -C "\\wsl.localhost\openSUSE-Tumbleweed\srv\www" "social" ::"%ProgramFiles%\MariaDB 12.2\bin\mariadb-dump.exe" -u "root" --opt -r "%UserProfile%\Downloads\%RANDOM%-friendica.sql" "friendica" :: End "%SystemDrive%\www\scripts\social\Back-up.bat" ===== Maintenance ===== "notepad.exe" "%SystemDrive%\www\scripts\social\Maintenance.bat" @echo off TITLE Social Maintenance CD "%Temp%" "wsl.exe" --distribution openSUSE-Tumbleweed --cd "/tmp" -- '/usr/bin/git' -C '/srv/www/social' gc --aggressive --prune='all' "wsl.exe" --distribution openSUSE-Tumbleweed --cd "/tmp" -- '/usr/bin/git' -C '/srv/www/social' fsck --full --strict "wsl.exe" --distribution openSUSE-Tumbleweed --cd "/tmp" -- '/usr/bin/git' -C '/srv/www/social/addon' gc --aggressive --prune='all' "wsl.exe" --distribution openSUSE-Tumbleweed --cd "/tmp" -- '/usr/bin/git' -C '/srv/www/social/addon' fsck --full --strict "wsl.exe" --distribution openSUSE-Tumbleweed --cd "\\wsl.localhost\openSUSE-Tumbleweed\srv\www\social" -- '/usr/bin/php' -c '/etc/php8/fpm/php-fpm.d/social.conf' '/srv/www/social/bin/console.php' cache clear "wsl.exe" --distribution openSUSE-Tumbleweed --cd "\\wsl.localhost\openSUSE-Tumbleweed\srv\www\social" -- '/usr/bin/php' -c '/etc/php8/fpm/php-fpm.d/social.conf' '/srv/www/social/bin/console.php' clearavatarcache :: End "%SystemDrive%\www\scripts\social\Maintenance.bat" ===== Git Fix ===== * :!: Set **both** ''user.email'' "notepad.exe" "%SystemDrive%\www\scripts\social\Git Fix.bat" @echo off TITLE Social Git Fix CD "%Temp%" ::################## ::# Friendica ::################## "wsl.exe" --distribution openSUSE-Tumbleweed --cd "/tmp" -- '/usr/bin/rm' -Rf '/srv/www/social/.git' "wsl.exe" --distribution openSUSE-Tumbleweed --cd "/tmp" -- '/usr/bin/git' -C '/srv/www/social' init --initial-branch='develop' "wsl.exe" --distribution openSUSE-Tumbleweed --cd "/tmp" -- '/usr/bin/git' -C '/srv/www/social' add '.' ::###################################### "wsl.exe" --distribution openSUSE-Tumbleweed --cd "/tmp" -- '/usr/bin/git' -C '/srv/www/social' config 'user.email' 'espionage724@x' ::###################################### "wsl.exe" --distribution openSUSE-Tumbleweed --cd "/tmp" -- '/usr/bin/git' -C '/srv/www/social' commit --message='x' "wsl.exe" --distribution openSUSE-Tumbleweed --cd "/tmp" -- '/usr/bin/git' -C '/srv/www/social' remote add 'origin' 'https://github.com/friendica/friendica.git' "wsl.exe" --distribution openSUSE-Tumbleweed --cd "/tmp" -- '/usr/bin/git' -C '/srv/www/social' pull --depth '1' --recurse-submodules 'origin' 'develop' --rebase "wsl.exe" --distribution openSUSE-Tumbleweed --cd "/tmp" -- '/usr/bin/git' -C '/srv/www/social' reset --hard 'origin/develop' "wsl.exe" --distribution openSUSE-Tumbleweed --cd "/tmp" -- '/usr/bin/git' -C '/srv/www/social' gc --aggressive --prune='all' "wsl.exe" --distribution openSUSE-Tumbleweed --cd "/tmp" -- '/usr/bin/git' -C '/srv/www/social' fsck --full --strict ::################## ::# Addons ::################## "wsl.exe" --distribution openSUSE-Tumbleweed --cd "/tmp" -- '/usr/bin/rm' -Rf '/srv/www/social/addon/.git' "wsl.exe" --distribution openSUSE-Tumbleweed --cd "/tmp" -- '/usr/bin/git' -C '/srv/www/social/addon' init --initial-branch='develop' "wsl.exe" --distribution openSUSE-Tumbleweed --cd "/tmp" -- '/usr/bin/git' -C '/srv/www/social/addon' add '.' ::###################################### "wsl.exe" --distribution openSUSE-Tumbleweed --cd "/tmp" -- '/usr/bin/git' -C '/srv/www/social/addon' config 'user.email' 'espionage724@x' ::###################################### "wsl.exe" --distribution openSUSE-Tumbleweed --cd "/tmp" -- '/usr/bin/git' -C '/srv/www/social/addon' commit --message='x' "wsl.exe" --distribution openSUSE-Tumbleweed --cd "/tmp" -- '/usr/bin/git' -C '/srv/www/social/addon' remote add 'origin' 'https://github.com/friendica/friendica-addons.git' "wsl.exe" --distribution openSUSE-Tumbleweed --cd "/tmp" -- '/usr/bin/git' -C '/srv/www/social/addon' pull --depth '1' --recurse-submodules 'origin' 'develop' --rebase "wsl.exe" --distribution openSUSE-Tumbleweed --cd "/tmp" -- '/usr/bin/git' -C '/srv/www/social/addon' reset --hard 'origin/develop' "wsl.exe" --distribution openSUSE-Tumbleweed --cd "/tmp" -- '/usr/bin/git' -C '/srv/www/social/addon' gc --aggressive --prune='all' "wsl.exe" --distribution openSUSE-Tumbleweed --cd "/tmp" -- '/usr/bin/git' -C '/srv/www/social/addon' fsck --full --strict :: End "%SystemDrive%\www\scripts\social\Git Fix.bat" ====== Task Scheduler ====== ===== PHP-FPM ===== * Auto-start SCHTASKS /Create /SC "ONLOGON" /TN "Social PHP-FPM" /TR "%SystemDrive%\www\scripts\social\PHP-FPM.bat" /F ===== Worker ===== * https://wiki.friendi.ca/docs/install#required_background_tasks * Every 10 minutes SCHTASKS /Create /SC "MINUTE" /MO "10" /TN "Social Worker" /TR "%SystemDrive%\www\scripts\social\Worker.bat" /F ===== Update ===== * Daily ''04:00:00 AM'' SCHTASKS /Create /SC "DAILY" /TN "Social Update" /TR "%SystemDrive%\www\scripts\social\Update.bat" /ST "04:00" /F ===== Back-up ===== * Monthly (5th) ''04:10:00 AM'' SCHTASKS /Create /SC "MONTHLY" /D "5" /M "*" /TN "Social Back-up" /TR "%SystemDrive%\www\scripts\social\Back-up.bat" /ST "04:10" /F ===== Maintenance ===== * Monthly (5th) ''04:30:00 AM'' SCHTASKS /Create /SC "MONTHLY" /D "5" /M "*" /TN "Social Maintenance" /TR "%SystemDrive%\www\scripts\social\Maintenance.bat" /ST "04:30" /F ====== Initial Setup ====== * 2026/02/04: Untested ((restored from back-up)) ===== Initialize ===== * https://wiki.friendi.ca/docs/install#option_brun_the_automatic_install_script * :!: Change ''--dbpass'', and ''--admin'' to email * :?: Might be able to use ''--file'' on manually-created [[#localconfigphp|local.config.php]] instead "wsl.exe" --distribution openSUSE-Tumbleweed --cd "\\wsl.localhost\openSUSE-Tumbleweed\srv\www\social" -- '/usr/bin/php' -c '/etc/php8/fpm/php-fpm.d/social.conf' '/srv/www/social/bin/console' autoinstall --dbhost '172.28.112.1' --dbport '3365' --dbuser 'friendica' --dbdata 'friendica' --url 'https://social.realmofespionage.xyz' --basepath '/srv/www/social' --dbpass 'x' --admin 'espionage724@x' ===== Account Create ===== * https://social.realmofespionage.xyz/register * :!: Be sure the email matches what was used on the above command ===== User ===== * :!: ''x'' is the **nickname** chosen at website registration "wsl.exe" --distribution openSUSE-Tumbleweed --cd "\\wsl.localhost\openSUSE-Tumbleweed\srv\www\social" -- '/usr/bin/php' -c '/etc/php8/fpm/php-fpm.d/social.conf' '/srv/social/bin/console' user password x ===== Disable Registration ===== **** "wsl.exe" --distribution openSUSE-Tumbleweed --cd "\\wsl.localhost\openSUSE-Tumbleweed\srv\www\social" -- '/usr/bin/php' -c '/etc/php8/fpm/php-fpm.d/social.conf' '/srv/www/social/bin/console.php' config 'config' 'register_policy' '0' ===== Etc ===== "wsl.exe" --distribution openSUSE-Tumbleweed --cd "\\wsl.localhost\openSUSE-Tumbleweed\srv\www\social" -- '/usr/bin/php' -c '/etc/php8/fpm/php-fpm.d/social.conf' '/srv/www/social/bin/console.php' config 'system' 'basepath' '/srv/www/social' "wsl.exe" --distribution openSUSE-Tumbleweed --cd "\\wsl.localhost\openSUSE-Tumbleweed\srv\www\social" -- '/usr/bin/php' -c '/etc/php8/fpm/php-fpm.d/social.conf' '/srv/www/social/bin/console.php' config 'config' 'info' 'https://wiki.realmofespionage.xyz/servers;windows;nginx;friendica' ====== Settings ====== ===== frio Theme ===== * Navigation bar background color: ''3d8bff'' * Navigation bar icon color: ''ffffff'' * Link color: ''3d8bff'' * Set the background color: ''dedede'' * Login page background color: ''484848'' * Copy or paste schemestring: {"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"} ===== local.config.php ===== * :!: Change database ''password'' and config ''admin_email'' su - su -m 'www' -c "ee '/usr/local/www/social/config/local.config.php'" [ 'hostname' => '127.0.0.1', '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' => '/srv/www/social', 'default_timezone' => 'America/New_York', 'language' => 'en', ], ]; // End ====== Backup ====== ===== Folder ===== * TODO: Might be faster doing the ''tar'' within WSL "tar.exe" -czf "%UserProfile%\Downloads\friendica-files-manual-%RANDOM%.tar.gz" -C "//wsl.localhost/openSUSE-Tumbleweed/srv/www" "social" ===== Database ===== **** "%ProgramFiles%\MariaDB 12.2\bin\mariadb-dump.exe" -u "root" --opt -r "%UserProfile%\Downloads\friendica.sql" "friendica" ====== Restore ====== ===== Remove Existing Files ===== **** DIR "%UserProfile%\Downloads\friendica"*".tar.gz" && "wsl.exe" --distribution openSUSE-Tumbleweed --cd "/tmp" --user root -- '/usr/bin/rm' -Rf '/srv/www/social' ===== Restore Files ===== **** "wsl.exe" --distribution openSUSE-Tumbleweed --cd "/tmp" --user root -- '/usr/bin/tar' -xzf '/mnt/c/Users/%UserName%/Downloads/friendica-files-'*'.tar.gz' -C '/srv/www' 'social' "wsl.exe" --distribution openSUSE-Tumbleweed --cd "/tmp" --user root -- '/usr/bin/chown' -R 'espionage724':'espionage724' '/srv/www/social' "wsl.exe" --distribution openSUSE-Tumbleweed --cd "/tmp" --user root -- '/usr/bin/chmod' -R '0770' '/srv/www/social' ===== Git Fix ===== * [[#git_fix|Git Fix.bat]] ===== Settings ===== * ''hostname'' is WSL virtual adapter ''IPv4 Address'' ipconfig "notepad.exe" "\\wsl.localhost\openSUSE-Tumbleweed\srv\www\social\config\local.config.php" 'database' => [ 'hostname' => 'x', 'config' => [ 'php_path' => '/usr/bin/php', 'system' => [ 'basepath' => '/srv/www/social', ===== Restore Database ===== * [[#database|Initial set-up]] "%ProgramFiles%\MariaDB 12.2\bin\mariadb.exe" -u "root" --execute="CREATE DATABASE friendica" "%ProgramFiles%\MariaDB 12.2\bin\mariadb.exe" -u "root" "friendica" < "%UserProfile%\Downloads\friendica.sql" ===== Etc ===== "wsl.exe" --distribution openSUSE-Tumbleweed --cd "\\wsl.localhost\openSUSE-Tumbleweed\srv\www\social" -- '/usr/bin/php' -c '/etc/php8/fpm/php-fpm.d/social.conf' '/srv/www/social/bin/console.php' worker "wsl.exe" --distribution openSUSE-Tumbleweed --cd "\\wsl.localhost\openSUSE-Tumbleweed\srv\www\social" -- '/usr/bin/php' -c '/etc/php8/fpm/php-fpm.d/social.conf' '/srv/www/social/bin/console.php' dbstructure update --force "wsl.exe" --distribution openSUSE-Tumbleweed --cd "\\wsl.localhost\openSUSE-Tumbleweed\srv\www\social" -- '/usr/bin/php' -c '/etc/php8/fpm/php-fpm.d/social.conf' '/srv/www/social/bin/console.php' dbstructure drop --execute "wsl.exe" --distribution openSUSE-Tumbleweed --cd "\\wsl.localhost\openSUSE-Tumbleweed\srv\www\social" -- '/usr/bin/php' -c '/etc/php8/fpm/php-fpm.d/social.conf' '/srv/www/social/bin/console.php' postupdate "wsl.exe" --distribution openSUSE-Tumbleweed --cd "\\wsl.localhost\openSUSE-Tumbleweed\srv\www\social" -- '/usr/bin/php' -c '/etc/php8/fpm/php-fpm.d/social.conf' '/srv/www/social/bin/console.php' cache clear "wsl.exe" --distribution openSUSE-Tumbleweed --cd "\\wsl.localhost\openSUSE-Tumbleweed\srv\www\social" -- '/usr/bin/php' -c '/etc/php8/fpm/php-fpm.d/social.conf' '/srv/www/social/bin/console.php' clearavatarcache