Files
fn_registry/functions/infra/systemd_install.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

1.3 KiB

name, kind, lang, domain, version, purity, signature, description, tags, uses_functions, uses_types, returns, returns_optional, error_type, imports, params, output, tested, tests, test_file_path, file_path
name kind lang domain version purity signature description tags uses_functions uses_types returns returns_optional error_type imports params output tested tests test_file_path file_path
systemd_install function go infra 1.0.0 impure func SystemdInstall(conn SSHConn, unitName, unitContent string) error Sube un unit file al host remoto, hace daemon-reload, enable y restart. Idempotente: reemplaza si el unit ya existe.
systemd
install
deploy
service
remote
ssh_exec_go_infra
ssh_conn_go_infra
false error_go_core
fmt
name desc
conn conexión SSH al host remoto
name desc
unitName nombre del unit sin extensión (ej: dag_engine)
name desc
unitContent contenido completo del archivo .service (generado por SystemdGenerateUnit)
nil si el unit se instaló y arrancó correctamente false
functions/infra/systemd_install.go

Ejemplo

conn := SSHConn{Host: "192.168.1.100", User: "deploy"}
unit := SystemdGenerateUnit("dag_engine", "/opt/apps/dag_engine/dag_engine", "/opt/apps/dag_engine", "deploy", nil)
err := SystemdInstall(conn, "dag_engine", unit)

Notas

Escribe el unit a un archivo temporal en /tmp y lo mueve con sudo a /etc/systemd/system/. Requiere que el usuario SSH tenga permisos sudo sin password para systemctl y mv a /etc/systemd/system/.