diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index 3ce8b61a..dc2db008 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -25,13 +25,13 @@ lint: - actionlint@1.7.7 - git-diff-check - gofmt@1.20.4 - - golangci-lint@1.63.4 + - golangci-lint@1.64.5 - osv-scanner@1.9.2 - - oxipng@9.1.3 - - prettier@3.4.2 + - oxipng@9.1.4 + - prettier@3.5.1 - shellcheck@0.10.0 - shfmt@3.6.0 - - trufflehog@3.88.5 + - trufflehog@3.88.9 actions: disabled: - trunk-announce diff --git a/README.md b/README.md index bceb67e1..9bf84fc6 100755 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=yusing_go-proxy&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=yusing_godoxy) ![GitHub last commit](https://img.shields.io/github/last-commit/yusing/godoxy) [![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=yusing_go-proxy&metric=ncloc)](https://sonarcloud.io/summary/new_code?id=yusing_godoxy) -[![](https://dcbadge.limes.pink/api/server/umReR62nRd?style=flat)](https://discord.gg/umReR62nRd) +[![Discord](https://dcbadge.limes.pink/api/server/umReR62nRd?style=flat)](https://discord.gg/umReR62nRd) A lightweight, simple, and [performant](https://github.com/yusing/godoxy/wiki/Benchmarks) reverse proxy with WebUI. @@ -13,13 +13,11 @@ For full documentation, check out **[Wiki](https://github.com/yusing/godoxy/wiki **EN** | 中文 -**Currently working on [feat/godoxy-agent](https://github.com/yusing/godoxy/tree/feat/godoxy-agent).
For contribution, please fork this instead of default branch.** - - + @@ -44,17 +42,17 @@ For full documentation, check out **[Wiki](https://github.com/yusing/godoxy/wiki - Easy to use - Effortless configuration - - Simple multi-node setup with GoDoxy agents + - Simple multi-node setup with GoDoxy agents or Docker Socket Proxies - Error messages is clear and detailed, easy troubleshooting -- Auto SSL with Let's Encrypt and DNS-01 (See [Supported DNS-01 Challenge Providers](https://github.com/yusing/go-proxy/wiki/Supported-DNS%E2%80%9001-Providers)) +- Auto SSL with Let's Encrypt (See [Supported DNS-01 Challenge Providers](https://github.com/yusing/go-proxy/wiki/Supported-DNS%E2%80%9001-Providers)) - Auto hot-reload on container state / config file changes -- Create routes dynamically from running docker containers -- **idlesleeper**: stop containers on idle, wake it up on traffic _(optional, see [screenshots](#idlesleeper))_ +- Container aware: create routes dynamically from running docker containers +- **idlesleeper**: stop and wake containers based on traffic _(optional, see [screenshots](#idlesleeper))_ - HTTP reserve proxy and TCP/UDP port forwarding -- OpenID Connect integration +- OpenID Connect integration: SSO and secure your apps easily - [HTTP middleware](https://github.com/yusing/go-proxy/wiki/Middlewares) and [Custom error pages support](https://github.com/yusing/go-proxy/wiki/Middlewares#custom-error-pages) -- **Web UI with App dashboard, config editor, _uptime monitor_, _system monitor_, _docker logs viewer_ (available on nightly builds)** -- Supports linux/amd64, linux/arm64 +- **Web UI with App dashboard, config editor, _uptime and system metrics_, _docker logs viewer_** +- Supports linux/amd64 and linux/arm64 - Written in **[Go](https://go.dev)** [🔼Back to top](#table-of-content) @@ -71,8 +69,9 @@ Setup Wildcard DNS Record(s) for machine running `GoDoxy`, e.g. 1. List all the containers 2. Read container name, labels and port configurations for each of them 3. Create a route if applicable (a route is like a "Virtual Host" in NPM) +4. Watch for container / config changes and update automatically -GoDoxy uses the label `proxy.aliases` as the subdomain(s), if unset it defaults to `container_name`. +GoDoxy uses the label `proxy.aliases` as the subdomain(s), if unset it defaults to the `container_name` field in docker compose. For example, with the label `proxy.aliases: qbt` you can access your app via `qbt.domain.com`. @@ -102,8 +101,6 @@ For example, with the label `proxy.aliases: qbt` you can access your app via `qb ### Metrics and Logs -_In development, available on nightly builds._ -
diff --git a/README_CHT.md b/README_CHT.md index 92a63c5a..cfe8f6f2 100644 --- a/README_CHT.md +++ b/README_CHT.md @@ -2,18 +2,18 @@ # GoDoxy -[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=yusing_go-proxy&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=yusing_godoxy) +[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=yusing_go-proxy&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=yusing_go-proxy) ![GitHub last commit](https://img.shields.io/github/last-commit/yusing/godoxy) -[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=yusing_go-proxy&metric=ncloc)](https://sonarcloud.io/summary/new_code?id=yusing_godoxy) +[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=yusing_go-proxy&metric=ncloc)](https://sonarcloud.io/summary/new_code?id=yusing_go-proxy) [![](https://dcbadge.limes.pink/api/server/umReR62nRd?style=flat)](https://discord.gg/umReR62nRd) 輕量、易用、 [高效能](https://github.com/yusing/godoxy/wiki/Benchmarks),且帶有主頁和配置面板的反向代理 完整文檔請查閱 **[Wiki](https://github.com/yusing/godoxy/wiki)**(暫未有中文翻譯) - +EN | **中文** @@ -34,6 +34,7 @@ - [資料夾結構](#資料夾結構) - [截圖](#截圖) - [閒置休眠](#閒置休眠) + - [監控](#監控) - [自行編譯](#自行編譯) ## 主要特點 @@ -46,11 +47,9 @@ - 自動配置 Docker 容器 - 容器狀態/配置文件變更時自動熱重載 - **閒置休眠**:在閒置時停止容器,有流量時喚醒(_可選,參見[截圖](#閒置休眠)_) -- HTTP(s) 反向代理 -- OpenID Connect 支持 -- [HTTP 中介軟體支援](https://github.com/yusing/godoxy/wiki/Middlewares) -- [自訂錯誤頁面支援](https://github.com/yusing/godoxy/wiki/Middlewares#custom-error-pages) -- TCP 和 UDP 埠轉發 +- OpenID Connect:輕鬆實現單點登入 +- HTTP(s) 反向代理和TCP 和 UDP 埠轉發 +- [HTTP 中介軟體](https://github.com/yusing/godoxy/wiki/Middlewares) 和 [自定義錯誤頁面](https://github.com/yusing/godoxy/wiki/Middlewares#custom-error-pages) - **網頁介面,具有應用儀表板和配置編輯器** - 支援 linux/amd64、linux/arm64 - 使用 **[Go](https://go.dev)** 編寫 @@ -72,9 +71,9 @@ 2. 在目錄內運行安裝腳本,或[手動安裝](#手動安裝) - ```shell - /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/yusing/godoxy/main/scripts/setup.sh)" - ``` + ```shell + /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/yusing/godoxy/main/scripts/setup.sh)" + ``` 3. 啟動容器 `docker compose up -d` 並等待就緒 @@ -125,6 +124,31 @@ [🔼回到頂部](#目錄) +### 監控 + +
+
+ + + + + + + + + + + + + + + + + + +
Uptime MonitorDocker LogsServer Overview
運行時間監控Docker 日誌伺服器概覽
System MonitorGraphs
系統監控圖表
+
+ ## 自行編譯 1. 克隆儲存庫 `git clone https://github.com/yusing/godoxy --depth=1` diff --git a/go.mod b/go.mod index ccec31fc..eb0237a4 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,6 @@ require ( github.com/PuerkitoBio/goquery v1.10.2 // parsing HTML for extract fav icon github.com/coder/websocket v1.8.13 // websocket for API and agent github.com/coreos/go-oidc/v3 v3.13.0 // oidc authentication - github.com/docker/cli v28.0.4+incompatible // docker CLI github.com/docker/docker v28.0.4+incompatible // docker daemon github.com/fsnotify/fsnotify v1.8.0 // file watcher github.com/go-acme/lego/v4 v4.22.2 // acme client @@ -76,7 +75,6 @@ require ( github.com/prometheus/client_model v0.6.1 // indirect github.com/prometheus/common v0.63.0 // indirect github.com/prometheus/procfs v0.16.0 // indirect - github.com/sirupsen/logrus v1.9.3 // indirect github.com/tklauser/go-sysconf v0.3.15 // indirect github.com/tklauser/numcpus v0.10.0 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect diff --git a/go.sum b/go.sum index ac52545f..44e44529 100644 --- a/go.sum +++ b/go.sum @@ -21,14 +21,10 @@ github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3 github.com/coreos/go-oidc/v3 v3.13.0 h1:M66zd0pcc5VxvBNM4pB331Wrsanby+QomQYjN8HamW8= github.com/coreos/go-oidc/v3 v3.13.0/go.mod h1:HaZ3szPaZ0e4r6ebqvsLWlk2Tn+aejfmrfah6hnSYEU= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk= github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= -github.com/docker/cli v28.0.4+incompatible h1:pBJSJeNd9QeIWPjRcV91RVJihd/TXB77q1ef64XEu4A= -github.com/docker/cli v28.0.4+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/docker v28.0.4+incompatible h1:JNNkBctYKurkw6FrHfKqY0nKIDf5nrbxjVBtS+cdcok= github.com/docker/docker v28.0.4+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.5.0 h1:USnMq7hx7gwdVZq1L49hLXaFtUdTADjXGp+uj1Br63c= @@ -131,7 +127,6 @@ github.com/ovh/go-ovh v1.7.0 h1:V14nF7FwDjQrZt9g7jzcvAAQ3HN6DNShRFRMC3jLoPw= github.com/ovh/go-ovh v1.7.0/go.mod h1:cTVDnl94z4tl8pP1uZ/8jlVxntjSIf09bNcQ5TJSC7c= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 h1:o4JXh1EVt9k/+g42oCprj/FisM4qX9L3sZB3upGN2ZU= @@ -155,8 +150,6 @@ github.com/shirou/gopsutil/v4 v4.25.2 h1:NMscG3l2CqtWFS86kj3vP7soOczqrQYIEhO/pMv github.com/shirou/gopsutil/v4 v4.25.2/go.mod h1:34gBYJzyqCDT11b6bMHP0XCvWeU3J61XRT7a2EmCRTA= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/tklauser/go-sysconf v0.3.15 h1:VE89k0criAymJ/Os65CSn1IXaol+1wrsFHEB8Ol49K4= @@ -244,7 +237,6 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -307,7 +299,6 @@ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntN gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU= diff --git a/next-release.md b/next-release.md index 66827d42..e69de29b 100644 --- a/next-release.md +++ b/next-release.md @@ -1,54 +0,0 @@ -## GoDoxy v0.10.0 - -### GoDoxy Agent - -Maintain secure connection between main server and agent server by authenticating and encrypting connection with mTLS. - -Main benefits: - -- No more exposing docker socket: drops the need of `docker-socket-proxy` -- No more exposing app ports: fewer attack surface - - ```yaml - services: - app: - ... - # ports: # this part is not needed on agent server - # - 6789 - ``` - -- Secure: no one can connect to it except GoDoxy main server because of mTLS, plus connection is encrypted -- Fetch info from agent server, e.g. CPU usage, Memory usage, container list, container logs, etc... (to be ready for beszel and dockge like features in WebUI) - -#### How to setup - -Prerequisites: - -- GoDoxy main server must be running - -1. Create a directory for agent server, cd into it -2. Navigate to **Metrics tab** in WebUI, click **Add agent**, fill in required infomation then click **Copy docker compose** -3. Paste the docker compose into the agent server then start it with `docker compose up -d` - -### How does it work - -Run flow: - -```mermaid -flowchart TD - subgraph Agent HTTPS Server - aa[Load CA and SSL certs] --> - ab[Start HTTPS server] --> - - ac[Receive request] --> - ad[Verify client cert] --> - ae[Handle request] --> ac - end - subgraph Main Server - ma[Load client certs] --> - mb[Query agent version] --> ac - mb --> mc[Check if agent version matches] --> - md[Query agent info] --> ac - md --> ae --> me[Store agent info] - end -``` diff --git a/scripts/setup.sh b/scripts/setup.sh index 05dee857..b6e2853d 100755 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -21,23 +21,6 @@ fi echo "Using ${DOWNLOAD_TOOL} for downloads" -# get_default_branch() { -# local repo="$1" # Format: owner/repo -# local branch - -# if [ "$DOWNLOAD_TOOL" = "curl" ]; then -# branch=$(curl -sL "https://api.github.com/repos/${repo}" | grep -o '"default_branch": *"[^"]*"' | cut -d'"' -f4) -# elif [ "$DOWNLOAD_TOOL" = "wget" ]; then -# branch=$(wget -qO- "https://api.github.com/repos/${repo}" | grep -o '"default_branch": *"[^"]*"' | cut -d'"' -f4) -# fi - -# if [ -z "$branch" ]; then -# echo "main" # Fallback to 'main' if detection fails -# else -# echo "$branch" -# fi -# } - # Environment variables with defaults REPO="yusing/godoxy" BRANCH=${BRANCH:-"main"} @@ -218,11 +201,11 @@ if [ "$ENABLE_AUTOCERT" == "y" ]; then ask_while_empty "Enter email for Let's Encrypt: " EMAIL # ask if using cloudflare - ask_while_empty "Is your DNS provider cloudflare? (y/n): " USE_CLOUDFLARE + ask_while_empty "Is cloudflare the current DNS nameserver? (y/n): " USE_CLOUDFLARE # ask for cloudflare api key if [ "$USE_CLOUDFLARE" = "y" ]; then - ask_while_empty "Enter cloudflare api key: " CLOUDFLARE_API_KEY + ask_while_empty "Enter cloudflare zone api key: " CLOUDFLARE_API_KEY cat <>"$CONFIG_BASE_PATH/$CONFIG_FILE_NAME" autocert: provider: cloudflare