Simple Online Automated Provisioning
Simply put, SOAP automates PXE network booting and OS installation.
With SOAP, you can submit the network information (IP & MAC address etc.), select a boot template on an online form and then the Dnsmasq server (for DHCP & TFTP) will be configured automatically.
Architecture & Requirements
- PHP 8.0 (apcu & amqp extension required)
- MariaDB/MySQL (only for the web server)
- NGINX (or other web server integrates with PHP)
- Dnsmasq (can be deployed separately)
- RabbitMQ (for communication between web and Dnsmasq server)
Installation
We prepared an installation script for Debian stable and Ubuntu LTS.
You be asked for the server's IP address, and web domain.
# Use --full for single server: install both web and Dnsmasq
sudo ./install.sh --full
# Separate web and Dnsmasq servers
# Use --web-only for the web server
sudo ./install.sh --web-only
# After it finished, a command for Dnsmasq server installation
# will be generated, like this:
sudo ./install.sh --dnsmasq-only --dnsmasq-server ... --mq-server ... --mq-user ... --mq-pass ... --mq-vhost ...
MariaDB and RabbitMQ credentials will be printed out after the installation.
The script only configures HTTP access, you have to upload the certificate and configure HTTPS in /etc/nginx/conf.d/soap-web.conf
. Please refer to the comments in the config file.
Other information for script installations
- Web user for PHP and NGINX:
www-data
- SOAP application dir:
/srv/soap
- Dnsmasq DHCP hosts config dir:
/srv/dnsmasq/dhcp/hosts
- Dnsmasq DHCP options config dir:
/srv/dnsmasq/dhcp/opts
Boot Template
Boot template consists of an iPXE script and an install config (which is "preseed" for Debian and "Kickstart" for the Red Hat family).
The template is rendered by Twig, whose documentation can be found here.
You can get the variable with {{ name }}
syntax. Here's a list of variables you can use in the template.
preseed_url
: install config URL (HTTP access)host.macAddress
host.ipAddress
host.prefix
CIDR prefixhost.netmask
IPv4 netmaskhost.gateway
host.hostname
host.dns
array of DNS servers. You can join it into string e.g. with space{{ host.dns|join(' ') }}
host.rootPassword
Plaintext root password
API reference
All JSON. Base URL is /api/v1
GET /api/v1/bootTemplate
List Boot Templates: Response:
{
"unique_id": "template_name"
}
POST /api/v1/host
Create Host: Request
- string
macAddress
, required - string
ipAddress
, required - int
prefix
, CIDR subnet prefix, default24
- string
gateway
, required - array
dns
, default['185.222.222.222', '45.11.45.11']
, - string
ipxeScript
, custom iPXE script (Twig template), optional - string
preseed
, custom install config (Twig template), optional - string
bootTemplate
, unique ID of boot template, optional - int
expiresAfter
, one of1, 3600, 86400, 604800, 2592000
, which means single use, 1 hour, 1 day... - string
rootPassword
, auto-generated if not provided
Response
- string
id
, unique ID - string
rootPassword
, auto-generated password
GET /api/v1/host/<id>
Get Host Detail: POST /api/v1/host/<id>
Update Host Detail: Request and response are same as creation.
However, IP and MAC address can't be updated once created. Instead, delete it and create a new one.
POST /api/v1/host/<id>
Delete Host: Host will NOT be deleted instantly. The database record will be deleted once the Dnsmasq config files for it are deleted.
CLI Commands
- Create User:
bin/console app:create-user <username> <password>
- Insert/update boot templates from
boot_templates
dir:bin/console app:import-boot-templates
- Clear finished operation logs:
bin/console app:clear-operations
Env Vars
Configuration variables is stored in .env
file. Copy the .env.dist
to .env.local
and edit it.
For production use, run composer dump-env prod
to compile .env files.
APP_ENV
:prod
for production,dev
for development which enables debug barAPP_SECRET
: any long random stringTRUSTED_PROXIES
: IP address or CIDR range. Trustx-forwarded-for
for the origin.APP_DHCP_SERVER
: DHCP server IP address to display on the form.DATABASE_URL
: Database URI. Version has to be set even for the Dnsmasq server (which does not access any DB):mysql://localhost/?serverVersion=mariadb-10.6.4
MESSENGER_TRANSPORT_DSN
: AMQP URIDNSMASQ_DHCP_HOSTS_DIR
: required for Dnsmasq serverDNSMASQ_DHCP_OPTIONS_DIR
: required for Dnsmasq server
Configuration tips
Dnsmasq reload command
By default it's sudo systemctl reload dnsmasq
.
sudoers
is auto configured by the installation script (please refer to install_dnsmasq
function).
It's configurable in:
config/service.yaml
services > process_command.dnsmasq_reload > arguments > $command
APCu cache
By default it's enabled in prod
environment. It's configurable in:
config/packages/prod/cache.yaml
framework > cache > app
Comment out the line to use filesystem cache.