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

Commit d90a303

Browse files
authored
Merge branch 'main' into copilot-prov
2 parents 26c7606 + c5ccd2a commit d90a303

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1168
-67259
lines changed

.github/workflows/import_packages.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,19 @@ jobs:
3030
git lfs install
3131
git lfs pull
3232
33+
- name: Download json data
34+
id: download-json-data
35+
uses: dawidd6/action-download-artifact@v7
36+
with:
37+
repo: stacklok/codegate-data
38+
workflow: ".github/workflows/generate-artifact.yml"
39+
workflow_conclusion: success
40+
name: jsonl-files
41+
path: /tmp/
42+
name_is_regexp: true
43+
skip_unpack: false
44+
if_no_artifact_found: ignore
45+
3346
- name: Download artifact
3447
if: ${{ github.event.inputs.enable_artifact_download == 'true' }}
3548
id: download-artifact
@@ -57,9 +70,9 @@ jobs:
5770
export BACKUP_FOLDER=backup
5871
# Conditionally export the variables only if artifact download is enabled
5972
if [ "${{ github.event.inputs.enable_artifact_download }}" == "true" ]; then
60-
python scripts/import_packages.py
73+
python scripts/import_packages.py --jsonl-dir /tmp/jsonl-files/
6174
else
62-
python scripts/import_packages.py --restore_backup False
75+
python scripts/import_packages.py --restore-backup False --jsonl-dir /tmp/jsonl-files/
6376
fi
6477
6578
- name: 'Upload Backup Files'

Dockerfile

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ RUN poetry config virtualenvs.create false && \
2222
COPY . /app
2323

2424
# Build the webapp
25-
FROM node:23.3-slim AS webbuilder
25+
FROM node:22-slim AS webbuilder
2626

2727
# Install curl for downloading the webapp from GH and unzip to extract it
2828
RUN apt-get update && apt-get install -y --no-install-recommends \
@@ -98,9 +98,28 @@ EXPOSE 80
9898
# Set the PYTHONPATH environment variable
9999
ENV PYTHONPATH=/app/src
100100

101-
# Define an argument for vlm_url with a default value
102-
ENV VLLM_URL=https://inference.codegate.ai
101+
# Expose additional env vars
102+
ENV CODEGATE_VLLM_URL=https://inference.codegate.ai
103+
ENV CODEGATE_OPENAI_URL=
104+
ENV CODEGATE_ANTHROPIC_URL=
105+
ENV CODEGATE_OLLAMA_URL=http://host.docker.internal:11434
106+
ENV CODEGATE_APP_LOG_LEVEL=WARNING
107+
ENV CODEGATE_LOG_FORMAT=TEXT
108+
109+
# Copy the initial models in the image to default models
110+
RUN mkdir -p /app/default_models && cp /app/codegate_volume/models/* /app/default_models/
111+
112+
# Define volume for persistent data
113+
VOLUME ["/app/codegate_volume/"]
114+
115+
# This has to be performed after copying from the builder stages.
116+
# Otherwise, the permissions will be reset to root.
117+
USER root
118+
RUN mkdir -p /app/codegate_volume/db
119+
# Make codegate user the owner of codegate_volume directory to allow writing to it
120+
RUN chown -R codegate /app/codegate_volume
121+
USER codegate
103122

104123
# Set the container's default entrypoint
105124
EXPOSE 8989
106-
ENTRYPOINT ["/app/scripts/entrypoint.sh", "/tmp/weaviate_backup", "backup"]
125+
ENTRYPOINT ["/app/scripts/entrypoint.sh"]

README.md

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ Unlike E.T., your code never phones home! 🛸 Codegate is designed with privacy
5151
Make sure you have these tools installed:
5252

5353
- 🐳 [Docker](https://docs.docker.com/get-docker/)
54-
- 🔧 [Docker Compose](https://docs.docker.com/compose/install/)
5554
- 🛠️ [jq](https://stedolan.github.io/jq/download/)
5655
- 💻 [VSCode](https://code.visualstudio.com/download)
5756

@@ -150,11 +149,29 @@ make image-build
150149

151150
### Run the Container
152151
```bash
153-
# Basic usage
154-
docker run -p 8989:8989 codegate:latest
152+
# Basic usage with local image
153+
docker run -p 8989:8989 -p 8990:80 codegate:latest
155154

156-
# With persistent data
157-
docker run -p 8989:8989 -v /path/to/volume:/app/weaviate_data codegate:latest
155+
# With pre-built pulled image
156+
docker pull ghcr.io/stacklok/codegate/codegate:latest
157+
docker run --name codegate -d -p 8989:8989 -p 8990:80 ghcr.io/stacklok/codegate/codegate:latest
158+
159+
# It will mount a volume to /app/codegate_volume
160+
# The directory supports storing Llama CPP models under subidrectoy /models
161+
# A sqlite DB with the messages and alerts is stored under the subdirectory /db
162+
docker run --name codegate -d -v /path/to/volume:/app/codegate_volume -p 8989:8989 -p 8990:80 ghcr.io/stacklok/codegate/codegate:latest
163+
```
164+
165+
### Exposed parameters
166+
- CODEGATE_VLLM_URL: URL for the inference engine (defaults to [https://inference.codegate.ai](https://inference.codegate.ai))
167+
- CODEGATE_OPENAI_URL: URL for OpenAI inference engine (defaults to [https://api.openai.com/v1](https://api.openai.com/v1))
168+
- CODEGATE_ANTHROPIC_URL: URL for Anthropic inference engine (defaults to [https://api.anthropic.com/v1](https://api.anthropic.com/v1))
169+
- CODEGATE_OLLAMA_URL: URL for OLlama inference engine (defaults to [http://localhost:11434/api](http://localhost:11434/api))
170+
- CODEGATE_APP_LOG_LEVEL: Level of debug desired when running the codegate server (defaults to WARNING, can be ERROR/WARNING/INFO/DEBUG)
171+
- CODEGATE_LOG_FORMAT: Type of log formatting desired when running the codegate server (default to TEXT, can be JSON/TEXT)
172+
173+
```bash
174+
docker run -p 8989:8989 -p 8990:80 -e CODEGATE_OLLAMA_URL=http://1.2.3.4:11434/api ghcr.io/stacklok/codegate/codegate:latest
158175
```
159176

160177
## 🤝 Contributing

config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ log_level: "INFO" # One of: ERROR, WARNING, INFO, DEBUG
1919
##
2020

2121
# Model to use for chatting
22-
model_base_path: "./models"
22+
model_base_path: "./codegate_volume/models"
2323

2424
# Context length of the model
2525
chat_model_n_ctx: 32768

config.yaml.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ server_key: "server.key" # Server key file name
5050
##
5151

5252
# Model to use for chatting
53-
chat_model_path: "./models/qwen2.5-coder-1.5b-instruct-q5_k_m.gguf"
53+
chat_model_path: "./codegate_volume/models/qwen2.5-coder-1.5b-instruct-q5_k_m.gguf"
5454

5555
# Context length of the model
5656
chat_model_n_ctx: 32768

0 commit comments

Comments
 (0)