@@ -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+ ```
0 commit comments