Advanced Deployments



Manual installation - Ubuntu, Debian, Raspian

Warning those are advanced installation steps

Requires php >= 8.2

Install prerequisites

sudo apt install apache2 php libapache2-mod-php php-sqlite3 php-gmp php-curl php-xml php-zip php-mbstring wget curl 
  • For Rasbian follow these steps: Installing php 8.2

*** Steps ***

  • Activate rewrite mod. Important! - security sudo a2enmod rewrite

  • Download and unzip bundle into proper location. In this example /var/www/serveronet will be used.

  • wget -O serveronet_server_bundle.zip https://sncentral.localhost/serveronet_server_bundle.zip

  • sudo unzip serveronet_server_bundle.zip -d /var/www/serveronet

  • Correct permissions

  • cd /var/www/serveronet

  • sudo chown -R www-data:www-data ./

  • sudo chmod 755 -R ./

Edit configuration file /etc/apache2/sites-available/000-default.conf
sudo nano /etc/apache2/sites-available/000-default.conf

Option 1: Deploy to a subdirectory i.e. http://localhost/serveronet
paste values as below at the end of the file:

DocumentRoot /var/www/serveronet/public
Alias /serveronet /var/www/serveronet/public
<Directory /var/www/serveronet/public>
    AllowOverride All
    Require all granted
</Directory>

or
Option 2: Deploy as an app on main address http://localhost/
replace line with DocumentRoot with

DocumentRoot /var/www/serveronet/public
<Directory /var/www/serveronet/public>
    AllowOverride All
    Require all granted
</Directory>

Deploy relavant configuration for the HTTPS version - not covered by this documentation.
- Reload web server configuration

sudo systemctl restart apache2

= As Tor hidden service Follow manual instalation steps and apply these adjustments

Get onion address from

  • In /etc/tor/torrc adjust to additional port HiddenServicePort 80 127.0.0.1:80

  • Add VirtualHost to enabled site <VirtualHost *:8080> DocumentRoot /var/www/torwww/public <Directory /var/www/torwww/public> AllowOverride All Require all granted </Directory> </VirtualHost>

  • Restart Tor and Apache sudo systemctl restart apache2 sudo systemctl restart tor

Reference:

https://community.torproject.org/onion-services/setup/

= Termux deployment - not possible - php mod not available Steps tbd https://getcomposer.org/download/ https://www.freecodecamp.org/news/how-to-setup-laravel-8-on-android-phone/ Termux requires uncomment module and allowoverride

= Termux Test client deployment - Only for testing - artisan server deployment This is for testing and development only. Such Server is single threaded and will block on any long task. https://getcomposer.org/download/ https://www.freecodecamp.org/news/how-to-setup-laravel-8-on-android-phone/ Termux requires uncomment module and allowoverride php artisan serve --no-reload

= Publish new version //Update procedure //Bump version in H //upload_version.sh //On clients route update_client


Fedora client modifications

disable mod_perl

Building Windows Client from scratch

  • enable socks extension in php ini - TODO review

  • Install Visual C++ Redistributable https://aka.ms/vs/17/release/vc_redist.x64.exe

  • Download Xampp Portable 8.2.4 for Windows from https://www.apachefriends.org/ (xampp-portable-windows-x64-8.2.4-0-VS16.zip)

  • Unzip to xampp folder

  • Run setup_xampp.bat

  • Place Serveronet_Start.bat in the root of unziped directory, where htdocs was unzipped. From https://github.com/Serveronet/utils

  • Download server bundle from sncentral.localhost -- TODO Settle

  • Unzip to htdocs directory

  • Add SN client version file sn-client-version.json into htdocs directory with content: { "version": "8.2.4", "platform": "linux" }

  • Go to apache/conf and edit httpd.conf

    • Edit line with Define SRVROOT to Define SRVROOT "${APACHE_ROOT}"
    • Remove line with ServerRoot
    • Edit line with Listen to Listen 15080 (default client port)
    • Edit lines with
      • DocumentRoot "/xampp/htdocs" to DocumentRoot "${SRVROOT}/htdocs/serveronet/public"
      • <Directory "/xampp/htdocs"> to <Directory "${SRVROOT}/htdocs/serveronet/public">
  • Edit httpd-ssl.conf

    • replace all /Users/aser/Downloads/xampp with ..
    • Edit line with Listen to Listen 15443 (default client port)
    • Edit line with <VirtualHost default:443> to <VirtualHost default:15443>
    • Edit line with DocumentRoot to DocumentRoot "${SRVROOT}/htdocs/serveronet/public"
  • Edit "httpd-xampp.conf" in conf/extra/

  • Delete httpd-xampp.conf - TODO Verify

    • replace all /Users/aser/Downloads/xampp with ..
  • Edit "/httpd-ssl.conf" in conf/extra

    • replace all /Users/aser/Downloads/xampp with .. (2 x dot)
  • Go to php subfolder and edit php.ini file -

    • remove ; in line with ;extension=gmp
    • remove ; in line with ;extension=zip
    • remove ; in line with ;extension=sockets
    • remove ; in line with ;extension=sqlite3
    • remove ; in line with ;extension=intl
    • replace all \Users\aser\Downloads\xampp with . (1 x dot)
    • Set error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
  • TODO find and hide Deprecation errors in config

  • Clean up - delete subdirectories

    • delete mysql
    • delete php/windowsXamppPhp
    • delete htdocs/dashboard
    • delete perl
    • delete phpMyAdmin
    • delete tomcat
    • delete not needed files from root directory

