Skip to content

Commit 2d66e20

Browse files
authored
Add DB backup/restore instructions (#107)
1 parent 8d22650 commit 2d66e20

File tree

4 files changed

+82
-33
lines changed

4 files changed

+82
-33
lines changed

docs/features/workspaces.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ by name to quickly find the desired workspace.
9595
alt='The workspace drop-down menu in the CodeGate dashboard'
9696
sources={{
9797
light: useBaseUrl('/img/features/workspace-menu-light.webp'),
98-
dark: useBaseUrl('/img/quickstart/workspace-menu-dark.webp'),
98+
dark: useBaseUrl('/img/features/workspace-menu-dark.webp'),
9999
}}
100100
title='Workspace menu'
101101
width={'800px'}

docs/how-to/configure.md

+50-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ CodeGate supports the following parameters:
3333
| `CODEGATE_VLLM_URL` | `http://localhost:8000` | Specifies the URL of the vLLM server to use. |
3434
| `DASHBOARD_BASE_API_URL` | `http://localhost:8989` | Overrides the base URL of the CodeGate API referenced by the dashboard UI (see [run CodeGate on a remote host](#run-on-remote-host)). |
3535

36-
## Example: Use CodeGate with a remote Ollama server
36+
### Example: Use CodeGate with a remote Ollama server
3737

3838
Set the Ollama server's URL when you launch CodeGate:
3939

@@ -44,7 +44,7 @@ docker run --name codegate -d -p 8989:8989 -p 9090:9090 \
4444
--restart unless-stopped ghcr.io/stacklok/codegate
4545
```
4646

47-
## Example: run CodeGate on a remote host {#run-on-remote-host}
47+
### Example: run CodeGate on a remote host {#run-on-remote-host}
4848

4949
:::warning
5050

@@ -69,3 +69,51 @@ docker run --name codegate -d -p 8989:8989 -p 9090:9090 \
6969

7070
Replace `<REMOTE_HOST>` with the IP or DNS name of your remote CodeGate host as
7171
reachable from your client / web browser.
72+
73+
## Back up and restore the database
74+
75+
CodeGate stores workspace configurations and event data in a SQLite database
76+
file located in the `/app/codegate_volume/db` directory inside the container.
77+
This database file is mounted to the persistent Docker volume on your host
78+
system. This means that the database file is not lost when you stop or remove
79+
the container, but it is still a good idea to back up the database file
80+
regularly. You might also want to copy or move your configuration to a different
81+
system.
82+
83+
:::note
84+
85+
The CodeGate container must be running to use these commands.
86+
87+
:::
88+
89+
### Back up
90+
91+
To back up the database, you can use the `docker cp` command to copy the
92+
database file from the container to your host system. For example, if you want
93+
to back up the database to your current working directory, you can run the
94+
following command:
95+
96+
```bash
97+
# Copy the database file from the container to your host system
98+
docker cp codegate:/app/codegate_volume/db/codegate.db ./codegate.db
99+
```
100+
101+
This copies the database file from the container to your current working
102+
directory. You can then copy it to a safe location.
103+
104+
### Restore
105+
106+
You can also use this command to restore the database from a backup. For
107+
example, if you have a backup of the database file in your current working
108+
directory, you can restore it to the container by running:
109+
110+
```bash
111+
# Copy the backup file to the container
112+
docker cp ./codegate.db codegate:/app/codegate_volume/db/codegate.db
113+
114+
# Reset file ownership
115+
docker exec -u root codegate sh -c "chown codegate:codegate /app/codegate_volume/db/codegate.db"
116+
117+
# Restart CodeGate
118+
docker restart codegate
119+
```

docs/how-to/install.mdx

+6-6
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,12 @@ need to [modify your configuration](./configure.md).
9696

9797
:::
9898

99-
### Networking
99+
### Next steps
100+
101+
Now that CodeGate is running, proceed to
102+
[configure your AI assistant/agent](../integrations/index.mdx).
103+
104+
## Networking
100105

101106
CodeGate listens on several network ports:
102107

@@ -179,11 +184,6 @@ originally.
179184
Use standard `docker`/`podman` commands to manage the CodeGate container and
180185
persistent volume.
181186

182-
## Next steps
183-
184-
Now that CodeGate is running, proceed to
185-
[configure your AI assistant/agent](../integrations/index.mdx).
186-
187187
## Uninstall
188188

189189
If you decide to stop using CodeGate, undo the configuration changes you made to

package-lock.json

+25-24
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)