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,48 @@
|
||||
---
|
||||
name: setup_vps_app
|
||||
kind: pipeline
|
||||
lang: go
|
||||
domain: infra
|
||||
version: "1.0.0"
|
||||
purity: impure
|
||||
signature: "func SetupVPSApp(conn SSHConn, cfg DeployConfig) error"
|
||||
description: "Orquesta el setup inicial de una app en un VPS remoto: verifica SSH, crea dirs y usuario, sube binario, instala systemd unit y hace health check."
|
||||
tags: [deploy, vps, setup, systemd, ssh, pipeline, infra]
|
||||
uses_functions: [ssh_check_go_infra, vps_setup_app_go_infra, ssh_upload_go_infra, ssh_exec_go_infra, systemd_generate_unit_go_infra, systemd_install_go_infra, health_check_http_go_infra]
|
||||
uses_types: [ssh_conn_go_infra, DeployConfig_go_infra]
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: "error_go_core"
|
||||
imports: [fmt]
|
||||
params:
|
||||
- name: conn
|
||||
desc: "conexión SSH al VPS destino"
|
||||
- name: cfg
|
||||
desc: "configuración de deploy con nombre, rutas, build, puerto, env vars"
|
||||
output: "nil si el setup completo fue exitoso"
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "functions/infra/setup_vps_app.go"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```go
|
||||
conn := SSHConn{Host: "185.x.x.x", User: "root"}
|
||||
cfg := DeployConfig{
|
||||
AppName: "dag_engine",
|
||||
LocalDir: "apps/dag_engine",
|
||||
RemoteDir: "/opt/apps/dag_engine",
|
||||
BinaryName: "dag_engine",
|
||||
ServiceUser: "deploy",
|
||||
Port: 8080,
|
||||
HealthPath: "/api/health",
|
||||
Env: map[string]string{"PORT": "8080"},
|
||||
}
|
||||
err := SetupVPSApp(conn, cfg)
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Pipeline de 6 pasos para primera instalación. Después del setup inicial, usar `deploy_app_remote` para deploys continuos (no regenera dirs ni systemd unit). El health check espera hasta 30 segundos con polling cada 2s.
|
||||
Reference in New Issue
Block a user