deploy-and-check

Deploy a Django git branch and verify service health via systemctl and /api/health/.

1|Updated Sep 6, 2024
One-click install
npx skills add https://github.com/carlos18bp/gym_project --skill deploy-and-check-carlos18bp
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: deploy-and-check
Source: https://github.com/carlos18bp/gym_project/tree/main/.agents/skills/deploy-and-check
Command: npx skills add https://github.com/carlos18bp/gym_project --skill deploy-and-check-carlos18bp

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires awk, git, pip, manage.py, systemctl, curl, python3, nvm.

What problem does it solve?

It reduces downtime and deployment risk by automating environment discovery, pulling the correct git branch, building backend/frontend assets, restarting required services, and validating the result with health checks.

Core Features & Use Cases

  • Auto-discovery from ops config: Reads service names, domain, environment, frontend presence, node version, DB type, and deployment toggles from ~/webapps/ops/vps/projects.yml.
  • Deterministic deploy pipeline: Performs clean pre-deploy checks, git checkout/pull for a target branch, backend dependency install, migrations, optional frontend build, and optional collectstatic.
  • Production verification & troubleshooting: Restarts gunicorn/huey (and optional frontend service), checks systemctl is-active, calls /api/health/, runs an ops post-deploy script, and provides log/diagnostic commands for failures.

Quick Start

Run the deployment for the current repository branch by invoking /deploy-and-check.

Frequently Asked Questions about deploy-and-check

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I automate Django deployment and verify health after restarting services?

Automating Django deployment requires pulling a specific git branch, installing dependencies, running migrations, optionally building frontend assets, then restarting gunicorn and huey via systemd before checking the /api/health/ endpoint.

What's the best way to deploy a specific git branch to staging or production with Django and Gunicorn?

The best way to deploy a specific git branch is using a config-driven pipeline that reads service names and environment details from projects.yml, checks out the branch, performs backend installs, and restarts Gunicorn via systemd.

Can I include frontend builds and collectstatic in my Django deployment pipeline?

Yes, you can include frontend builds and collectstatic in a Django deployment pipeline by toggling frontend presence and node version settings in your projects.yml configuration, allowing the pipeline to conditionally execute these steps.

Why does my Django deployment fail after restarting systemd services without health checks?

A Django deployment can fail silently without health checks because service restarts via systemctl do not guarantee the application is responding, making it critical to verify systemctl is-active status and curl the /api/health/ endpoint.

Does this deployment approach work with Huey task queues and Nginx?

Yes, this deployment approach works with Huey and Nginx by restarting the Huey systemd service alongside Gunicorn and verifying backend health, while Nginx typically routes traffic to the restarted Gunicorn socket.

How do I troubleshoot a failed Django deployment after a git pull and migration?

To troubleshoot a failed Django deployment, run diagnostic log commands for Gunicorn and Huey, verify systemctl is-active status, and inspect the output of the post-deploy ops check script and /api/health/ curl response.