Skip to content

Commit

Permalink
feat: Python native WSProxy (#2372)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyujin-cho authored Jul 4, 2024
1 parent 4739d81 commit 2fefe02
Show file tree
Hide file tree
Showing 55 changed files with 4,093 additions and 202 deletions.
64 changes: 0 additions & 64 deletions .github/workflows/build-static-wsproxy.yml

This file was deleted.

44 changes: 0 additions & 44 deletions .github/workflows/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -256,44 +256,6 @@ jobs:
cache: "pip"
# For linux-aarch64 runner, we assume that we have the correct prebuilt Python version already.

- name: Unpack local-proxy binaries
run: |
OS_TYPE=$(uname -s)
CPU_ARCH=$(uname -m)
SYSTEM="$OS_TYPE $CPU_ARCH"
case "$SYSTEM" in
"Linux x86_64" )
SRC_PLATFORM="linux-x64"
DST_PLATFORM="linux-x86_64"
CHECKSUM_CMD="sha256sum"
;;
"Linux aarch64" )
SRC_PLATFORM="linux-arm64"
DST_PLATFORM="linux-aarch64"
CHECKSUM_CMD="sha256sum"
;;
"Darwin x86_64" )
SRC_PLATFORM="macos-x64"
DST_PLATFORM="macos-x86_64"
CHECKSUM_CMD="shasum -a 256"
;;
"Darwin arm64" )
SRC_PLATFORM="macos-arm64"
DST_PLATFORM="macos-aarch64"
CHECKSUM_CMD="shasum -a 256"
;;
esac
mkdir dist-local-proxy
# Normalize the package naming
unzip "src/ai/backend/web/assets/backend.ai-local-proxy-$SRC_PLATFORM.zip"
mv "backend.ai-local-proxy" "dist-local-proxy/backendai-local-proxy-$DST_PLATFORM"
cd dist-local-proxy
ls | xargs -I{} sh -c "$CHECKSUM_CMD {} > {}.sha256"
- name: Upload local-proxy binaries
uses: actions/upload-artifact@v4
with:
name: local-proxy-${{ matrix.os }}
path: dist-local-proxy/*
- name: Bootstrap Pants
uses: pantsbuild/actions/init-pants@v8
with:
Expand Down Expand Up @@ -438,12 +400,6 @@ jobs:
pattern: scies-*
path: dist
merge-multiple: true
- name: Download local-proxy
uses: actions/download-artifact@v4
with:
pattern: local-proxy-*
path: dist
merge-multiple: true
- name: Download SBOM report
uses: actions/download-artifact@v4
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ ENV/
/dev.etcd.installed.json
/env-*.sh
/agent.dummy.toml
/wsproxy.toml

# Local temp and installer-generated directories
/.tmp/
Expand Down
1 change: 1 addition & 0 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ python_requirements(
"pycryptodome": ["Crypto"],
"python-dateutil": ["dateutil", "dateutil.parser", "dateutil.tz"],
"python-json-logger": ["pythonjsonlogger"],
"pyhumps": ["humps"],
"pyzmq": ["zmq"],
"PyYAML": ["yaml"],
"typing-extensions": ["typing_extensions"],
Expand Down
1 change: 1 addition & 0 deletions changes/2372.feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Introduce Python native WSProxy
12 changes: 12 additions & 0 deletions configs/wsproxy/halfstack.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[wsproxy]
bind_host = "0.0.0.0"
advertised_host = "127.0.0.1"

bind_api_port = 5050
advertised_api_port = 5050

# replace these values with your passphrase
jwt_encrypt_key = "QRX/ZX2nwKKpuTSD3ZycPA"
permit_hash_key = "gHNAohmntRV0t9zlwTVQeQ"

api_secret = "v625xZLOgbMHhl0s49VuqQ"
76 changes: 76 additions & 0 deletions configs/wsproxy/sample.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
[wsproxy]
ipc_base_path = "/tmp/backend.ai/ipc"
event_loop = "asyncio"
pid_file = "/run/backend.ai/wsproxy/wsproxy.pid"
id = "i-node01"
user = 501
group = 501
bind_host = "0.0.0.0"
advertised_host = "example.com"
bind_api_port = 5050
advertised_api_port = 15050
bind_proxy_port_range = [
10200,
10300,
]
advertised_proxy_port_range = [
20200,
20300,
]
protocol = "http"

# replace these values with your passphrase
jwt_encrypt_key = "50M3G00DL00KING53CR3T"
permit_hash_key = "50M3G00DL00KING53CR3T"
api_secret = "50M3G00DL00KING53CR3T"

aiomonitor_termui_port = 48500
aiomonitor_webui_port = 49500

[logging]
level = "INFO"
drivers = [
"console",
]

[logging.pkg_ns]
"" = "WARNING"
"ai.backend" = "DEBUG"
tests = "DEBUG"
aiohttp = "INFO"

[logging.console]
colored = true
format = "verbose"

[logging.file]
path = "/var/log/backend.ai"
filename = "wsproxy.log"
backup_count = 5
rotation_size = "10M"
format = "verbose"

[logging.logstash]
protocol = "tcp"
ssl_enabled = true
ssl_verify = true

[logging.logstash.endpoint]
host = "127.0.0.1"
port = 8001

[logging.graylog]
host = "127.0.0.1"
port = 8000
level = "INFO"
ssl_verify = true
ca_certs = "/etc/ssl/ca.pem"
keyfile = "/etc/backend.ai/graylog/privkey.pem"
certfile = "/etc/backend.ai/graylog/cert.pem"

[debug]
enabled = false
asyncio = false
enhanced_aiomonitor_task_info = false
log_events = false

4 changes: 3 additions & 1 deletion fixtures/manager/example-users.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@
"driver": "static",
"driver_opts": {},
"scheduler": "fifo",
"scheduler_opts": {}
"scheduler_opts": {},
"wsproxy_addr": "http://127.0.0.1:5050",
"wsproxy_api_token": "v625xZLOgbMHhl0s49VuqQ"
}
],
"sgroups_for_domains": [
Expand Down
Loading

0 comments on commit 2fefe02

Please sign in to comment.