YAML configuration
Keep common defaults and server overrides in
deploy/<app>/<environment>/deployment.yml.
Define repeatable SSH-based deployment workflows for Django and FastAPI projects with simple YAML playbooks.
$ pystrano deploy production api
✓ Connecting to production api (app1.example.com)
✓ Prepared release directory
✓ Pulled branch main
✓ Synced shared assets and env file
✓ Installed Python dependencies
✓ Applied migrations and refreshed static assets
✓ Promoted release to current
✓ Restarted gunicorn.service
✅ Deployment completed in 42s
Pystrano automates the SSH deployment steps you would otherwise keep in shell notes: prepare a server, create timestamped releases, install dependencies, run framework steps, update the active release, and restart the app service.
Keep common defaults and server overrides in
deploy/<app>/<environment>/deployment.yml.
Run setup once, then deploy releases that install dependencies with
pip or uv, run framework tasks, and restart systemd.
Deploys create timestamped release directories and promote the active release with
a current symlink. A rollback CLI command is not exposed yet.
Pystrano assumes you already have SSH access to a VPS-style server and know where your app should live.
Use pystrano init production api to build a version 2 config,
deployment settings, and a starter systemd service file.
Use pystrano setup production api to create the deploy user,
directories, packages, virtualenv, known hosts, and optional service files.
Use pystrano deploy production api to clone code, install
dependencies, run framework tasks, promote the release, and prune old releases.
The docs cover supported Django and FastAPI deployments over SSH with systemd on VPS-style servers.
config_version: 2
common:
source_code_url: "git@github.com:example/example-django-app.git"
framework: "django"
project_root: "apps/example-django-app"
project_user: "deploy"
venv_dir: ".venv"
package_manager: "pip"
dependency_file: "requirements.txt"
keep_releases: 5
system_packages: |
libpq-dev
python3-dev
build-essential
env_file: "./deploy/api/production/.env"
ssh_known_hosts: "github.com"
service_file: "./deploy/api/production/gunicorn.service"
branch: "main"
clone_depth: 1
servers:
- host: "app1.example.com"
port: 22
run_migrations: true
collect_static_files: true
pystrano setup production api --dry-run
pystrano deploy production api --dry-run
Install Pystrano, create a deployment config, preview the remote commands, then run setup and deploy when your server is ready.