====== Information ======
* Friendica ((https://friendi.ca/))
* [[Information:Realm of Espionage]]
* https://social.realmofespionage.xyz
* :!: 2025/10/13: WIP ((works; //slowly//))
===== Prerequisites =====
* [[windows;11_ltsc_server|Windows 11 (24H2)]]
* [[servers;windows;nginx_php_php-cgi|nginx]]
* [[servers;windows;nginx;lets_encrypt|Certbot (Let's Encrypt)]]
* [[programs;windows;git|Git]]
* [[servers;windows;mariadb|MariaDB]]
==== WSL ====
* [[windows;notes;wsl|WSL]]
* [[windows;opensuse_tumbleweed_wsl|openSUSE Tumbleweed]]
* [[servers;windows;php_php-fpm_wsl|PHP + PHP-FPM]]
====== Dependencies ======
* https://friendi.ca/resources/requirements/
* https://wiki.friendi.ca/docs/install#requirements
* 2025/10/13: ''php-posix'' is required ((no known alternative on Windows, hence WSL))
"wsl.exe" --distribution openSUSE-Tumbleweed --user root -- zypper install --no-confirm php-composer2 php8-curl php8-fileinfo php-gd php8-gmp php8-pdo php8-mbstring php8-intl php8-mysql php8-zip php8-openssl php8-posix php8-opcache
====== Download Source ======
* https://github.com/friendica/friendica/commits/develop/
"%ProgramFiles%\Git\bin\git.exe" clone --branch "develop" --depth "1" --recurse-submodules "https://github.com/friendica/friendica.git" "%SystemDrive%\www\social"
===== Addons =====
* https://github.com/friendica/friendica-addons/commits/develop/
"%ProgramFiles%\Git\bin\git.exe" clone --branch "develop" --depth "1" --recurse-submodules "https://github.com/friendica/friendica-addons.git" "%SystemDrive%\www\social\addon"
====== Database ======
* :!: TODO: Limit ''%'' to WSL ((WSL ''php'' is blocked from ''localhost''))
"%ProgramFiles%\MariaDB 12.1\bin\mariadb.exe" -u "root" -p
CREATE DATABASE friendica;
CREATE USER 'friendica'@'%' IDENTIFIED BY 'x';
GRANT ALL PRIVILEGES ON friendica.* to 'friendica'@'%';
FLUSH PRIVILEGES;
EXIT
====== Environment ======
===== PHP =====
"wsl.exe" --distribution openSUSE-Tumbleweed --user root -- nano '/etc/php8/fpm/php-fpm.d/social.conf'
[social]
; 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"
; openSUSE php.ini Defaults
php_value[session.save_path] = "/var/lib/php8/sessions"
; General
php_value[log_errors] = "0"
php_value[error_reporting] = "~E_ALL"
;php_value[display_errors] = "On"
php_value[date.timezone] = "America/New_York"
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 -- '/usr/bin/composer' --working-dir='/mnt/c/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" /mnt/c/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 "C:/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
START "Social PHP-FPM" "wsl.exe" --distribution openSUSE-Tumbleweed -- '/usr/sbin/php-fpm' -c '/etc/php8/fpm/php-fpm.d/social.conf' -F
:: End
"%SystemDrive%\www\scripts\social\PHP-FPM.bat"
===== Update =====
"notepad.exe" "%SystemDrive%\www\scripts\media\Update.bat"
@echo off
:: Piwigo
"%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\media" pull origin "master"
:: Bootstrap Darkroom
"%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\media\themes\bootstrap_darkroom" pull origin "master"
:: End
"%SystemDrive%\www\scripts\media\Update.bat"
===== Back-up =====
* TODO
"notepad.exe" "%SystemDrive%\www\scripts\media\Back-up.bat"
@echo off
:: User\Downloads
"tar.exe" -czf "%UserProfile%\Downloads\dokuwiki-files-auto-%RANDOM%.tar.gz" -C "%SystemDrive%\www\wiki" "data/pages" "data/meta" "data/media" "data/media_meta" "data/attic" "data/media_attic" "conf"
:: NAS
::"tar.exe" -czf "D:\Servers\Scheduled Backups\dokuwiki-files-auto-%RANDOM%.tar.gz" -C "%SystemDrive%\www\wiki" "data/pages" "data/meta" "data/media" "data/media_meta" "data/attic" "data/media_attic" "conf"
:: End
"%SystemDrive%\www\scripts\media\Back-up.bat"
===== Maintenance =====
"notepad.exe" "%SystemDrive%\www\scripts\media\Maintenance.bat"
@echo off
:: Piwigo
"%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\media" reset --hard
"%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\media" gc --aggressive --prune="all"
"%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\media" fsck --full --strict
:: Bootstrap Darkroom
"%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\media\themes\bootstrap_darkroom" reset --hard
"%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\media\themes\bootstrap_darkroom" gc --aggressive --prune="all"
"%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\media\themes\bootstrap_darkroom" fsck --full --strict
:: End
"%SystemDrive%\www\scripts\media\Maintenance.bat"
===== Git Fix =====
* :!: Set email for both ''user.email''
"notepad.exe" "%SystemDrive%\www\scripts\social\Git Fix.bat"
@echo off
:: Friendica
RMDIR /S /Q "%SystemDrive%\www\social\.git"
"%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\social" init --initial-branch="develop"
"%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\social" add "."
"%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\social" config "user.email" "espionage724@x"
"%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\social" commit --message="x"
"%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\social" remote add "origin" "https://github.com/friendica/friendica.git"
"%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\social" pull --depth "1" --recurse-submodules "origin" "develop" --rebase
"%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\social" reset --hard "origin/develop"
"%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\social" gc --aggressive --prune="all"
"%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\social" fsck --full --strict
:: Addons
RMDIR /S /Q "%SystemDrive%\www\social\addon\.git"
"%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\social\addon" init --initial-branch="develop"
"%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\social\addon" add "."
"%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\social\addon" config "user.email" "espionage724@x"
"%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\social\addon" commit --message="x"
"%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\social\addon" remote add "origin" "https://github.com/friendica/friendica-addons.git"
"%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\social\addon" pull --depth "1" --recurse-submodules "origin" "develop" --rebase
"%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\social\addon" reset --hard "origin/develop"
"%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\social\addon" gc --aggressive --prune="all"
"%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\social\addon" fsck --full --strict
PAUSE
:: End
"%SystemDrive%\www\scripts\social\Git Fix.bat"
====== Initial Setup ======
* TODO
====== Settings ======
* ''x'' is WSL IP shown on host
ipconfig
"notepad.exe" "%SystemDrive%\www\social\config\local.config.php"
'database' => [
'hostname' => 'x',
'system' => [
'basepath' => '/mnt/c/www/social',
====== Files ======
===== Backup =====
****
"tar.exe" -czf "%UserProfile%\Downloads\friendica-files-manual-%RANDOM%.tar.gz" -C "%SystemDrive%\www" "social"
====== Database ======
===== Backup =====
****
CD "%UserProfile%\Downloads" && "%ProgramFiles%\MariaDB 12.1\bin\mariadb-dump.exe" -u "root" -p --opt -r "friendica.sql" "friendica"
===== Restore =====
* [[#database|Initial set-up]]
"%ProgramFiles%\MariaDB 12.1\bin\mariadb.exe" -u "root" -p --execute="CREATE DATABASE friendica"
"%ProgramFiles%\MariaDB 12.1\bin\mariadb.exe" -u "root" -p "friendica" < "%UserProfile%\Downloads\friendica.sql"
====== TODO ======
"wsl.exe" --distribution openSUSE-Tumbleweed -- '/usr/sbin/php-fpm' -c '/etc/php8/fpm/php-fpm.d/social.conf' -F
"wsl.exe" --distribution openSUSE-Tumbleweed -- '/usr/bin/php' '/mnt/c/www/social/bin/console.php' worker
"wsl.exe" --distribution openSUSE-Tumbleweed -- '/usr/bin/composer' --working-dir='/mnt/c/www/social' --no-cache install --no-dev