Skip to content

Commit 1e04bcb

Browse files
committed
fix(docs): few fixes after Pete's rewrite
Signed-off-by: Fatih Acar <[email protected]>
1 parent d3d4664 commit 1e04bcb

File tree

2 files changed

+60
-31
lines changed

2 files changed

+60
-31
lines changed

docs/docs/guides/database-backup.mdx

Lines changed: 59 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,24 @@ This guide shows you how to create comprehensive backups of your Infrahub deploy
2626
Install the infrahubops CLI tool:
2727

2828
```bash
29-
curl -L https://github.com/opsmill/infrahub-ops-cli/releases/latest/download/infrahubops-$(uname -s)-$(uname -m) -o infrahubops
29+
curl https://infrahub.opsmill.io/ops/$(uname -s)/$(uname -m) -o infrahubops
3030
chmod +x infrahubops
3131
```
3232

3333
</TabItem>
34-
<TabItem value="manual" label="Manual Process">
34+
<TabItem value="manual" label="Docker Compose">
3535

3636
If you prefer manual control, proceed to backup each component individually as described in the following steps.
3737

38+
</TabItem>
39+
<TabItem value="remote" label="Remote Database">
40+
41+
Alternatively, you can use the [legacy tool](#using-the-python-based-backup-utility) to backup a remote Neo4j database.
42+
3843
</TabItem>
3944
</Tabs>
4045

41-
### Step 2: Backup the Neo4j database
46+
### Step 2: Backup the databases
4247

4348
<Tabs groupId="backup-method">
4449
<TabItem value="infrahubops" label="infrahubops CLI" default>
@@ -62,7 +67,7 @@ Artifact storage backup is planned for future versions and must currently be han
6267
:::
6368

6469
</TabItem>
65-
<TabItem value="docker" label="Docker Compose">
70+
<TabItem value="manual" label="Docker Compose">
6671

6772
Connect to your Neo4j container and create a backup:
6873

@@ -79,6 +84,14 @@ ls backups/
7984
# Output: neo4j-2025-03-24T19-57-18.backup
8085
```
8186

87+
Backup the Prefect PostgreSQL database containing task logs and execution history:
88+
89+
```bash
90+
# Export Prefect database (using default credentials)
91+
docker compose exec -T task-manager-db \
92+
pg_dump -Fc -U postgres -d prefect > prefect.dump
93+
```
94+
8295
</TabItem>
8396
<TabItem value="remote" label="Remote Database">
8497

@@ -119,27 +132,17 @@ For local filesystem storage, copy the artifact directory:
119132

120133
```bash
121134
# Copy artifacts directory to backup location
122-
cp -r /path/to/infrahub/artifacts /backup/artifacts/
135+
docker compose cp -r infrahub-server:/opt/infrahub/storage /backup/artifacts/
123136
```
124137

125138
</TabItem>
126139
</Tabs>
127140

128-
### Step 4: Backup the task management database
129-
130-
Backup the Prefect PostgreSQL database containing task logs and execution history:
131-
132-
```bash
133-
# Export Prefect database (using default credentials)
134-
docker compose exec -T task-manager-db \
135-
pg_dump -Fc -U postgres -d prefect > prefect.dump
136-
```
137-
138141
## Restore from backup
139142

140143
### Step 1: Prepare the environment
141144

142-
Ensure Infrahub services are running before starting the restore process.
145+
Ensure Infrahub services are running before starting the restore process. You can start from a scratch/blank deployment.
143146

144147
<Tabs groupId="restore-method">
145148
<TabItem value="infrahubops" label="infrahubops CLI" default>
@@ -167,12 +170,20 @@ If restoring manually, follow the steps below for each component.
167170
</TabItem>
168171
</Tabs>
169172

170-
### Step 2: Restore the Neo4j database
173+
### Step 2: Restore the databases
171174

172175
<Tabs groupId="restore-method">
173-
<TabItem value="docker" label="Docker Compose" default>
176+
<TabItem value="infrahubops" label="infrahubops CLI" default>
177+
178+
This is automatically handled by infrahubops.
179+
180+
</TabItem>
181+
<TabItem value="manual" label="Docker Compose">
174182

175183
```bash
184+
# Stop app services
185+
docker compose stop task-worker infrahub-server task-manager
186+
176187
# Copy backup directory to container
177188
docker cp database-backup infrahub-database-1:/tmp/backup
178189

@@ -199,6 +210,17 @@ CREATE DATABASE neo4j;
199210
SHOW DATABASES;
200211
```
201212

213+
Restore the task manager PostgreSQL database
214+
215+
```bash
216+
# Restore Prefect database
217+
docker compose exec -T task-manager-db \
218+
pg_restore -d postgres -U postgres --clean --create prefect.dump
219+
220+
# Restart task manager to apply changes
221+
docker compose restart task-manager
222+
```
223+
202224
</TabItem>
203225
<TabItem value="remote" label="Remote Database">
204226

@@ -233,29 +255,28 @@ cp -r /backup/artifacts/ /path/to/infrahub/artifacts/
233255
</TabItem>
234256
</Tabs>
235257

236-
### Step 4: Restore the task management database
237-
238-
```bash
239-
# Restore Prefect database
240-
docker compose exec -T task-manager-db \
241-
pg_restore -d postgres -U postgres --clean --create prefect.dump
258+
### Step 4: Restart Infrahub services
242259

243-
# Restart task manager to apply changes
244-
docker compose restart task-manager
245-
```
260+
<Tabs groupId="restore-restart-services">
261+
<TabItem value="infrahubops" label="infrahubops CLI" default>
246262

247-
### Step 5: Restart Infrahub services
263+
This is automatically handled by infrahubops.
248264

265+
</TabItem>
266+
<TabItem value="manual" label="Docker Compose">
249267
Restart services in the correct order to ensure proper initialization:
250268

251269
```bash
252270
# Restart API servers first
253-
docker compose start infrahub-server
271+
docker compose restart infrahub-server
254272

255273
# Then restart task workers
256-
docker compose start task-worker
274+
docker compose restart task-worker
257275
```
258276

277+
</TabItem>
278+
</Tabs>
279+
259280
## Validation
260281

261282
Verify your restoration was successful:
@@ -302,6 +323,14 @@ If you're running Infrahub with a Neo4j cluster, follow these steps to backup fr
302323
Always run backup and restore commands as the `neo4j` user inside containers to avoid permission issues with data files.
303324
:::
304325

326+
Example cluster topology
327+
328+
| Node | Role |
329+
|------------------|----------|
330+
| `database` | Leader |
331+
| `database-core2` | Follower |
332+
| `database-core3` | Follower |
333+
305334
### Step 1: Create backup from a follower node
306335

307336
```bash

docs/docs/release-notes/infrahub/release-1_2_0.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ The top menu has also been made more compact, to provide a cleaner look.
171171

172172
Users of Neo4j-enterprise and infrahub-enterprise already had the capability to backup the Neo4j database following the process in our [documentation](../../guides/database-backup.mdx).
173173

174-
With Infrahub 1.2.0 there's a new requirement to also backup the PostgreSQL database that is used for Infrahub's internal task and event system. More information can be found in the [Database backup and restore guide](../../guides/database-backup.mdx#full-backup-and-restore-procedure).
174+
With Infrahub 1.2.0 there's a new requirement to also backup the PostgreSQL database that is used for Infrahub's internal task and event system. More information can be found in the [Database backup and restore guide](../../guides/database-backup.mdx#create-a-full-backup).
175175

176176
## Changelog
177177

0 commit comments

Comments
 (0)