Skip to content
This repository was archived by the owner on Jul 23, 2025. It is now read-only.

Commit 3e9b1be

Browse files
bfroemeldanbarr
andauthored
Run CodeGate on remote host (#80)
* Run CodeGate on remote host --------- Co-authored-by: Dan Barr <danbarr@users.noreply.github.com>
1 parent a41b443 commit 3e9b1be

File tree

3 files changed

+64
-1
lines changed

3 files changed

+64
-1
lines changed

docs/how-to/configure.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,56 @@ docker run --name codegate -d -p 8989:8989 -p 9090:9090 \
4242
--mount type=volume,src=codegate_volume,dst=/app/codegate_volume \
4343
--restart unless-stopped ghcr.io/stacklok/codegate
4444
```
45+
46+
## Run CodeGate on a remote host
47+
48+
:::warning
49+
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
52+
that is directly accessible from the Internet!
53+
54+
:::
55+
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.
59+
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`):
94+
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+
```

docs/how-to/install.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@ replace `docker` with `podman` in all commands.
1616

1717
## Run CodeGate
1818

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

2131
To download and run CodeGate with the recommended configuration for full

docusaurus.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ const config: Config = {
182182
prism: {
183183
theme: prismThemes.github,
184184
darkTheme: prismThemes.dracula,
185-
additionalLanguages: ['bash', 'json', 'powershell'],
185+
additionalLanguages: ['bash', 'json', 'powershell', 'docker'],
186186
},
187187
mermaid: {
188188
theme: { light: 'neutral', dark: 'dark' },

0 commit comments

Comments
 (0)