编程

deployment-kit

试用

Deploy and maintain services on a VPS with 1 command: build → restart → verify → monitor with heartbeat + Telegram alerts. Complete DevOps package: systemd units, nginx reverse proxy, cron @reboot, watchdog restarts, deploy scripts. WARNING: runs systemd restarts, sudo, nohup/setsid and changes runtime state — only use on services you own, test on staging first.

它能做什么

Deploy and maintain services on a VPS with 1 command: build → restart → verify → monitor with heartbeat + Telegram alerts. Complete DevOps package: systemd units, nginx reverse proxy, cron @reboot, watchdog restarts, deploy scripts. WARNING: runs systemd restarts, sudo, nohup/setsid and changes runtime state — only use on services you own, test on staging first.

技能文档

Deployment Kit 🚀🖥️

Get your service deployed and running 24/7 — with automatic restart on failure.

What you get

  1. Deploy script — 1 command: copy code → restart → verify
  2. Systemd unit — auto-start on boot + auto-restart on crash
  3. Nginx reverse proxy — port → domain
  4. Cron @reboot — services that run without systemd
  5. Watchdog — heartbeat check + restart + Telegram alert

Quick start

# Preview first (no changes) — recommended
bash scripts/deploy.sh --dry-run myapp

# Deploy (asks for confirmation before restart)
bash scripts/deploy.sh myapp

# Watchdog (cron every 2 min)
*/2 * * * * bash /opt/myapp/watchdog.sh myapp

# Telegram alert on failure (scripts/notify.sh)
bash scripts/notify.sh "⚠️ myapp down — restarted"

What the scripts actually do (transparency)

  • deploy.sh — builds, then restarts the service: sudo systemctl restart for systemd services, or pkill -f + nohup relaunch for plain processes. Always asks for confirmation (or use --dry-run to preview). Can cause downtime.
  • watchdog.sh — checks the heartbeat file age; restarts the service + sends a Telegram alert if stale.
  • notify.sh — sends a Telegram message using a bot token read from ~/.config/tg-alert.env (or env vars).

Templates

deployment-kit/
├── SKILL.md
└── scripts/
    ├── deploy.sh      # build → restart → verify
    ├── watchdog.sh    # heartbeat + auto-restart + alert
    ├── notify.sh      # Telegram message (bot token + chat id)
    └── myapp.service  # systemd unit template

Best practices (learned on 8 services)

  • Heartbeat file is written by the app every 30-60s → watchdog checks mtime
  • Never pkill -f "pattern" that matches itself — use "pa[t]tern" or lsof
  • Slow processes: setsid bash -c '...' /dev/null 2>&1 & — intentional daemonization (process keeps running after shell exit)
  • ALWAYS verify after deploy (curl /health, log line, MD5)

🔒 Security & responsibility (important — read before use)

  • Destructive: deploy restarts services, replaces running code and can cause downtime. Test on staging first, and have a rollback plan.
  • sudo: deploy.sh uses sudo systemctl restart — requires sudo rights and affects the whole system. Only run commands you understand.
  • Secrets: Telegram token (TG_BOT_TOKEN) and chat id are credentials. Store them in ~/.config/tg-alert.env with chmod 600, never in scripts, logs, shell history or git.
  • nohup/setsid: used intentionally to run services in the background outside the terminal — normal daemon practice, not hidden behavior.
  • Always review scripts before running them on a production server.

相关技能

This skill should be used when the user wants to install or deploy TeslaMate (a self-hosted Tesla vehicle data logger + Grafana dashboard) on a local machine...

Build a Go service on psyb0t/servicepack — clone-and-own framework (not a `go get` library) providing a Service interface (Name/Run/Stop), a singleton ServiceManager that runs services concurrently with dependency-ordered topological start, automatic retry (Retryable), non-fatal failures (AllowedFailure), readiness gating (ReadyNotifier), per-service CLI subcommands (Commander), an App singleton with OnPreRun/OnPostStop lifecycle hooks, gofindimpl-based service auto-discovery codegen, ctxscope/slogging structured logging, and a graceful-shutdown Runner. Import path github.com/psyb0t/servicepack. Use when the user wants related Go services debugged together locally, then deployed as one binary or split into separate microservices, with retry/dependency/readiness semantics.

1 次安装

通过 curl 调用 JSON-RPC API 发布 Web 应用,并获得一个公开访问的网址。

152 次安装8 星标

This skill should be used when the user wants to install or deploy TeslaMate (a self-hosted Tesla vehicle data logger + Grafana dashboard) on a local machine...

逐跳排查代理、应用、依赖间的请求链路,定位并修复 Web 服务故障。

69 次安装2 星标

Deploy, resume, verify, destroy, and locally wire a production Dirextalk message server on AWS for any local agent runtime supported by dirextalk-connect. Us...

作者 Liyanan2 次安装