Deploy code overview
Deploying code is the process of pushing code to an Astro Private Cloud (APC) Deployment. A code deploy can include an entire Astro project as a Docker image, or just the Dags in your project. APC supports several methods for deploying code to a Deployment:
- Deploy project images or Dags only using the Astro CLI
- Deploy Dags using an NFS volume
- Deploy Dags using Git sync
Use this document to understand each method and choose the right approach for your use case.
Deployment methods comparison
Astro CLI deploys
Full image deploy
By default, deploy code by building it into a Docker image and pushing to the Astronomer Registry using the CLI. See Deploy code using the CLI for this workflow.
This mechanism builds your Dags into a Docker image alongside all other files in your Astro project directory:
- Python packages (
requirements.txt) - OS-level packages (
packages.txt) - Dockerfile customizations
- Plugins and include files
The resulting image generates Docker containers for each Airflow component. Every time you run astro deploy, your project is rebuilt into a new image and containers are restarted.
When to use
- Python or OS dependency updates
- Custom Dockerfile modifications
- Initial deployment setup
- Major version changes
Dag-only deploy
For faster iteration, enable Dag-only deploys to deploy just your dags directory without rebuilding the Docker image.
When to use
- Frequent Dag changes
- No dependency changes
- Development workflows
- Quick fixes
You still need Docker access to authenticate to APC before deploying Dags.
NFS volume-based Dag deploys
For teams deploying Dag changes frequently, APC supports NFS volume-based Dag deploys.
Using this mechanism, deploy Dags by adding Python files to a shared filesystem on your network. Compared to image-based deploys, NFS enables:
- Zero downtime deployments
- Continuous deployment workflows
- Shared Dag storage across environments
When to use
- Enterprise environments with existing NFS infrastructure
- High-frequency Dag updates
- Shared Dag development across teams
Requirements
- NFS server accessible from Kubernetes cluster
- Platform-level configuration enabled
- Read access for UID/GID 50000
For configuration details, see Deploy Dags via NFS volume.
Git-sync Dag deploys
For Git-based workflows, APC supports git-sync deployments.
Configure a Git repository to sync with your Deployment. When you push changes to the repository, Dags automatically sync with no downtime.
Sync modes
- Polling: Periodically checks for changes (default: every 60 seconds)
- Webhook: Triggers sync on push events
When to use
- GitOps deployment workflows
- Version-controlled Dag management
- CI/CD pipeline integration
- Branch-based deployment strategies
For configuration details, see Deploy Dags via git sync.
Choose a deployment method
Decision tree
Combine methods
You can combine deployment methods:
- Use CLI Full Image for dependency updates
- Use CLI Dag-Only for quick Dag iterations
- Use Git Sync for automated production deployments
NFS and Git Sync are mutually exclusive with CLI deploys for the same Deployment. Once configured, a Deployment uses only that mechanism.
CI/CD integration
All deployment methods integrate with CI/CD pipelines: