AgriQL · Documentation · Server

Run an AgriQL server

A server lets other machines send queries to one AgriQL installation. Install the Linux command first, then run it as a service under its own user. Keep it on a private network. This page does not put AgriQL on the public internet.

Complete the Linux installation so /usr/local/bin/agriql exists before you create the service.

1. Create a system user

sudo useradd --system --create-home --home-dir /var/lib/agriql agriql
sudo -u agriql env AGRIQL_HOME=/var/lib/agriql agriql init

Configuration is /var/lib/agriql/config. Data, including .aqdb files, is /var/lib/agriql/data.

2. Check the settings

sudo -u agriql env AGRIQL_HOME=/var/lib/agriql agriql server check --host 0.0.0.0 --port 5471

The check prints the host and port. It does not stay running.

3. Install the service

Save this as /etc/systemd/system/agriql.service.

[Unit]
Description=AgriQL database
After=network.target

[Service]
User=agriql
Group=agriql
Environment=AGRIQL_HOME=/var/lib/agriql
ExecStart=/usr/local/bin/agriql server start --host 0.0.0.0 --port 5471
Restart=on-failure

[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable --now agriql
sudo systemctl status agriql

4. Confirm it is listening

sudo -u agriql env AGRIQL_HOME=/var/lib/agriql agriql server status

Clients on the same private network use agriql://:5471/farm after the database exists. A web browser cannot open that address.

5. Create the database

sudo -u agriql env AGRIQL_HOME=/var/lib/agriql agriql database create farm

Then follow getting started with AGRIQL_HOME set, or connect from Python.

Stop and restart

sudo systemctl stop agriql
sudo systemctl restart agriql

Stopping the service does not delete /var/lib/agriql.

A note on exposure

Port 5471 should be reachable only from the network you trust. Do not forward it from a public router as part of this installation. If the server must face a wider network, put it behind the access control your organisation already uses.