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. Waits for completion with configurable timeouts
  4. Ensures data consistency

Sync database 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
environment_name: staging
source: production
type: database
- uses: quantcdn/quant-cloud-environment-sync-action@v1
with:
api_key: ${{ secrets.QUANT_API_KEY }}
organization: my-org
app_name: my-app
environment_name: staging
source: production
type: database
- uses: quantcdn/quant-cloud-environment-sync-action@v1
with:
api_key: ${{ secrets.QUANT_API_KEY }}
organization: my-org
app_name: my-app
environment_name: staging
source: production
type: filesystem

Wait for the sync to complete before proceeding:

- uses: quantcdn/quant-cloud-environment-sync-action@v1
with:
api_key: ${{ secrets.QUANT_API_KEY }}
organization: my-org
app_name: my-app
environment_name: staging
source: production
type: database
wait: true
wait_interval: 10
max_retries: 30

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:
# Sync database
- uses: quantcdn/quant-cloud-environment-sync-action@v1
with:
api_key: ${{ secrets.QUANT_API_KEY }}
organization: ${{ secrets.QUANT_ORGANIZATION }}
app_name: my-app
environment_name: staging
source: production
type: database
wait: true
# Sync filesystem
- uses: quantcdn/quant-cloud-environment-sync-action@v1
with:
api_key: ${{ secrets.QUANT_API_KEY }}
organization: ${{ secrets.QUANT_ORGANIZATION }}
app_name: my-app
environment_name: staging
source: production
type: filesystem
wait: 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_type:
description: 'Type of sync'
type: choice
options:
- database
- filesystem
default: database
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
environment_name: staging
source: production
type: ${{ inputs.sync_type }}
wait: true

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 }}
environment_name: pr-${{ github.event.number }}
source: production
type: database
wait: true
  • api_key: Quant API key (required)
  • organization: Quant organisation ID (required)
  • app_name: Name of your application (required)
  • environment_name: Name for the target environment (required)
  • source: Name of the source environment (required)
  • type: Type of data to sync - database or filesystem (optional, default: database)
  • wait: Whether to wait for the sync to complete (optional, default: false)
  • wait_interval: Interval in seconds between status checks (optional, default: 10)
  • max_retries: Maximum number of retries before timing out (optional, default: 30)
  • base_url: Quant Cloud API URL (optional, default: https://dashboard.quantcdn.io/api/v3)
  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
  6. Use wait: true when you need to ensure sync completes before proceeding
  7. Adjust max_retries based on expected sync duration (default timeout: 5 minutes)