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:
- Choose your package manager (pip or uv) using arrow keys
- Specify the path to your .env file
- Configure application domain and port
- Set up GitHub repository and Personal Access Token
- Add secrets to GitHub repository
- Create necessary deployment files
Update deployment files
fastapi-deploy update
The update command allows you to:
- Change your package manager
- Update your domain and port settings
- Update GitHub secrets
- 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:
- Checks out your code
- Prepares files for deployment
- Copies files to your server via SSH
- Builds and starts Docker containers
- 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
35f064333e1a71172132041d262d2b8dddc88a73254ce2a809fccb124795d6ac
|
|
| MD5 |
ebc46fceef971fac2058f89217e16a4b
|
|
| BLAKE2b-256 |
1dd3d2bde6765613ff55e6320218bd13d2242440df0effc3fd57314b65840478
|
File details
Details for the file fastapi_deploy_cli-0.1.0-py3-none-any.whl.
File metadata
- Download URL: fastapi_deploy_cli-0.1.0-py3-none-any.whl
- Upload date:
- Size: 17.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
feae6d88c2d56b1a14f51208133b52fe6cb24810b478f4b1b7f0216a36deb668
|
|
| MD5 |
520310626394fa24eaa180e6060a8d78
|
|
| BLAKE2b-256 |
faee7b5d8b18d4944f8f28dad198fd7553f5a4b23b6792298e5ea5eccc58fa7f
|