Run Sandfly on Non-Default Ports
There can be circumstances where it is necessary or desired to run Sandfly on ports other than the defaults of 80 and 443. This document covers the steps to accomplish this.
This process is only for Docker Images; it does not apply to Docker Compose and Kubernetes installations.
Even when running Sandfly on non-default ports, we do not recommend running other software on the same host as the Sandfly server for security reasons.
Using Non-Default Ports
The included start_server.sh script (which is executed by start_sandfly.sh) checks for the environment variables SANDFLY_HTTP_PORT and SANDFLY_HTTPS_PORT, which default to 80 and 443, respectively. If one or both are present, the user-provided value will be passed to the Docker/Podman port map argument. Additionally, if the HTTPS port is not 443, an extra environment variable will be passed into the server container to inform the plain-HTTP redirector of the target redirection port.
Starting the Server
Start the server manually with alternative ports from the command line:
SANDFLY_HTTP_PORT=8080 SANDFLY_HTTPS_PORT=8443 ./start_sandfly.shTo avoid manually entering the extended command every time, save the command into a custom script (e.g., start_sandfly_custom.sh). The custom filename prevents it from being overwritten during upgrades.
#!/usr/bin/env bash
# Force sandfly to run on a high port
SANDFLY_HTTP_PORT=8080 SANDFLY_HTTPS_PORT=8443 ./start_sandfly.shMake the script executable. Then, instead of using the factory-shipped script, run the custom script.
Node Configurations
Edit the config.node.env file on every node host and update the value of SF_NODE_SERVER_URL to include the new port number. For example:
...
SF_NODE_SERVER_URL=https://192.168.1.1:8443/
...Properly stop and then start the Node containers to use the changed configuration.
Sandfly should now be running entirely on the newly assigned ports.
Updated about 3 hours ago