@@ -26,19 +26,24 @@ This guide shows you how to create comprehensive backups of your Infrahub deploy
2626Install 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
3030chmod +x infrahubops
3131```
3232
3333</TabItem >
34- <TabItem value = " manual" label = " Manual Process " >
34+ <TabItem value = " manual" label = " Docker Compose " >
3535
3636If 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
6772Connect 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
177188docker cp database-backup infrahub-database-1:/tmp/backup
178189
@@ -199,6 +210,17 @@ CREATE DATABASE neo4j;
199210SHOW 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" >
249267Restart 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
261282Verify your restoration was successful:
@@ -302,6 +323,14 @@ If you're running Infrahub with a Neo4j cluster, follow these steps to backup fr
302323Always 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
0 commit comments