Building Linux Client from scratch

  1. Download frankenphp-linux-x86_64 from - Frankenphp Releases

    • or frankenphp-linux-aarch64 for Android Termux
  2. Download caddy file and save as Caddyfile from -> Sn Clients github

    • Caddyfile-linux-x86_64
    • for Android Termux Caddyfile-linux-aarch64
  3. Download Start_Serveronet.sh, Stop_Serveronet.sh [Sn Clients github](https://github.com/Serveronet/Serveronet-Clients

  4. Download tor-browser_en-US Tor Browser

  5. Download SN Server bundle Sn Server Bundle

Building Macos Client from scratch

  • Download and install Xampp 8.2.4 for Mac from https://www.apachefriends.org/
  • Place php_gmp.so
  • Enable extension
  • TODO adjust path and ports - continue
  • Adjust post_max_size and upload_max_filesize to min 8MB - TODO

Installing php 8.2 (Required for Raspbian) - Verified Apr 2023 with Raspbian 32bit

sudo wget -qO /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
sudo echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php.list
sudo apt update
sudo apt install php8.2 php8.2-common php8.2-cli php8.2-sqlite3 php8.2-gmp php8.2-curl php8.2-xml php8.2-dom php8.2-zip php8.2-mbstring php8.2-mysql
sudo a2dismod php7.4
sudo a2enmod php8.2
sudo apachectl restart

Ref https://lindevs.com/install-php-on-raspberry-pi

IPFS on Raspbian

Follow these steps:

https://docs.ipfs.tech/install/command-line/#install-official-binary-distributions

then

https://github.com/ipfs/kubo#install

ipfs init

ipfs daemon

Running composer on Windows client

PS C:\Users\username> cd C:\Users\username\Desktop\xampp PS C:\Users\username\Desktop\xampp> php/php.exe composer.phar -d .\htdocs\serveronet\ update

Running artisan on Windows client

cd C:\Users\username\Desktop\xampp php/php.exe composer.phar -d .\htdocs\serveronet\ update .\php\php.exe C:\Users\username\Desktop\xampp\htdocs\serveronet\artisan config:clear

Tor

Tor port: Defaults: 9050 (PC and Orbot), for Tor Desktop Browser: 9150

Manual Docker installation - Ubuntu, Debian, Raspian

Warning those are advanced installation steps

https://docs.docker.com/engine/install/raspberry-pi-os/ https://laravel.com/docs/10.x/sail#introduction

TODO Move to proper place

Add TXT record with snetdnslink as host (snetdnslink.example.com) with value snetdnslink with site ID, for example: snetdnslink=gjdg45... Serveronet client will check snetdnslink.example.com for Site ID of example.com Reference for Namecheap: https://www.namecheap.com/support/knowledgebase/article.aspx/9776/2237/how-to-create-a-subdomain-for-my-domain/#ip

You can check if configuration is correct with dig (Linux) dig snetdnslink.example.com -t TXT ;; ANSWER SECTION: snetdnslink.example.com. 3600 IN TXT "snetdnslink=gjdg45..."


Information

Lorem ipsum, dolor sit amet consectetur adipisicing elit.