/ Operations / Integrations
Docs/Operations/Integrations

Integrations

Recipes for driving NoSQLSync from CI and scripts, and getting alerts where your team already looks.

Notifications

In Settings → Notifications, choose where each alert goes — in-app, email or Slack. Connecting Slack takes one click and lets you pick a channel. For anything else (PagerDuty, Opsgenie, your own service), use webhooks.

GitHub Actions

Refresh a staging database from production on every release: start an existing migration, wait for it to finish, then validate. Store a write-scoped API key as the NOSQLSYNC_API_KEY secret.

.github/workflows/refresh-staging.yml
name: Refresh staging data
on:
  release:
    types: [published]
  workflow_dispatch:

jobs:
  migrate:
    runs-on: ubuntu-latest
    env:
      API: https://nosqlsync.com/engine
      KEY: ${{ secrets.NOSQLSYNC_API_KEY }}
      MIGRATION_ID: ${{ vars.NOSQLSYNC_MIGRATION_ID }}
    steps:
      - name: Start migration
        run: |
          curl -fsS -X POST "$API/migrations/$MIGRATION_ID/start" -H "Authorization: Bearer $KEY"

      - name: Wait for completion
        run: |
          for i in $(seq 1 120); do
            STATUS=$(curl -fsS "$API/migrations/$MIGRATION_ID" -H "Authorization: Bearer $KEY" | jq -r .status)
            echo "status: $STATUS"
            case "$STATUS" in
              done) exit 0 ;;
              failed|stopped) exit 1 ;;
            esac
            sleep 30
          done
          echo "timed out"; exit 1

      - name: Validate
        run: |
          curl -fsS -X POST "$API/migrations/$MIGRATION_ID/validate" -H "Authorization: Bearer $KEY" \
            | tee report.json | jq -e '.countMatch == true and (.mismatches | length) == 0'

Python script

Create migrations for several collections and start them, safe to re-run thanks to Idempotency-Key:

migrate_all.py
import os, requests

API = "https://nosqlsync.com/engine"
H = {"Authorization": f"Bearer {os.environ['NOSQLSYNC_API_KEY']}"}

SOURCE, TARGET = os.environ["SOURCE_CONN_ID"], os.environ["TARGET_CONN_ID"]

for coll in ["users", "orders", "products"]:
    r = requests.post(f"{API}/migrations", headers={**H, "Idempotency-Key": f"bootstrap-{coll}"}, json={
        "name": f"{coll} → postgres",
        "sourceConnectionId": SOURCE,
        "targetConnectionId": TARGET,
        "sourceDatabase": "shop",
        "sourceCollection": coll,
        "targetTable": coll,
        "mode": "cdc",
    })
    r.raise_for_status()
    mid = r.json()["id"]

    # Infer and save the schema mapping, then start
    requests.post(f"{API}/migrations/{mid}/schema/introspect", headers=H, json={}).raise_for_status()
    requests.post(f"{API}/migrations/{mid}/start", headers=H).raise_for_status()
    print("started", coll, mid)
i

Introspection saves the inferred mapping (keeping any columns you already edited), so the migration can start right away. Adjust it first with PUT /migrations/:id/schema if you need different types or names.

Status dashboards

  • Poll GET /live-sync/metrics with a read-scoped key to chart lag for every live sync in Grafana or Datadog.
  • Or subscribe to GET /events (Server-Sent Events) to push status changes into your own tooling as they happen.