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,50 @@
|
||||
---
|
||||
name: systemd_generate_unit
|
||||
kind: function
|
||||
lang: go
|
||||
domain: infra
|
||||
version: "1.0.0"
|
||||
purity: pure
|
||||
signature: "func SystemdGenerateUnit(name, execStart, workDir, user string, env map[string]string) string"
|
||||
description: "Genera el texto de un archivo .service de systemd para una app. Incluye restart automático y env vars en orden determinista."
|
||||
tags: [systemd, unit, service, generate, deploy]
|
||||
uses_functions: []
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: ""
|
||||
imports: [fmt, sort, strings]
|
||||
params:
|
||||
- name: name
|
||||
desc: "nombre del servicio (aparece en Description)"
|
||||
- name: execStart
|
||||
desc: "comando completo para arrancar la app (ruta absoluta al binario + args)"
|
||||
- name: workDir
|
||||
desc: "directorio de trabajo del servicio (vacío para omitir)"
|
||||
- name: user
|
||||
desc: "usuario del sistema bajo el que corre el servicio (vacío para omitir)"
|
||||
- name: env
|
||||
desc: "variables de entorno key=value para el servicio"
|
||||
output: "texto completo del archivo .service listo para escribir a /etc/systemd/system/"
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "functions/infra/systemd_generate_unit.go"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```go
|
||||
unit := SystemdGenerateUnit(
|
||||
"dag_engine",
|
||||
"/opt/apps/dag_engine/dag_engine",
|
||||
"/opt/apps/dag_engine",
|
||||
"deploy",
|
||||
map[string]string{"PORT": "8080", "DB_PATH": "/opt/apps/dag_engine/data/ops.db"},
|
||||
)
|
||||
fmt.Println(unit)
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Función pura sin I/O. Las env vars se ordenan alfabéticamente para output determinista. Genera un unit con Restart=on-failure y RestartSec=5.
|
||||
Reference in New Issue
Block a user