Skip to main content

A production-grade CLI tool to generate deployment configuration files for Django/React projects.

Project description

deployfilegen

deployfilegen is a production-grade Python CLI library designed to automatically generate infrastructure-as-code for full-stack applications (Django + React/Next.js/Vite).

It automates the creation of Dockerfiles, docker-compose.yml, and GitHub Actions workflows, using secure, battle-tested defaults.

🚀 Key Features (v0.1.31+)

  • Zero-Config Dev Mode: Works with any existing .env file. No forced variable naming.
  • Smart Framework Detection: Automatically detects Vite (port 5173), Next.js (port 3000), or Create React App.
  • Flexible Deployment: Choose between SSH Build (default) or Registry Push strategies.
  • Production-Grade Defaults:
    • Security: Non-root users, unprivileged Nginx.
    • Reliability: Healthchecks, depends_on, and race-condition prevention.
    • Optimization: Multi-stage builds, .dockerignore generation, layer caching.

📦 Quick Start

1. Install

pip install deployfilegen

2. Local Development (Zero Config)

deployfilegen init --mode dev
docker compose -f docker-compose.dev.yml up --build

3. Production — SSH Build (Default)

Build images directly on your server. No container registry needed.

deployfilegen init --mode prod --deploy ssh

Required .env variables:

DEPLOY_HOST=your_server_ip
DEPLOY_USER=ubuntu

GitHub Actions workflow will: SSH → git pull → docker compose build → docker compose up -d

4. Production — Registry Push

Push images to Docker Hub/GHCR, then pull on server.

deployfilegen init --mode prod --deploy registry

Required .env variables:

DEPLOY_HOST=your_server_ip
DEPLOY_USER=ubuntu
DOCKER_USERNAME=your_username
BACKEND_IMAGE_NAME=user/backend
FRONTEND_IMAGE_NAME=user/frontend

GitHub Actions workflow will: Build → Push to Registry → SSH → docker compose pull → up -d


🛠 Supported Stacks

Backend:

  • Django: Auto-detects project name from manage.py.
  • Python: Uses 3.11-slim by default.

Frontend:

  • Vite: Auto-configures port 5173 and host binding.
  • Next.js: Auto-configures port 3000 and standalone build.
  • Create React App: Auto-configures port 3000.

⚙️ Configuration

Generate a boilerplate .env:

deployfilegen template                  # SSH mode (minimal)
deployfilegen template --deploy registry  # Registry mode (full)

📖 CLI Reference

Usage: deployfilegen init [OPTIONS]

Options:
  --mode [dev|prod]      Generation mode (Default: prod)
  --deploy [ssh|registry] Deployment strategy (Default: ssh)
  --force, -f            Overwrite existing files
  --with-db              Include a Postgres service in docker-compose
  --docker-only          Generate only Dockerfiles
  --compose-only         Generate only docker-compose.yml
  --github-only          Generate only GitHub Actions (Prod only)
  --backend-only         Only generate backend assets
  --frontend-only        Only generate frontend assets
  # Stability Overrides
  --frontend-port        Override detected frontend dev port
  --start-command        Override detected frontend start command
  --project-name         Override detected Django project name
  --help                 Show this message

📄 License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

deployfilegen-0.1.31.tar.gz (17.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

deployfilegen-0.1.31-py3-none-any.whl (18.1 kB view details)

Uploaded Python 3

File details

Details for the file deployfilegen-0.1.31.tar.gz.

File metadata

  • Download URL: deployfilegen-0.1.31.tar.gz
  • Upload date:
  • Size: 17.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for deployfilegen-0.1.31.tar.gz
Algorithm Hash digest
SHA256 023c45886ba4d743d9118aad9021717f727867529488bc9df001e3a034a117df
MD5 b68ba95613cf954b8ed82ff860a2b05f
BLAKE2b-256 2c8fc09fda42bd46866e7bce2196b16d97a884ba3daec0595b95da0c5e3d7050

See more details on using hashes here.

File details

Details for the file deployfilegen-0.1.31-py3-none-any.whl.

File metadata

  • Download URL: deployfilegen-0.1.31-py3-none-any.whl
  • Upload date:
  • Size: 18.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for deployfilegen-0.1.31-py3-none-any.whl
Algorithm Hash digest
SHA256 0af8280e51650ef20a4db9cc831fa19c71c1ca008e6bdbf6734d66250f3aecbd
MD5 5ffce0cdf1180ffbaaa5c08f4c17ebd5
BLAKE2b-256 719c8ccfceb602713f10831025428f957d916e53d224563ba9c39abb43d0e082

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page