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

Commit bc217f3

Browse files
authored
Merge pull request #1704 from janhq/dev
sync dev to main 1.0.3-rc1
2 parents 3932539 + 37fecbd commit bc217f3

File tree

16 files changed

+583
-173
lines changed

16 files changed

+583
-173
lines changed

README.md

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,18 @@ Cortex also has a [Network Installer](#network-installer) which downloads the ne
5656

5757
<h4>
5858
<img src='https://github.com/janhq/docs/blob/main/static/img/linux.png' style="height:15px; width: 15px" />
59-
Linux:
60-
<a href='https://app.cortexcpp.com/download/latest/linux-amd64-local'><b>cortex.deb</b></a> (Coming soon: Linux installation script)
59+
Linux debian based distros:
60+
<a href='https://app.cortexcpp.com/download/latest/linux-amd64-local'><b>cortex-linux-local-installer.deb</b></a>
6161
</h4>
6262

6363
- For Linux: Download the installer and run the following command in terminal:
6464

6565
```bash
66-
sudo apt install ./cortex-local-installer.deb
66+
# Linux debian based distros
67+
curl -s https://raw.githubusercontent.com/janhq/cortex/main/engine/templates/linux/install.sh | sudo bash -s -- --deb_local
68+
69+
# Other Linux distros
70+
curl -s https://raw.githubusercontent.com/janhq/cortex/main/engine/templates/linux/install.sh | sudo bash -s
6771
```
6872

6973
- The binary will be installed in the `/usr/bin/` directory.
@@ -149,6 +153,28 @@ Select a model (1-9):
149153
```
150154

151155
## Advanced Installation
156+
157+
### Network Installer (Stable)
158+
159+
Cortex.cpp is available with a Network Installer, which is a smaller installer but requires internet connection during installation to download the necessary dependencies.
160+
161+
<h4>
162+
<img src='https://github.com/janhq/docs/blob/main/static/img/windows.png' style="height:14px; width: 14px" />
163+
Windows:
164+
<a href='https://app.cortexcpp.com/download/latest/windows-amd64-local'><b>cortex-windows-network-installer.exe</b></a>
165+
</h4>
166+
167+
<h4>
168+
<img src='https://github.com/janhq/docs/blob/main/static/img/mac.png' style="height:15px; width: 15px" />
169+
MacOS (Universal):
170+
<a href='https://app.cortexcpp.com/download/latest/mac-universal-network'><b>cortex-mac-network-installer.pkg</b></a>
171+
</h4>
172+
173+
<h4>
174+
<img src='https://github.com/janhq/docs/blob/main/static/img/linux.png' style="height:14px; width: 15px" />
175+
Linux debian based distros:
176+
<a href='https://app.cortexcpp.com/download/latest/linux-amd64-network'><b>cortex-linux-network-installer.deb</b></a>
177+
</h4>
152178

153179
### Beta & Nightly Versions (Local Installer)
154180

@@ -163,7 +189,7 @@ Cortex releases Beta and Nightly versions for advanced users to try new features
163189
<td style="text-align:center"><b>Version</b></td>
164190
<td style="text-align:center"><b>Windows</b></td>
165191
<td style="text-align:center"><b>MacOS</b></td>
166-
<td style="text-align:center"><b>Linux</b></td>
192+
<td style="text-align:center"><b>Linux debian based distros</b></td>
167193
</tr>
168194
<tr style="text-align:center">
169195
<td style="text-align:center"><b>Beta (Preview)</b></td>
@@ -218,7 +244,7 @@ Cortex.cpp is available with a Network Installer, which is a smaller installer b
218244
<td style="text-align:center"><b>Version Type</b></td>
219245
<td style="text-align:center"><b>Windows</b></td>
220246
<td style="text-align:center"><b>MacOS</b></td>
221-
<td style="text-align:center"><b>Linux</b></td>
247+
<td style="text-align:center"><b>Linux debian based distros</b></td>
222248
</tr>
223249
<tr style="text-align:center">
224250
<td style="text-align:center"><b>Stable (Recommended)</b></td>

docs/docs/configurations/index.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ title: Cortex configurations
88
Welcome to the Cortex configurations documentation. Here you will find detailed guides and references for configuring various aspects of Cortex, including:
99

1010
- **CORS**: Learn how to set up Cross-Origin Resource Sharing.
11+
- **Proxy**: Configure the proxy for Cortex.
1112

1213
Use the sidebar to navigate through the different configuration topics.

docs/docs/configurations/proxy.mdx

Lines changed: 207 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,207 @@
1+
---
2+
title: Proxy
3+
description: Setting up Proxy
4+
slug: "proxy"
5+
---
6+
7+
import Tabs from "@theme/Tabs";
8+
import TabItem from "@theme/TabItem";
9+
10+
:::warning
11+
🚧 Cortex.cpp is currently under development. Our documentation outlines the intended behavior of Cortex, which may not yet be fully implemented in the codebase.
12+
:::
13+
14+
# Proxy Configuration Guide
15+
16+
This document describes how to configure proxy settings for Cortex to be able to work behind your proxy.
17+
18+
## Command Line Interface (CLI)
19+
20+
### Basic Usage
21+
22+
```bash
23+
cortex config [OPTIONS] [COMMAND]
24+
```
25+
26+
### Commands
27+
28+
- `status`: Display all current configurations
29+
30+
```bash
31+
cortex config status
32+
```
33+
34+
Example Output:
35+
36+
```bash
37+
+-----------------------+------------------------+
38+
| Config name | Value |
39+
+-----------------------+------------------------+
40+
| no_proxy | localhost,127.0.0.1 |
41+
+-----------------------+------------------------+
42+
| proxy_password | |
43+
+-----------------------+------------------------+
44+
| proxy_url | http://localhost:8080 |
45+
+-----------------------+------------------------+
46+
| proxy_username | |
47+
+-----------------------+------------------------+
48+
| verify_host_ssl | true |
49+
+-----------------------+------------------------+
50+
| verify_peer_ssl | false |
51+
+-----------------------+------------------------+
52+
| verify_proxy_host_ssl | true |
53+
+-----------------------+------------------------+
54+
| verify_proxy_ssl | true |
55+
+-----------------------+------------------------+
56+
```
57+
58+
### Options
59+
60+
| Option | Description | Example |
61+
| ----------------------------------- | --------------------------- | ------------------------------------------------- |
62+
| `-h, --help` | Print help message and exit |
63+
| `--proxy_url <proxy_url>` | Set the proxy URL | `cortex config --proxy_url http://localhost:8080` |
64+
| `--proxy_username <proxy_username>` | Set the username for proxy | `cortex config --proxy_username my_username` |
65+
| `--proxy_password <proxy_password>` | Set the password for proxy | `cortex config --proxy_password my_password` |
66+
| `--no_proxy <no_proxy>` | Set the no_proxy list | `cortex config --no_proxy localhost,127.0.0.1` |
67+
| `--verify_proxy_ssl [on/off]` | Verify proxy SSL | `cortex config --verify_proxy_ssl on` |
68+
| `--verify_proxy_host_ssl [on/off]` | Verify proxy host SSL | `cortex config --verify_proxy_host_ssl on` |
69+
| `--verify_peer_ssl [on/off]` | Verify peer SSL | `cortex config --verify_peer_ssl off` |
70+
| `--verify_host_ssl [on/off]` | Verify host SSL | `cortex config --verify_host_ssl on` |
71+
72+
## Proxy API Configuration
73+
74+
### Endpoints
75+
76+
#### Get Current Configuration
77+
78+
```http
79+
GET /v1/configs
80+
```
81+
82+
Retrieves the current configuration settings.
83+
84+
##### Response
85+
86+
```json
87+
{
88+
"allowed_origins": [
89+
"http://localhost:39281",
90+
"http://127.0.0.1:39281",
91+
"http://0.0.0.0:39281"
92+
],
93+
"cors": true,
94+
"no_proxy": "localhost,127.0.0.1",
95+
"proxy_password": "",
96+
"proxy_url": "http://localhost:8080",
97+
"proxy_username": "",
98+
"verify_host_ssl": true,
99+
"verify_peer_ssl": false,
100+
"verify_proxy_host_ssl": true,
101+
"verify_proxy_ssl": true
102+
}
103+
```
104+
105+
#### Update Configuration
106+
107+
```http
108+
PATCH /v1/configs
109+
```
110+
111+
Updates proxy configuration settings.
112+
113+
##### Request Headers
114+
115+
```
116+
Content-Type: application/json
117+
```
118+
119+
##### Request Body
120+
121+
```json
122+
{
123+
"no_proxy": "localhost",
124+
"proxy_url": "http://localhost:8080",
125+
"proxy_username": "my_username",
126+
"proxy_password": "my_password",
127+
"verify_host_ssl": false,
128+
"verify_peer_ssl": false,
129+
"verify_proxy_host_ssl": false,
130+
"verify_proxy_ssl": false
131+
}
132+
```
133+
134+
##### Parameters
135+
136+
| Field | Type | Description |
137+
| ----------------------- | ------- | -------------------------------------------------------------------------------------- |
138+
| `no_proxy` | string | List of origins which request do not need to go through a proxy. Comma separated value |
139+
| `proxy_url` | string | Proxy URL |
140+
| `proxy_username` | string | Username for proxy authentication |
141+
| `proxy_password` | string | Password for proxy authentication |
142+
| `verify_host_ssl` | boolean | Verify host SSL |
143+
| `verify_peer_ssl` | boolean | Verify peer SSL |
144+
| `verify_proxy_host_ssl` | boolean | Verify proxy host SSL |
145+
| `verify_proxy_ssl` | boolean | Verify proxy SSL |
146+
147+
##### Response
148+
149+
```json
150+
{
151+
"config": {
152+
"allowed_origins": [
153+
"http://localhost:39281",
154+
"http://127.0.0.1:39281",
155+
"http://0.0.0.0:39281"
156+
],
157+
"cors": true,
158+
"no_proxy": "localhost",
159+
"proxy_password": "my_password",
160+
"proxy_url": "http://localhost:8080",
161+
"proxy_username": "my_username",
162+
"verify_host_ssl": false,
163+
"verify_peer_ssl": false,
164+
"verify_proxy_host_ssl": false,
165+
"verify_proxy_ssl": false
166+
},
167+
"message": "Configuration updated successfully"
168+
}
169+
```
170+
171+
## Testing proxy configuration
172+
173+
You can test your proxy configuration using [mitmproxy](https://docs.mitmproxy.org/stable). This guide is written on macOS, but you can use it on any other platform.
174+
175+
### Install mitmproxy
176+
177+
```bash
178+
brew install mitmproxy
179+
```
180+
181+
### Start mitmproxy
182+
183+
```bash
184+
mitmproxy --set stream_large_bodies=1m
185+
```
186+
187+
mitmproxy will start on port `8080`. After mitmproxy started, you can adding options by pressing `O`. mitmproxy will display an option screen. You can check their document to learn more about mitmproxy. But let's take a simple option for now by setting the `proxyauth` for our local proxy. Inside the option screen, search for `proxyauth` and hit enter. Then, type `username:password` and hit enter again. You will see your newly added option is red-colored.
188+
189+
### Configuring Cortex to use that proxy
190+
191+
Let's using CLI to configure Cortex to use that proxy.
192+
193+
```bash
194+
cortex config --proxy_url http://localhost:8080 --proxy_username username --proxy_password password
195+
```
196+
197+
### Testing the proxy
198+
199+
Now, let's test the proxy. If you are setting the username and password correctly (same with `proxyauth` in mitmproxy), you will see the request in mitmproxy. For example, command `cortex pull tinyllama` should be successfully and returns a list of selectable models. Also, you will see your request in mitmproxy CLI screen.
200+
201+
Let's try to use a wrong authentication for your proxy.
202+
203+
```bash
204+
cortex config --proxy_password wrong_pw
205+
```
206+
207+
Now, let's test the proxy again. You will see the request is failed and returns an error.

0 commit comments

Comments
 (0)