Using Load Balancers
After creating a load-balancer, you can configure load balancer services on boxes, which will instruct the load-balancer to expose the box via a domain and path prefix.
Create a Load Balancer Service
Use the following command to expose a box via a load balancer:
dboxed box add-lb-service <box-name> --load-balancer=<lb-name> --hostname=<hostname> --port=<port> --path-prefix=<path-prefix>The <port> specified in this command must be exposed to the sandbox network, which can be done via standard
docker compose ports inside the compose service
definition.
The <hostname> is the hostname you want to expose the box to. You must set up DNS for this hostname outside Dboxed
until Dboxed supports automatic DNS.
The <path-prefix> is the prefix of your service, allowing you to expose multiple boxes and services on the same hostname.
Updating a service
To update an existing load-balancer service, determine the ID first via:
dboxed box ls-lb-services <box-name>This will output a table, including the ID field.
Then use this ID to update the load-balancer service:
dboxed box update-lb-service <box-name> <id> --hostname=<hostname> --port=<port> --path-prefix=<path-prefix>All flags are optional and if omitted will leave the values unchanged.
Deleting a service
To delete a load-balancer service, run:
dboxed box rm-lb-service <box-name> <id>