Skip to main content

CLI tool for setting up deployment of FastAPI applications

Project description

FastAPI Deploy CLI

A command-line tool for setting up automated deployment of FastAPI applications using Docker, Docker Compose, and GitHub Actions.

Features

  • Supports both pip and uv package managers
  • Configures GitHub Actions for CI/CD
  • Automatically sets up GitHub secrets for deployment
  • Creates Dockerfile and docker-compose.yml files
  • Sets up secure deployment with Traefik
  • Custom domain and port configuration
  • Dynamic environment variable handling
  • Interactive CLI with arrow key selection

Installation

# Install from PyPI
pip install fastapi-deploy-cli

# Or using uv
uv pip install fastapi-deploy-cli

# Or install from source
git clone https://github.com/your-username/fastapi-deploy-cli.git
cd fastapi-deploy-cli
pip install -e .

Usage

Initialize a new deployment setup

# Navigate to your FastAPI project directory
cd your-fastapi-project

# Run the initialization command
fastapi-deploy init

The CLI will guide you through the setup process:

  1. Choose your package manager (pip or uv) using arrow keys
  2. Specify the path to your .env file
  3. Configure application domain and port
  4. Set up GitHub repository and Personal Access Token
  5. Add secrets to GitHub repository
  6. Create necessary deployment files

Update deployment files

fastapi-deploy update

The update command allows you to:

  1. Change your package manager
  2. Update your domain and port settings
  3. Update GitHub secrets
  4. Refresh deployment files with the latest configurations

Required Environment Variables

Before using the CLI, create an .env file with the following variables:

SERVER_HOST=your-server-hostname
SERVER_USER=your-server-username
SSH_PRIVATE_KEY=your-private-key

Additional environment variables will be automatically detected and included in deployment files.

Domain and Port Configuration

The CLI prompts you to specify:

  • Application domain (e.g., api.example.com)
  • Application port (e.g., 8001)

These settings are automatically applied to:

  • Docker Compose configuration
  • Dockerfile CMD command
  • Traefik routing settings

GitHub Actions Workflow

The CLI sets up a GitHub Actions workflow that:

  1. Checks out your code
  2. Prepares files for deployment
  3. Copies files to your server via SSH
  4. Builds and starts Docker containers
  5. Performs cleanup

Requirements

  • Python 3.8+
  • A FastAPI application
  • A GitHub repository
  • A GitHub Personal Access Token with repo scope
  • A server with SSH access and Docker installed

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

fastapi_deploy_cli-0.1.0.tar.gz (46.7 kB view details)

Uploaded Source

Built Distribution

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

fastapi_deploy_cli-0.1.0-py3-none-any.whl (17.1 kB view details)

Uploaded Python 3

File details

Details for the file fastapi_deploy_cli-0.1.0.tar.gz.

File metadata

  • Download URL: fastapi_deploy_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 46.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for fastapi_deploy_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 35f064333e1a71172132041d262d2b8dddc88a73254ce2a809fccb124795d6ac
MD5 ebc46fceef971fac2058f89217e16a4b
BLAKE2b-256 1dd3d2bde6765613ff55e6320218bd13d2242440df0effc3fd57314b65840478

See more details on using hashes here.

File details

Details for the file fastapi_deploy_cli-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for fastapi_deploy_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 feae6d88c2d56b1a14f51208133b52fe6cb24810b478f4b1b7f0216a36deb668
MD5 520310626394fa24eaa180e6060a8d78
BLAKE2b-256 faee7b5d8b18d4944f8f28dad198fd7553f5a4b23b6792298e5ea5eccc58fa7f

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