August 7, 2025, we refactored a single monolithic Devproxy management script into a modular architecture, splitting functionality into five dedicated scripts. This improves maintainability and clarity by separating concerns: firewall management, SSH tunnel handling, socat proxy control, and container lifecycle operations.
Complication note
When the SSH reverse-tunnel from a laptop to the server dies unexpectedly, the sshd process on the server may remain listening on port 4000. In this scenario, you must kill the stale SSH process on port 4000 before re-establishing the tunnel from the laptop. The modular scripts allow you to detect and resolve this by safely checking and killing the server-side SSH listener before retrying the connection
Reference
Scripts
310_firewall_toggle.sh (1 310 bytes)
- Toggles UFW firewall rule for port 4001/tcp
- Interactive prompts to enable before use and disable after operations
320_devproxy_check_ssh_tunnel.sh (1 196 bytes)
- Checks port 4000 for existing SSH reverse‐tunnel (
sshd) - Interactive prompt to kill SSH processes on port 4000
- Checks port 4000 for existing SSH reverse‐tunnel (
330_devproxy_socat_container.sh (2 430 bytes)
- Manages socat listening on port 4001
- Interactive prompts to kill existing socat, restart and verify binding
- Logs output to
$HOME/socat_devproxy.log
340_devproxy_container_enable.sh (427 bytes)
- Verifies
docker-compose.ymlexists - Checks if
service.devproxy.siteis running; offers to stop - Starts (or recreates) the container and verifies it is up
- Offers to stop the container after launch
- Verifies
350_devproxy_container_disable.sh (315 bytes)
- Stops or disables the
service.devproxy.sitecontainer - Interactive confirmation for stopping the service
- Stops or disables the
Architecture Benefits
Separation of concerns Each script has a single responsibility (firewall, SSH, socat, container enable/disable).
Interactive safety Prompts prevent accidental kills or configuration changes.
Revalidation Every action is followed by a recheck of system state.
Logging & diagnostics Proxy logs are captured for easier troubleshooting.

