astrolock deploy
Deploys your site to your configured hosting platform.
Usage
# Deploy to a target (dry run by default)
astrolock deploy <target>
# Execute deployment
astrolock deploy <target> --execute
# Skip build step
astrolock deploy <target> --skip-build --execute
Examples
# Deploy to live
astrolock deploy live --execute
# Deploy to stage (dry run first)
astrolock deploy stage
astrolock deploy stage --execute
# Deploy without rebuilding
astrolock deploy live --skip-build --execute
Info
By default, deploy runs a dry run showing what would happen. Add --execute to actually deploy.
Flags
| Flag | Description |
|---|---|
--skip-build | Skip building, deploy existing dist/ |
--execute | Actually deploy (default is dry-run) |
Configuration
Configure targets in .astrolock/astrolock.yaml:
deploy:
targets:
stage:
platform: aws
url: https://stage.example.com
aws:
bucket: stage.example.com
region: us-east-1
cloudfront_distribution: EABC123STAGE
live:
platform: aws
url: https://www.example.com
aws:
bucket: www.example.com
region: us-east-1
cloudfront_distribution: EXYZ789LIVESupported Platforms
| Platform | Configuration |
|---|---|
| AWS S3 + CloudFront | "platform": "aws" |
| Netlify | "platform": "netlify" |
| Vercel | "platform": "vercel" |
Workflow
First-time Setup
- Set up infrastructure - Follow the Terraform guide
- Configure deploy.json - Add targets with bucket, region, CloudFront
- Deploy - Run
astrolock deploy <target> --execute
Daily Workflow
# Build and deploy to stage
astrolock deploy stage --execute
# Test on stage site...
# Deploy to live
astrolock deploy live --execute
Troubleshooting
- No Targets
- Target Not Found
- Old Content
Error: “No deployment targets configured”
Fix: Create .astrolock/astrolock.yaml with at least one target.
Error: “Target not found”
Fix: Check target name matches what’s in deploy.json.
CloudFront showing old content.
Fix: Deploy automatically invalidates cache. If issues persist:
aws cloudfront create-invalidation \
--distribution-id YOUR_DISTRIBUTION_ID \
--paths "/*"Error: “No deployment targets configured”
Fix: Create .astrolock/astrolock.yaml with at least one target.
Error: “Target not found”
Fix: Check target name matches what’s in deploy.json.
CloudFront showing old content.
Fix: Deploy automatically invalidates cache. If issues persist:
aws cloudfront create-invalidation \
--distribution-id YOUR_DISTRIBUTION_ID \
--paths "/*"See Also
- Terraform AWS Guide - Set up AWS infrastructure
- astrolock build - Build your site
- astrolock preview - Preview before deploying
Tip
Always run astrolock preview to test your build before deploying to production.