4.7 KiB
Story 4.1: Deploy Content to Cloud - Quick Start Guide
Prerequisites
-
Ensure
BUNNY_ACCOUNT_API_KEYis in your.envfile (for creating zones):BUNNY_ACCOUNT_API_KEY=your_account_api_key_hereNote: File uploads use per-zone
storage_zone_passwordfrom the database, NOT an API key from.env. These passwords are set automatically when sites are created viaprovision-siteorsync-sitescommands. -
Run the database migration:
uv run python scripts/migrate_add_deployment_fields.py
Usage
Automatic Deployment (Recommended)
Content deploys automatically after batch generation completes:
uv run python -m src.cli generate-batch \
--job-file jobs/my_job.json \
--username admin \
--password mypass
Output will show deployment progress after all tiers complete:
Deployment: Starting automatic deployment for project 123...
Deployment: 48 articles, 6 pages deployed
Deployment: Complete in 45.2s
Manual Deployment
Deploy (or re-deploy) a batch manually:
uv run python -m src.cli deploy-batch \
--batch-id 123 \
--admin-user admin \
--admin-password mypass
Dry Run Mode
Preview what would be deployed without actually uploading:
uv run python -m src.cli deploy-batch \
--batch-id 123 \
--dry-run
What Gets Deployed
-
Articles: All generated articles with
formatted_html- Uploaded to:
{slug}.html(e.g.,how-to-fix-engines.html) - URL logged to:
deployment_logs/YYYY-MM-DD_tier1_urls.txt(Tier 1) - URL logged to:
deployment_logs/YYYY-MM-DD_other_tiers_urls.txt(Tier 2+)
- Uploaded to:
-
Boilerplate Pages: About, contact, privacy (if they exist)
- Uploaded to:
about.html,contact.html,privacy.html - NOT logged to URL files
- Uploaded to:
URL Logging
Deployed article URLs are automatically logged to tier-segregated files:
deployment_logs/
2025-10-22_tier1_urls.txt
2025-10-22_other_tiers_urls.txt
Each file contains one URL per line:
https://example.com/article-1.html
https://example.com/article-2.html
https://example.com/article-3.html
Duplicate URLs are automatically prevented (safe to re-run deployments).
Database Updates
After successful deployment, each article is updated with:
deployed_url: Public URL where content is livedeployed_at: Timestamp of deploymentstatus: Changed to 'deployed'
Query deployed content:
from src.database.session import db_manager
from src.database.repositories import GeneratedContentRepository
session = db_manager.get_session()
repo = GeneratedContentRepository(session)
deployed = repo.get_deployed_content(project_id=123)
for article in deployed:
print(f"{article.title}: {article.deployed_url}")
Deployment Summary
After deployment completes, you'll see a summary:
======================================================================
Deployment Summary
======================================================================
Articles deployed: 48
Articles failed: 2
Pages deployed: 6
Pages failed: 0
Total time: 45.2s
Errors:
Article 15 (Engine Maintenance Tips): Connection timeout
Article 32 (Common Problems): Invalid HTML content
======================================================================
Error Handling
By default, deployment continues even if individual files fail. This ensures partial deployments complete successfully.
Failed files are:
- Logged to console with error details
- Listed in deployment summary
- NOT marked as deployed in database
To stop on first error:
uv run python -m src.cli deploy-batch \
--batch-id 123 \
--continue-on-error false
Troubleshooting
"Authentication failed for zone"
Check that the storage_zone_password in your database is correct. This is set when sites are created via provision-site or sync-sites commands.
"Article has no formatted_html to deploy"
Ensure articles have templates applied. This happens automatically during batch processing in _post_process_tier().
"Site not found"
Ensure articles are assigned to sites. This happens automatically during batch processing via site assignment logic.
Manual Re-deployment
To re-deploy content after fixes:
- Fix the issue (update HTML, fix credentials, etc.)
- Run manual deployment:
uv run python -m src.cli deploy-batch --batch-id 123 - Duplicate URLs are automatically prevented in log files
Integration with Other Stories
- Story 3.1: Articles must be assigned to sites before deployment
- Story 3.4: Boilerplate pages are deployed if they exist in
site_pagestable - Story 4.2: URL log files are consumed by post-deployment processes
- Story 4.3: Database status updates enable deployment tracking