Files
fn_registry/functions/infra/deploy_app_remote.md
T
egutierrez f21664e052 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.
2026-04-12 17:29:52 +02:00

48 lines
1.6 KiB
Markdown

---
name: deploy_app_remote
kind: pipeline
lang: go
domain: infra
version: "1.0.0"
purity: impure
signature: "func DeployAppRemote(conn SSHConn, cfg DeployConfig) error"
description: "Orquesta el deploy continuo de una app a un VPS: verifica SSH, compila localmente, sube binario, reinicia systemd y hace health check."
tags: [deploy, vps, remote, ci, cd, pipeline, infra]
uses_functions: [ssh_check_go_infra, ssh_upload_go_infra, ssh_exec_go_infra, systemd_restart_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, os/exec, strings]
params:
- name: conn
desc: "conexión SSH al VPS destino"
- name: cfg
desc: "configuración de deploy con nombre, rutas, build command, puerto y health path"
output: "nil si el deploy completo fue exitoso"
tested: false
tests: []
test_file_path: ""
file_path: "functions/infra/deploy_app_remote.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",
BuildCmd: "CGO_ENABLED=0 GOOS=linux go build -o dag_engine .",
Port: 8080,
HealthPath: "/api/health",
}
err := DeployAppRemote(conn, cfg)
```
## Notas
Pipeline de 5 pasos para deploy continuo (asume que el setup inicial ya se hizo con `setup_vps_app`). El build corre localmente en `LocalDir` con `bash -c BuildCmd`. Si `BuildCmd` está vacío, se salta el build y sube directamente el binario existente.