Weplex devops - more clarity to on off scripts for development

Marcio S Galli

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

  1. 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
  2. 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
  3. 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
  4. 340_devproxy_container_enable.sh (427 bytes)

    • Verifies docker-compose.yml exists
    • Checks if service.devproxy.site is running; offers to stop
    • Starts (or recreates) the container and verifies it is up
    • Offers to stop the container after launch
  5. 350_devproxy_container_disable.sh (315 bytes)

    • Stops or disables the service.devproxy.site container
    • Interactive confirmation for stopping the service

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.

© 2019–2025 Weplex Comunicação. Atendemos presencialmente em Ribeirão Preto, na Maurílio Biagi 800, Sala 1104 (SP) ou remotamente, profissionais liberais de todo Brasil e do mundo. Meplex Comunicações, Weplex Comunicações, Weplex Communications e xBio são marcas registradas de Weplex Comunicações. Todo o conteúdo deste site está protegido por direitos autorais © 2019–2025 Weplex Comunicações. Todos os direitos reservados.

Feito com ❤ por Weplex