f21664e052
Nuevas funciones infra para deploy sin Docker: generación de units systemd (pura), instalación/restart/status de servicios remotos via SSH, setup inicial de VPS (crear dirs, usuario, permisos), y pipelines de deploy completo (setup_vps_app, deploy_app_remote). Incluye tipo DeployConfig con la configuración de deploy por app.
16 lines
420 B
Go
16 lines
420 B
Go
package infra
|
|
|
|
import "fmt"
|
|
|
|
// SystemdRestart reinicia un servicio systemd en un host remoto.
|
|
func SystemdRestart(conn SSHConn, unitName string) error {
|
|
_, stderr, code, err := SSHExec(conn, fmt.Sprintf("sudo systemctl restart %s", unitName))
|
|
if err != nil {
|
|
return fmt.Errorf("systemd_restart: ssh exec: %w", err)
|
|
}
|
|
if code != 0 {
|
|
return fmt.Errorf("systemd_restart %s: %s", unitName, stderr)
|
|
}
|
|
return nil
|
|
}
|