Docs
GuidesInstallation

Separate database server

Run the web server and the MariaDB database on two different machines.

By default the installer puts the web server and the database on the same machine (MODE=all). You can split them across two servers, for example to separate the load or because the database already lives elsewhere. Install each server on its own, choosing its mode.

MODEWhat it installs on THAT server
all (default)Web server + PHP + MariaDB, all together.
webOnly the web server + PHP + the application; it connects to a remote database (DB_HOST). MariaDB is not installed.
dbOnly MariaDB open to the network (bound to 0.0.0.0, port 3306) plus the database and user. No web server and no code.

If you do not set MODE, the installer asks (all in one / web only / database only).

Example

In this example the database server is 10.0.0.5 and the web server is 10.0.0.4. Install them in this order.

Database server

On 10.0.0.5, authorizing only the web server:

curl -fsSL https://3r.com.pa/hwdpos_inst/bootstrap.sh | sudo MODE=db DB_ALLOW=10.0.0.4 bash

DB_ALLOW is the IP of the authorized web server. If you omit it, any IP is allowed (%).

The installer sets bind-address, opens port 3306 in the firewall (only from DB_ALLOW if you set it), creates the database and the user, and at the end prints the host, database, user and password. Write them down. They are also saved in /root/HWDPOS-DB-CREDENTIALS.txt, because a database-only server has no application folder.

Web server

On 10.0.0.4, pointing to the database server:

curl -fsSL https://3r.com.pa/hwdpos_inst/bootstrap.sh | sudo MODE=web DB_HOST=10.0.0.5 bash

MariaDB is not installed here. The installer installs the database client for diagnostics and tests the connection to DB_HOST:3306.

Setup wizard

Open http://10.0.0.4/install. In the Database step, set Host to the database server's IP (10.0.0.5, not 127.0.0.1), and use the user and password from step 1. See Setup wizard.

If you run the installer scripts directly instead of through the network command, the same variables apply:

sudo MODE=db DB_ALLOW=10.0.0.4 bash install-ubuntu.sh
sudo MODE=web DB_HOST=10.0.0.5 HWPOS_ZIP=/root/HWDPOS.zip bash bootstrap.sh

Security

Expose port 3306 only to the web server's IP (DB_ALLOW), never to the internet. Ideally both servers are on the same private LAN or VLAN.

Tips

  • Accept the time zone question on the database server too, so timestamps match.
  • Use WITH_PRINTING=no on the database server: it does not print.
  • check.sh detects the mode automatically. On a web-only server it does not flag the missing local MariaDB and tests the remote database with DB_HOST=<ip>; on a database-only server it checks MariaDB and that it listens on port 3306. You can force it with MODE=web|db|all. See check.sh diagnostics.

On this page