feat: funciones Go de deploy — systemd, VPS setup, deploy remoto
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.
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user