Skip to content

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

  1. Syncs databases between environments
  2. Syncs files/volumes between environments
  3. Handles both types in one operation
  4. Ensures data consistency

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: true
- 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: false
- 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: true

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"

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 }}

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: false
  1. Use scheduled workflows for regular refreshes
  2. Require approval for production syncs
  3. Test sync operations on non-production environments first
  4. Document sync schedule so team knows when data refreshes
  5. Consider file size - large file syncs can take time