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,45 @@
|
||||
---
|
||||
name: systemd_status
|
||||
kind: function
|
||||
lang: go
|
||||
domain: infra
|
||||
version: "1.0.0"
|
||||
purity: impure
|
||||
signature: "func SystemdStatus(conn SSHConn, unitName string, logLines int) (SystemdServiceStatus, error)"
|
||||
description: "Consulta el estado de un servicio systemd en un host remoto. Retorna estado activo, sub-estado, PID y logs recientes."
|
||||
tags: [systemd, status, monitor, 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, strings]
|
||||
params:
|
||||
- name: conn
|
||||
desc: "conexión SSH al host remoto"
|
||||
- name: unitName
|
||||
desc: "nombre del unit systemd a consultar (sin .service)"
|
||||
- name: logLines
|
||||
desc: "número de líneas de journalctl a incluir (0 para no incluir logs)"
|
||||
output: "SystemdServiceStatus con Active, SubState, MainPID y Logs del servicio"
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "functions/infra/systemd_status.go"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```go
|
||||
conn := SSHConn{Host: "192.168.1.100", User: "deploy"}
|
||||
s, err := SystemdStatus(conn, "dag_engine", 20)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
fmt.Printf("State: %s/%s PID: %s\n", s.Active, s.SubState, s.MainPID)
|
||||
fmt.Println(s.Logs)
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Usa `systemctl show` para obtener propiedades sin formato humano. Los logs se obtienen con journalctl y son opcionales (logLines=0 los omite). Si journalctl falla (ej: permisos), los logs quedan vacíos sin error.
|
||||
Reference in New Issue
Block a user