From 7e7d34af0e11948f02c74da329a30d1eae002a42 Mon Sep 17 00:00:00 2001 From: Dan Barr Date: Thu, 13 Mar 2025 17:01:36 -0400 Subject: [PATCH 1/6] Add DB backup and restore steps --- docs/how-to/configure.md | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/docs/how-to/configure.md b/docs/how-to/configure.md index 296b6eb..72154c8 100644 --- a/docs/how-to/configure.md +++ b/docs/how-to/configure.md @@ -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: @@ -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 @@ -69,3 +69,32 @@ docker run --name codegate -d -p 8989:8989 -p 9090:9090 \ Replace `` 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. + +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 +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. + +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 +docker cp ./codegate.db codegate:/app/codegate_volume/db/codegate.db +``` From f33c7eb21273bd5e30bd26e88c46fdf8115ec1e7 Mon Sep 17 00:00:00 2001 From: Dan Barr Date: Thu, 13 Mar 2025 17:01:48 -0400 Subject: [PATCH 2/6] Move next steps up higher --- docs/how-to/install.mdx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/how-to/install.mdx b/docs/how-to/install.mdx index 96df2cc..bef40bc 100644 --- a/docs/how-to/install.mdx +++ b/docs/how-to/install.mdx @@ -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: @@ -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 From d93af8f3f0e46027f6fb0634ff32f81b5312ae0b Mon Sep 17 00:00:00 2001 From: Dan Barr Date: Thu, 13 Mar 2025 17:02:02 -0400 Subject: [PATCH 3/6] Fix broken image link --- docs/features/workspaces.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/features/workspaces.mdx b/docs/features/workspaces.mdx index 7e256b7..a70e94e 100644 --- a/docs/features/workspaces.mdx +++ b/docs/features/workspaces.mdx @@ -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'} From c90c8ef5824a3a71e569c9bed495736d5bdb41f5 Mon Sep 17 00:00:00 2001 From: Dan Barr Date: Thu, 13 Mar 2025 17:18:49 -0400 Subject: [PATCH 4/6] Fix npm audit issues --- package-lock.json | 49 ++++++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/package-lock.json b/package-lock.json index dfe8a23..83b8120 100644 --- a/package-lock.json +++ b/package-lock.json @@ -654,25 +654,25 @@ } }, "node_modules/@babel/helpers": { - "version": "7.26.0", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.26.0.tgz", - "integrity": "sha512-tbhNuIxNcVb21pInl3ZSjksLCvgdZy9KwJ8brv993QtIVKJBBkYXz4q4ZbAv31GdnC+R90np23L5FbEBlthAEw==", + "version": "7.26.10", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.26.10.tgz", + "integrity": "sha512-UPYc3SauzZ3JGgj87GgZ89JVdC5dj0AoetR5Bw6wj4niittNyFh6+eOGonYvJ1ao6B8lEa3Q3klS7ADZ53bc5g==", "license": "MIT", "dependencies": { - "@babel/template": "^7.25.9", - "@babel/types": "^7.26.0" + "@babel/template": "^7.26.9", + "@babel/types": "^7.26.10" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/parser": { - "version": "7.26.2", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.26.2.tgz", - "integrity": "sha512-DWMCZH9WA4Maitz2q21SRKHo9QXZxkDsbNZoVD62gusNtNBBqDg9i7uOhASfTfIGNzW+O+r7+jAlM8dwphcJKQ==", + "version": "7.26.10", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.26.10.tgz", + "integrity": "sha512-6aQR2zGE/QFi8JpDLjUZEPYOs7+mhKXm86VaKFiLP35JQwQb6bwUE+XbvkH0EptsYhbNBSUGaUBLKqxH1xSgsA==", "license": "MIT", "dependencies": { - "@babel/types": "^7.26.0" + "@babel/types": "^7.26.10" }, "bin": { "parser": "bin/babel-parser.js" @@ -1928,9 +1928,9 @@ } }, "node_modules/@babel/runtime": { - "version": "7.26.0", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.26.0.tgz", - "integrity": "sha512-FDSOghenHTiToteC/QRlv2q3DhPZ/oOXTBoirfWNx1Cx3TMVcGWQtMMmQcSvb/JjpNeGzx8Pq/b4fKEJuWm1sw==", + "version": "7.26.10", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.26.10.tgz", + "integrity": "sha512-2WJMeRQPHKSPemqk/awGrAiuFfzBmOIPXKizAsVhWH9YJqLZ0H+HS4c8loHGgW6utJ3E/ejXQUsiGaQy2NZ9Fw==", "license": "MIT", "dependencies": { "regenerator-runtime": "^0.14.0" @@ -1940,9 +1940,10 @@ } }, "node_modules/@babel/runtime-corejs3": { - "version": "7.26.0", - "resolved": "https://registry.npmjs.org/@babel/runtime-corejs3/-/runtime-corejs3-7.26.0.tgz", - "integrity": "sha512-YXHu5lN8kJCb1LOb9PgV6pvak43X2h4HvRApcN5SdWeaItQOzfn1hgP6jasD6KWQyJDBxrVmA9o9OivlnNJK/w==", + "version": "7.26.10", + "resolved": "https://registry.npmjs.org/@babel/runtime-corejs3/-/runtime-corejs3-7.26.10.tgz", + "integrity": "sha512-uITFQYO68pMEYR46AHgQoyBg7KPPJDAbGn4jUTIRgCFJIp88MIBUianVOplhZDEec07bp9zIyr4Kp0FCyQzmWg==", + "license": "MIT", "dependencies": { "core-js-pure": "^3.30.2", "regenerator-runtime": "^0.14.0" @@ -1952,14 +1953,14 @@ } }, "node_modules/@babel/template": { - "version": "7.25.9", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.25.9.tgz", - "integrity": "sha512-9DGttpmPvIxBb/2uwpVo3dqJ+O6RooAFOS+lB+xDqoE2PVCE8nfoHMdZLpfCQRLwvohzXISPZcgxt80xLfsuwg==", + "version": "7.26.9", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.26.9.tgz", + "integrity": "sha512-qyRplbeIpNZhmzOysF/wFMuP9sctmh2cFzRAZOn1YapxBsE1i9bJIY586R/WBLfLcmcBlM8ROBiQURnnNy+zfA==", "license": "MIT", "dependencies": { - "@babel/code-frame": "^7.25.9", - "@babel/parser": "^7.25.9", - "@babel/types": "^7.25.9" + "@babel/code-frame": "^7.26.2", + "@babel/parser": "^7.26.9", + "@babel/types": "^7.26.9" }, "engines": { "node": ">=6.9.0" @@ -1993,9 +1994,9 @@ } }, "node_modules/@babel/types": { - "version": "7.26.0", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.26.0.tgz", - "integrity": "sha512-Z/yiTPj+lDVnF7lWeKCIJzaIkI0vYO87dMpZ4bg4TDrFe4XXLFWL1TbXU27gBP3QccxV9mZICCrnjnYlJjXHOA==", + "version": "7.26.10", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.26.10.tgz", + "integrity": "sha512-emqcG3vHrpxUKTrxcblR36dcrcoRDvKmnL/dCL6ZsHaShW80qxCAcNhzQZrpeM765VzEos+xOi4s+r4IXzTwdQ==", "license": "MIT", "dependencies": { "@babel/helper-string-parser": "^7.25.9", From 3d8718ddd212958f1e454780fa6618eb470ab934 Mon Sep 17 00:00:00 2001 From: Dan Barr Date: Fri, 14 Mar 2025 11:35:04 -0400 Subject: [PATCH 5/6] Add file ownership and restart commands --- docs/how-to/configure.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/how-to/configure.md b/docs/how-to/configure.md index 72154c8..76988de 100644 --- a/docs/how-to/configure.md +++ b/docs/how-to/configure.md @@ -85,6 +85,7 @@ 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 ``` @@ -96,5 +97,12 @@ 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 ``` From 22c550475963333ebcc10a56e921f44500f795d6 Mon Sep 17 00:00:00 2001 From: Dan Barr Date: Fri, 14 Mar 2025 13:54:34 -0400 Subject: [PATCH 6/6] Add note --- docs/how-to/configure.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/how-to/configure.md b/docs/how-to/configure.md index 76988de..1b708b7 100644 --- a/docs/how-to/configure.md +++ b/docs/how-to/configure.md @@ -77,7 +77,16 @@ 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. +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 @@ -92,6 +101,8 @@ 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: