Skip to content

Commit a280296

Browse files
committed
Update the method for running CodeGate remotely
New DASHBOARD_BASE_API_URL parameter added in stacklok/codegate#1231
1 parent 1364a91 commit a280296

File tree

2 files changed

+37
-62
lines changed

2 files changed

+37
-62
lines changed

docs/how-to/configure.md

+26-52
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,16 @@ docker run --name codegate -d -p 8989:8989 -p 9090:9090 \
2222

2323
CodeGate supports the following parameters:
2424

25-
| Parameter | Default value | Description |
26-
| :----------------------- | :---------------------------------- | :----------------------------------------------------------------------------------------- |
27-
| `CODEGATE_APP_LOG_LEVEL` | `WARNING` | Sets the logging level. Valid values: `ERROR`, `WARNING`, `INFO`, `DEBUG` (case sensitive) |
28-
| `CODEGATE_LOG_FORMAT` | `TEXT` | Type of log formatting. Valid values: `TEXT`, `JSON` (case sensitive) |
29-
| `CODEGATE_ANTHROPIC_URL` | `https://api.anthropic.com/v1` | Specifies the Anthropic engine API endpoint URL. |
30-
| `CODEGATE_LM_STUDIO_URL` | `http://host.docker.internal:1234` | Specifies the URL of your LM Studio server. |
31-
| `CODEGATE_OLLAMA_URL` | `http://host.docker.internal:11434` | Specifies the URL of your Ollama instance. |
32-
| `CODEGATE_OPENAI_URL` | `https://api.openai.com/v1` | Specifies the OpenAI engine API endpoint URL. |
33-
| `CODEGATE_VLLM_URL` | `http://localhost:8000` | Specifies the URL of the vLLM server to use. |
25+
| Parameter | Default value | Description |
26+
| :----------------------- | :---------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------ |
27+
| `CODEGATE_APP_LOG_LEVEL` | `WARNING` | Sets the logging level. Valid values: `ERROR`, `WARNING`, `INFO`, `DEBUG` (case sensitive) |
28+
| `CODEGATE_LOG_FORMAT` | `TEXT` | Type of log formatting. Valid values: `TEXT`, `JSON` (case sensitive) |
29+
| `CODEGATE_ANTHROPIC_URL` | `https://api.anthropic.com/v1` | Specifies the Anthropic engine API endpoint URL. |
30+
| `CODEGATE_LM_STUDIO_URL` | `http://host.docker.internal:1234` | Specifies the URL of your LM Studio server. |
31+
| `CODEGATE_OLLAMA_URL` | `http://host.docker.internal:11434` | Specifies the URL of your Ollama instance. |
32+
| `CODEGATE_OPENAI_URL` | `https://api.openai.com/v1` | Specifies the OpenAI engine API endpoint URL. |
33+
| `CODEGATE_VLLM_URL` | `http://localhost:8000` | Specifies the URL of the vLLM server to use. |
34+
| `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)). |
3435

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

@@ -43,55 +44,28 @@ docker run --name codegate -d -p 8989:8989 -p 9090:9090 \
4344
--restart unless-stopped ghcr.io/stacklok/codegate
4445
```
4546

46-
## Run CodeGate on a remote host
47+
## Example: run CodeGate on a remote host {#run-on-remote-host}
4748

4849
:::warning
4950

50-
Keep security aspects in mind and run CodeGate only on a remote host within a
51-
local or otherwise secured network. CodeGate should not be run on a remote host
51+
For security reason,s only run CodeGate on a remote host within a local or
52+
otherwise secured/trusted network. CodeGate should not be run on a remote host
5253
that is directly accessible from the Internet!
5354

5455
:::
5556

56-
The CodeGate web dashboard provided in the Docker container expects the CodeGate
57-
API to be available on _localhost_ port 8989. Currently this is statically set
58-
during build time and cannot be changed with a runtime configuration parameter.
57+
The CodeGate web dashboard provided in the Docker container makes client-side
58+
API calls from your web browser, and expects the CodeGate API to be available on
59+
_localhost_ port 8989 by default. To run CodeGate on a different host from your
60+
client/browser, you can override this using the `DASHBOARD_BASE_API_URL`
61+
environment variable (available since CodeGate v0.1.28):
5962

60-
Hence to run CodeGate on a remote host you need to build your own appropriately
61-
customized Docker container image from the CodeGate GitHub repository. Use the
62-
following steps as a reference and adjust them for your own setup:
63-
64-
1. Clone the CodeGate GitHub repository:
65-
66-
```shell
67-
git clone https://github.com/stacklok/codegate.git
68-
cd codegate
69-
```
70-
71-
2. Edit `./Dockerfile` to add the `VITE_BASE_API_URL` environment variable
72-
_before_ the web dashboard build step:
73-
74-
```dockerfile {1-3} title="./Dockerfile"
75-
# Customize the API base URL
76-
ENV VITE_BASE_API_URL=http://<REMOTE_HOST>:8989
77-
# End customization
78-
79-
# Install the webapp dependencies and build it
80-
RUN npm install
81-
RUN npm run build
82-
```
83-
84-
Replace `<REMOTE_HOST>` with the IP or DNS name of the remote host where
85-
CodeGate will run.
86-
87-
3. Build the customized Docker image on the remote host:
88-
89-
```shell
90-
make image-build
91-
```
92-
93-
4. Run the customized Docker image (built locally as `codegate:latest`):
63+
```bash {2}
64+
docker run --name codegate -d -p 8989:8989 -p 9090:9090 \
65+
-e DASHBOARD_BASE_API_URL=http://<REMOTE_HOST>:8989 \
66+
--mount type=volume,src=codegate_volume,dst=/app/codegate_volume \
67+
--restart unless-stopped ghcr.io/stacklok/codegate
68+
```
9469

95-
```shell
96-
docker run --name codegate -d -p 8989:8989 -p 9090:9090 -p 8990:8990 --mount type=volume,src=codegate_volume,dst=/app/codegate_volume --restart unless-stopped codegate:latest
97-
```
70+
Replace `<REMOTE_HOST>` with the IP or DNS name of your remote CodeGate host as
71+
reachable from your client / web browser.

docs/how-to/install.mdx

+11-10
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,6 @@ Podman, replace `docker` with `podman` in all commands.
1818

1919
## Run CodeGate
2020

21-
CodeGate is primarily intended as a single-user system. There is no
22-
authentication when using the CodeGate API or the CodeGate web dashboard which
23-
are both operating over unencrypted HTTP. Hence all CodeGate components are
24-
supposed to bind to _localhost_ (`127.0.0.1`) and remain inaccessible from
25-
remote hosts.
26-
27-
If you are an advanced user who wants to run CodeGate on a remote host in a
28-
secured/local network, see
29-
[Run CodeGate on a remote host](./configure.md#run-codegate-on-a-remote-host).
30-
3121
### Recommended settings
3222

3323
To download and run CodeGate with the recommended configuration for full
@@ -61,6 +51,17 @@ lost when you stop or restart CodeGate.
6151

6252
:::
6353

54+
:::info
55+
56+
CodeGate is primarily intended as a single-user system. The CodeGate API and web
57+
dashboard operate over unencrypted HTTP and with no authentication.
58+
59+
If you are an advanced user who want to run CodeGate on a remote host in a
60+
secured/local network, see
61+
[Run CodeGate on a remote host](./configure.md#run-on-remote-host).
62+
63+
:::
64+
6465
### Alternative run commands \{#examples}
6566

6667
Run with minimal functionality for use with **Continue**, **aider**, or

0 commit comments

Comments
 (0)