Skip to content

Commit 3006ee8

Browse files
authored
🔧 chore(integrations): add dev docs for integration data load and save scripts (#14480)
1 parent 206f1ba commit 3006ee8

File tree

1 file changed

+67
-1
lines changed

1 file changed

+67
-1
lines changed

develop-docs/integrations/index.mdx

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,70 @@ description: How to setup Sentry integrations. Integrations connect the Sentry s
44
sidebar_order: 80
55
---
66

7-
<PageGrid />
7+
<PageGrid/>
8+
9+
10+
11+
## Integration Backup and Restore Scripts
12+
13+
### Overview
14+
15+
When working on integration development locally, your database contains important configuration that makes integrations work properly. If you run `make reset-db` or need to delete your local environment, you lose all this setup and have to configure integrations from scratch.
16+
There are two scripts that help you backup and restore your local Sentry integration configuration and setup data.
17+
18+
These scripts allow you to:
19+
- **Backup**: Save your current integration state to a JSON file
20+
- **Restore**: Load the integration state back into a clean database
21+
22+
### What Data is Backed Up
23+
24+
The scripts handle the following Sentry models in the correct dependency order:
25+
- `IdentityProvider` - Authentication provider configurations
26+
- `Integration` - Integration instances and settings
27+
- `Identity` - User identity mappings
28+
- `OrganizationIntegration` - Organization-specific integration configurations
29+
30+
### Prerequisites
31+
32+
- Sentry development environment set up locally
33+
- Python environment with Sentry dependencies installed
34+
- Access to your local Sentry database
35+
36+
### Script Files
37+
38+
There are two scripts (exist in `sentry` and `getsentry`):
39+
40+
- `save_integration_data` - Backs up integration data
41+
- `load_integration_data` - Restores integration data
42+
43+
### Usage Instructions
44+
45+
#### Step 1: Save Your Integration Data
46+
47+
Before running `make reset-db` or making any destructive changes, backup your current integration state:
48+
49+
```bash
50+
# Navigate to your Sentry project directory
51+
cd /path/to/sentry # or /path/to/getsentry
52+
53+
# Run the save script
54+
bin/save_integration_data --output-file integration_backup.json
55+
```
56+
57+
#### Step 2: Restore Your Integration Data
58+
59+
After your database is reset and ready, restore your integration configuration:
60+
61+
```bash
62+
# Basic restore (preserves original organization IDs)
63+
bin/load_integration_data --input-file integration_backup.json
64+
```
65+
66+
**Or, if you need to change the organization ID:**
67+
68+
```bash
69+
# Restore and update organization ID for OrganizationIntegration objects
70+
bin/load_integration_data --input-file integration_backup.json --org-id 123
71+
```
72+
73+
After restoring, all the previous integration data will be restored and you can start using the integration for local development again.

0 commit comments

Comments
 (0)