Diferències

Ací es mostren les diferències entre la revisió seleccionada i la versió actual de la pàgina.

Enllaç a la visualització de la comparació

Ambdós costats versió prèvia Revisió prèvia
Següent revisió
Revisió prèvia
tech:docker:portainer [28/06/2026 20:59] – [agent (in remote server)] matetech:docker:portainer [30/06/2026 08:13] (actual) – [autossh] mate
Línia 59: Línia 59:
   * configuramos el entorno en portainer server   * configuramos el entorno en portainer server
     * nombre_host_local:puerto     * nombre_host_local:puerto
 +  
 +=== autossh
   * también se puede hacer a través de:<code bash>   * también se puede hacer a través de:<code bash>
 # Instalación (en Ubuntu/Debian) # Instalación (en Ubuntu/Debian)
Línia 66: Línia 68:
 autossh -M 0 -f -N -o "ServerAliveInterval 30" -o "ServerAliveCountMax 3" -L 9002:172.20.0.5:9001 usuario@IP-SERVIDOR-REMOTO autossh -M 0 -f -N -o "ServerAliveInterval 30" -o "ServerAliveCountMax 3" -L 9002:172.20.0.5:9001 usuario@IP-SERVIDOR-REMOTO
 </code> </code>
 +  * para hacerlo persistente:<code ini /etc/systemd/system/autossh-portainer.service>[Unit]
 +Description=Tuneles AutoSSH persistentes para Portainer Agents
 +After=network-online.target
 +Wants=network-online.target
 +
 +[Service]
 +Type=simple
 +# IMPORTANTE: Pon tu usuario local de Linux (el que tiene las claves SSH configuradas)
 +User=TU_USUARIO_LOCAL
 +Environment="AUTOSSH_GATETIME=0"
 +# Un solo comando levanta ambos puertos (9002 y 9003)
 +ExecStart=/usr/bin/autossh -M 0 -N -q -o "ServerAliveInterval 30" -o "ServerAliveCountMax 3" -L 0.0.0.0:9002:172.20.0.5:9001 -L 0.0.0.0:9003:172.20.0.6:9001 usuario_remoto@IP_DE_S4
 +Restart=always
 +RestartSec=10
 +
 +[Install]
 +WantedBy=multi-user.target</code><code bash># 1. Recargar systemd para que detecte el nuevo archivo
 +sudo systemctl daemon-reload
 +
 +# 2. HABILITAR el servicio (esto hace que arranque tras un REINICIO)
 +sudo systemctl enable autossh-portainer.service
 +
 +# 3. Arrancar el servicio ahora mismo (por primera vez)
 +sudo systemctl start autossh-portainer.service</code>
 +  * necesario acceso por ssh-key sin contraseña
 === otros comandos === otros comandos
   * tunel activo?: <code bash>netstat -tunlp | grep 9002   * tunel activo?: <code bash>netstat -tunlp | grep 9002
  • tech/docker/portainer.1782673147.txt.gz
  • Darrera modificació: 06/07/2026 18:29
  • (edició externa)