Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DB backup/restore instructions #107

Merged
merged 6 commits into from
Mar 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/features/workspaces.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ by name to quickly find the desired workspace.
alt='The workspace drop-down menu in the CodeGate dashboard'
sources={{
light: useBaseUrl('/img/features/workspace-menu-light.webp'),
dark: useBaseUrl('/img/quickstart/workspace-menu-dark.webp'),
dark: useBaseUrl('/img/features/workspace-menu-dark.webp'),
}}
title='Workspace menu'
width={'800px'}
Expand Down
52 changes: 50 additions & 2 deletions docs/how-to/configure.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ CodeGate supports the following parameters:
| `CODEGATE_VLLM_URL` | `http://localhost:8000` | Specifies the URL of the vLLM server to use. |
| `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)). |

## Example: Use CodeGate with a remote Ollama server
### Example: Use CodeGate with a remote Ollama server

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

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

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

:::warning

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

Replace `<REMOTE_HOST>` with the IP or DNS name of your remote CodeGate host as
reachable from your client / web browser.

## Back up and restore the database

CodeGate stores workspace configurations and event data in a SQLite database
file located in the `/app/codegate_volume/db` directory inside the container.
This database file is mounted to the persistent Docker volume on your host
system. This means that the database file is not lost when you stop or remove
the container, but it is still a good idea to back up the database file
regularly. You might also want to copy or move your configuration to a different
system.

:::note

The CodeGate container must be running to use these commands.

:::

### Back up

To back up the database, you can use the `docker cp` command to copy the
database file from the container to your host system. For example, if you want
to back up the database to your current working directory, you can run the
following command:

```bash
# Copy the database file from the container to your host system
docker cp codegate:/app/codegate_volume/db/codegate.db ./codegate.db
```

This copies the database file from the container to your current working
directory. You can then copy it to a safe location.

### Restore

You can also use this command to restore the database from a backup. For
example, if you have a backup of the database file in your current working
directory, you can restore it to the container by running:

```bash
# Copy the backup file to the container
docker cp ./codegate.db codegate:/app/codegate_volume/db/codegate.db

# Reset file ownership
docker exec -u root codegate sh -c "chown codegate:codegate /app/codegate_volume/db/codegate.db"

# Restart CodeGate
docker restart codegate
```
12 changes: 6 additions & 6 deletions docs/how-to/install.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,12 @@ need to [modify your configuration](./configure.md).

:::

### Networking
### Next steps

Now that CodeGate is running, proceed to
[configure your AI assistant/agent](../integrations/index.mdx).

## Networking

CodeGate listens on several network ports:

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

## Next steps

Now that CodeGate is running, proceed to
[configure your AI assistant/agent](../integrations/index.mdx).

## Uninstall

If you decide to stop using CodeGate, undo the configuration changes you made to
Expand Down
49 changes: 25 additions & 24 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.