a06946e410
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.
41 lines
1007 B
Markdown
41 lines
1007 B
Markdown
---
|
|
name: systemd_restart
|
|
kind: function
|
|
lang: go
|
|
domain: infra
|
|
version: "1.0.0"
|
|
purity: impure
|
|
signature: "func SystemdRestart(conn SSHConn, unitName string) error"
|
|
description: "Reinicia un servicio systemd en un host remoto via SSH."
|
|
tags: [systemd, restart, service, remote]
|
|
uses_functions: [ssh_exec_go_infra]
|
|
uses_types: [ssh_conn_go_infra]
|
|
returns: []
|
|
returns_optional: false
|
|
error_type: "error_go_core"
|
|
imports: [fmt]
|
|
params:
|
|
- name: conn
|
|
desc: "conexión SSH al host remoto"
|
|
- name: unitName
|
|
desc: "nombre del unit systemd a reiniciar (sin .service)"
|
|
output: "nil si el reinicio fue exitoso"
|
|
tested: false
|
|
tests: []
|
|
test_file_path: ""
|
|
file_path: "functions/infra/systemd_restart.go"
|
|
---
|
|
|
|
## Ejemplo
|
|
|
|
```go
|
|
conn := SSHConn{Host: "192.168.1.100", User: "deploy"}
|
|
if err := SystemdRestart(conn, "dag_engine"); err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
```
|
|
|
|
## Notas
|
|
|
|
Usa `sudo systemctl restart`. Requiere que el usuario SSH tenga permisos sudo. Si el servicio no existe, systemctl retorna error.
|