Declarative configs
Describe environments once in YAML and reuse them across staging, production, or any custom server.
Pystrano is an open-source CLI for running repeatable deployment tasks from plain YAML playbooks. Use it as-is, adapt it for your stack, and share what you learn.
$ pystrano deploy production api
✓ Connecting to production api
✓ Pulling branch main
✓ Installing system packages
✓ Syncing release files
✓ Applying migrations & static assets
✓ Restarting gunicorn.service
✅ Deployment completed in 42s
Examples shared by maintainers and users.
Bootstrap an environment with "pystrano setup".
Pystrano focuses on predictable automation: keep deployments scripted, reviewable, and easy to hand over to the next person.
Describe environments once in YAML and reuse them across staging, production, or any custom server.
Ship with managed known hosts, secrets scaffolding, and SSH practices that keep surprises low.
Test deployments in isolated environments and keep release history ready for quick rollbacks.
Keep your release process explicit so anyone on the team can run it.
Start with a common
block for shared settings and override only what differs per environment.
Provision packages, sync secrets, and register services with a single pystrano setup
run.
Ship your release, run migrations, and roll back by selecting a previous build when needed.
Install Pystrano from PyPI, inspect the YAML examples, and adapt them to match your project's checklist.
pip install pystrano
pystrano deploy staging api
common:
source_code_url: git@gitlab.example.com:example/example-backend.git
project_root: example-backend
project_user: example-user
venv_dir: venv
keep_releases: 5
system_packages: |
libpq-dev
python3-dev
memcached
libjpeg62-dev
zlib1g-dev
env_file: ./.env.example
ssh_known_hosts: gitlab.example.com;other.host.com
service_file: ./deploy/api/production/gunicorn.service
secrets: ./secrets/secret-key.json
branch: main
servers:
- host: 192.168.0.1
run_migrations: true
collect_static_files: true
- host: 192.168.0.2
# Setup once per environment
pystrano setup staging api
# Deploy whenever you ship
pystrano deploy staging api
Pystrano is MIT-licensed. Use it, fork it, and let us know what would help you ship with more confidence.