Sync Action
The Sync Action copies databases and files between Quant Cloud environments, perfect for refreshing staging with production data or setting up preview environments.
Repository: quantcdn/quant-cloud-environment-sync-action
What It Does
Section titled “What It Does”- Syncs databases between environments
- Syncs files/volumes between environments
- Handles both types in one operation
- Ensures data consistency
Basic Usage
Section titled “Basic Usage”Sync from production to staging:
- uses: quantcdn/quant-cloud-environment-sync-action@v1 with: api_key: ${{ secrets.QUANT_API_KEY }} organization: my-org app_name: my-app source_environment: production destination_environment: staging sync_database: true sync_files: trueSync Database Only
Section titled “Sync Database Only”- uses: quantcdn/quant-cloud-environment-sync-action@v1 with: api_key: ${{ secrets.QUANT_API_KEY }} organization: my-org app_name: my-app source_environment: production destination_environment: staging sync_database: true sync_files: falseSync Files Only
Section titled “Sync Files Only”- uses: quantcdn/quant-cloud-environment-sync-action@v1 with: api_key: ${{ secrets.QUANT_API_KEY }} organization: my-org app_name: my-app source_environment: production destination_environment: staging sync_database: false sync_files: trueCommon Workflows
Section titled “Common Workflows”Nightly Staging Refresh
Section titled “Nightly Staging Refresh”Automatically refresh staging with production data:
name: Refresh Staging
on: schedule: - cron: '0 2 * * *' # 2 AM daily workflow_dispatch: # Allow manual trigger
jobs: sync: runs-on: ubuntu-latest steps: - uses: quantcdn/quant-cloud-environment-sync-action@v1 with: api_key: ${{ secrets.QUANT_API_KEY }} organization: ${{ secrets.QUANT_ORGANIZATION }} app_name: my-app source_environment: production destination_environment: staging sync_database: true sync_files: true
- name: Notify team run: echo "✅ Staging refreshed with production data"Manual Sync with Approval
Section titled “Manual Sync with Approval”Require manual approval before syncing:
name: Sync to Staging
on: workflow_dispatch: inputs: sync_database: description: 'Sync database' type: boolean default: true sync_files: description: 'Sync files' type: boolean default: true
jobs: sync: runs-on: ubuntu-latest environment: sync-approval # Requires approval steps: - uses: quantcdn/quant-cloud-environment-sync-action@v1 with: api_key: ${{ secrets.QUANT_API_KEY }} organization: ${{ secrets.QUANT_ORGANIZATION }} app_name: my-app source_environment: production destination_environment: staging sync_database: ${{ inputs.sync_database }} sync_files: ${{ inputs.sync_files }}Prepare PR Preview with Data
Section titled “Prepare PR Preview with Data”Create preview environment with production data:
on: pull_request: types: [opened]
jobs: preview: runs-on: ubuntu-latest steps: - uses: quantcdn/quant-cloud-init-action@v1 id: init
# Create PR preview environment - uses: quantcdn/quant-cloud-environment-action@v1 with: operation: create environment_name: pr-${{ github.event.number }}
# Sync production data to preview - uses: quantcdn/quant-cloud-environment-sync-action@v1 with: api_key: ${{ secrets.QUANT_API_KEY }} organization: ${{ secrets.QUANT_ORGANIZATION }} app_name: ${{ steps.init.outputs.quant_application }} source_environment: production destination_environment: pr-${{ github.event.number }} sync_database: true sync_files: falseBest Practices
Section titled “Best Practices”- Use scheduled workflows for regular refreshes
- Require approval for production syncs
- Test sync operations on non-production environments first
- Document sync schedule so team knows when data refreshes
- Consider file size - large file syncs can take time
Next Steps
Section titled “Next Steps”- Backup Action - Create backups before syncing
- Init Action - Environment detection