| Both sides previous revisionPrevious revisionNext revision | Previous revision |
| servers:windows:nginx:friendica [2025/11/20 22:53] – [PHP] Sean Rhone | servers:windows:nginx:friendica [2025/11/29 01:08] (current) – Sean Rhone |
|---|
| * [[Information:Realm of Espionage]] | * [[Information:Realm of Espionage]] |
| * https://social.realmofespionage.xyz | * https://social.realmofespionage.xyz |
| |
| * :!: 2025/10/13: WIP ((works; //slowly//)) | |
| |
| ===== Prerequisites ===== | ===== Prerequisites ===== |
| |
| * [[windows;11_ltsc_server|Windows 11 (24H2)]] | * [[windows;10|Windows 10 (21H2)]] |
| * [[servers;windows;nginx_php_php-cgi|nginx]] | * [[servers;windows;nginx_php_php-cgi|nginx]] |
| * [[servers;windows;nginx;lets_encrypt|Certbot (Let's Encrypt)]] | * [[servers;windows;nginx;lets_encrypt|Certbot (Let's Encrypt)]] |
| * https://friendi.ca/resources/requirements/ | * https://friendi.ca/resources/requirements/ |
| * https://wiki.friendi.ca/docs/install#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 | "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 |
| ===== PHP ===== | ===== PHP ===== |
| |
| "wsl.exe" --distribution openSUSE-Tumbleweed --user root -- nano '/etc/php8/fpm/php-fpm.d/social.conf' | "wsl.exe" --distribution openSUSE-Tumbleweed --user root -- '/usr/bin/nano' '/etc/php8/fpm/php-fpm.d/social.conf' |
| |
| <code> | <code> |
| [social] | [social] |
| | listen = "127.0.0.1:9005" |
| |
| ; User/Group | |
| user = "espionage724" | user = "espionage724" |
| group = "espionage724" | group = "espionage724" |
| |
| ; Socket | |
| listen = "127.0.0.1:9005" | |
| listen.allowed_clients = "127.0.0.1" | listen.allowed_clients = "127.0.0.1" |
| |
| ; Process Management | |
| pm = "ondemand" | pm = "ondemand" |
| pm.max_children = "8" | pm.max_children = "8" |
| pm.process_idle_timeout = "30" | 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[error_reporting] = "~E_ALL" |
| ;php_value[display_errors] = "On" | php_value[display_errors] = "Off" |
| | php_value[log_errors] = "Off" |
| php_value[date.timezone] = "America/New_York" | php_value[date.timezone] = "America/New_York" |
| php_value[max_execution_time] = "200" | php_value[max_execution_time] = "200" |
| php_value[max_file_uploads] = "100" | php_value[max_file_uploads] = "100" |
| php_value[register_argc_argv] = "On" | php_value[register_argc_argv] = "On" |
| | php_value[session.save_path] = "/var/lib/php8/sessions" |
| |
| ; End</code> | ; End</code> |
| @echo off | @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 | START "Social PHP-FPM" /MIN "wsl.exe" --distribution openSUSE-Tumbleweed --user root -- '/usr/sbin/php-fpm' -c '/etc/php8/fpm/php-fpm.d/social.conf' -F |
| |
| :: End</code> | :: End</code> |
| |
| "%SystemDrive%\www\scripts\social\PHP-FPM.bat" | "%SystemDrive%\www\scripts\social\PHP-FPM.bat" |
| | |
| | ===== Worker ===== |
| | |
| | "notepad.exe" "%SystemDrive%\www\scripts\social\Worker.bat" |
| | |
| | <code> |
| | @echo off |
| | |
| | TITLE Social Worker |
| | |
| | "wsl.exe" --distribution openSUSE-Tumbleweed --cd "/mnt/c/www/social" -- '/usr/bin/php' '/mnt/c/www/social/bin/console.php' worker |
| | |
| | :: End</code> |
| | |
| | "%SystemDrive%\www\scripts\social\Worker.bat" |
| |
| ===== Update ===== | ===== Update ===== |
| |
| "notepad.exe" "%SystemDrive%\www\scripts\media\Update.bat" | "notepad.exe" "%SystemDrive%\www\scripts\social\Update.bat" |
| |
| <code> | <code> |
| @echo off | @echo off |
| |
| :: Piwigo | TITLE Social Updater |
| "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\media" pull origin "master" | |
| |
| :: Bootstrap Darkroom | "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\social" reset --hard "origin/develop" |
| "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\media\themes\bootstrap_darkroom" pull origin "master" | "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\social" pull 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" pull origin "develop" --rebase |
| | |
| | "wsl.exe" --distribution openSUSE-Tumbleweed -- '/usr/bin/composer' --working-dir='/mnt/c/www/social' --no-cache install --no-dev |
| | |
| | "wsl.exe" --distribution openSUSE-Tumbleweed --cd "/mnt/c/www/social" -- '/usr/bin/php' '/mnt/c/www/social/bin/console.php' worker |
| | |
| | "wsl.exe" --distribution openSUSE-Tumbleweed --cd "/mnt/c/www/social" -- '/usr/bin/php' '/mnt/c/www/social/bin/console.php' dbstructure update --force |
| | "wsl.exe" --distribution openSUSE-Tumbleweed --cd "/mnt/c/www/social" -- '/usr/bin/php' '/mnt/c/www/social/bin/console.php' dbstructure drop --execute |
| | "wsl.exe" --distribution openSUSE-Tumbleweed --cd "/mnt/c/www/social" -- '/usr/bin/php' '/mnt/c/www/social/bin/console.php' postupdate |
| |
| :: End</code> | :: End</code> |
| |
| "%SystemDrive%\www\scripts\media\Update.bat" | "%SystemDrive%\www\scripts\social\Update.bat" |
| |
| ===== Back-up ===== | ===== Back-up ===== |
| |
| * TODO | * ''D:\Servers\Scheduled Backups'' |
| |
| "notepad.exe" "%SystemDrive%\www\scripts\media\Back-up.bat" | "notepad.exe" "%SystemDrive%\www\scripts\social\Back-up.bat" |
| |
| <code> | <code> |
| @echo off | @echo off |
| | |
| | TITLE Social Back-up |
| |
| :: User\Downloads | :: 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" | ::"tar.exe" -czf "%UserProfile%\Downloads\friendica-files-auto-%RANDOM%.tar.gz" -C "%SystemDrive%\www" "social" |
| | ::"%ProgramFiles%\MariaDB 12.2\bin\mariadb-dump.exe" -u "root" --opt -r "%UserProfile%\Downloads\%RANDOM%-friendica.sql" "friendica" |
| |
| :: NAS | :: 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" | "tar.exe" -czf "D:\Servers\Scheduled Backups\friendica-files-auto-%RANDOM%.tar.gz" -C "%SystemDrive%\www" "social" |
| | "%ProgramFiles%\MariaDB 12.2\bin\mariadb-dump.exe" -u "root" --opt -r "D:\Servers\Scheduled Backups\%RANDOM%-friendica.sql" "friendica" |
| |
| :: End</code> | :: End</code> |
| |
| "%SystemDrive%\www\scripts\media\Back-up.bat" | "%SystemDrive%\www\scripts\social\Back-up.bat" |
| |
| ===== Maintenance ===== | ===== Maintenance ===== |
| |
| "notepad.exe" "%SystemDrive%\www\scripts\media\Maintenance.bat" | "notepad.exe" "%SystemDrive%\www\scripts\social\Maintenance.bat" |
| |
| <code> | <code> |
| @echo off | @echo off |
| |
| :: Piwigo | TITLE Social Maintenance |
| "%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 | CALL "%SystemDrive%\www\scripts\social\Git Fix.bat" |
| "%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" | "wsl.exe" --distribution openSUSE-Tumbleweed --cd "/mnt/c/www/social" -- '/usr/bin/php' '/mnt/c/www/social/bin/console.php' cache clear |
| "%ProgramFiles%\Git\bin\git.exe" -C "%SystemDrive%\www\media\themes\bootstrap_darkroom" fsck --full --strict | "wsl.exe" --distribution openSUSE-Tumbleweed --cd "/mnt/c/www/social" -- '/usr/bin/php' '/mnt/c/www/social/bin/console.php' clearavatarcache |
| |
| :: End</code> | :: End</code> |
| |
| "%SystemDrive%\www\scripts\media\Maintenance.bat" | "%SystemDrive%\www\scripts\social\Maintenance.bat" |
| |
| ===== Git Fix ===== | ===== Git Fix ===== |
| <code> | <code> |
| @echo off | @echo off |
| | |
| | TITLE Social Git Fix |
| |
| RMDIR /S /Q "%SystemDrive%\www\social\.git" | RMDIR /S /Q "%SystemDrive%\www\social\.git" |
| |
| "%SystemDrive%\www\scripts\social\Git Fix.bat" | "%SystemDrive%\www\scripts\social\Git Fix.bat" |
| | |
| | ====== Shortcuts ====== |
| | |
| | ===== Autostart ===== |
| | |
| | ==== PHP-FPM ==== |
| | |
| | "explorer.exe" "%AppData%\Microsoft\Windows\Start Menu\Programs\StartUp" |
| | |
| | "%SystemDrive%\www\scripts\social\PHP-FPM.bat" |
| | |
| | Social PHP-FPM |
| | |
| | ====== Task Scheduler ====== |
| | |
| | **** |
| | |
| | taskschd.msc |
| | |
| | ===== Worker ===== |
| | |
| | * TODO: On-login, every 15 minutes |
| | |
| | Social Worker |
| | |
| | "%SystemDrive%\www\scripts\social\Worker.bat" |
| | |
| | ===== Update ===== |
| | |
| | * ''4:00:00 AM'' daily |
| | |
| | Social Update |
| | |
| | "%SystemDrive%\www\scripts\social\Update.bat" |
| | |
| | ===== Back-up ===== |
| | |
| | * Monthly -> All months -> Days: ''5'' |
| | * ''4:15:00 AM'' |
| | |
| | Social Back-up |
| | |
| | "%SystemDrive%\www\scripts\social\Back-up.bat" |
| | |
| | ===== Maintenance ===== |
| | |
| | * Monthly -> All months -> Days: ''5'' |
| | * ''4:30:00 AM'' |
| | |
| | Social Maintenance |
| | |
| | "%SystemDrive%\www\scripts\social\Maintenance.bat" |
| | |
| | ====== Service ====== |
| | |
| | ===== Worker ===== |
| | |
| | ==== Service ==== |
| | |
| | "wsl.exe" --distribution openSUSE-Tumbleweed --user root -- '/usr/bin/nano' '/etc/systemd/system/social-d.service' |
| | |
| | <code> |
| | [Service] |
| | User=espionage724 |
| | Group=espionage724 |
| | Type=oneshot |
| | |
| | WorkingDirectory=/mnt/c/www/social |
| | |
| | ExecStart='/usr/bin/php' '/mnt/c/www/social/bin/console.php' worker |
| | |
| | ExecStartPost='/usr/bin/sync' |
| | |
| | # End</code> |
| | |
| | ==== Timer ==== |
| | |
| | * Every 10 minutes (([[https://wiki.friendi.ca/docs/install#required_background_tasks|info]])) |
| | |
| | "wsl.exe" --distribution openSUSE-Tumbleweed --user root -- '/usr/bin/nano' '/etc/systemd/system/social-d.timer' && "wsl.exe" --distribution openSUSE-Tumbleweed --user root -- '/usr/bin/systemctl' daemon-reload && "wsl.exe" --distribution openSUSE-Tumbleweed --user root -- '/usr/bin/systemctl' enable 'social-d.timer' --now && "wsl.exe" --distribution openSUSE-Tumbleweed --user root -- '/usr/bin/systemctl' start 'social-d' && "wsl.exe" --distribution openSUSE-Tumbleweed -- '/usr/bin/systemctl' status 'social-d' -l |
| | |
| | <code> |
| | [Unit] |
| | Description=Friendica Worker Daemon |
| | After=network-online.target |
| | Wants=network-online.target |
| | |
| | [Timer] |
| | OnBootSec=10m |
| | OnUnitActiveSec=10m |
| | |
| | [Install] |
| | WantedBy=timers.target |
| | |
| | # End</code> |
| |
| ====== Initial Setup ====== | ====== Initial Setup ====== |
| ====== Settings ====== | ====== Settings ====== |
| |
| * ''x'' is WSL IP shown on host | * ''x'' is WSL virtual adapter ''IPv4 Address'' |
| |
| ipconfig | ipconfig |