Merge pull request #38 from fscarmen2/main

Add Nezha server with Argo English readme.
This commit is contained in:
黑歌 2023-08-08 08:58:25 +08:00 committed by GitHub
commit 1de4fd5384
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 302 additions and 19 deletions

View File

@ -135,7 +135,7 @@ function getCaseSidebarZhCN() {
{ text: '2. 使用Siri语音运行快捷指令查询服务器状态', link: '/case/case2.html' }, { text: '2. 使用Siri语音运行快捷指令查询服务器状态', link: '/case/case2.html' },
{ text: '3. 自建多用户多语言 Telegram 服务器状态查询机器人', link: '/case/case3.html' }, { text: '3. 自建多用户多语言 Telegram 服务器状态查询机器人', link: '/case/case3.html' },
{ text: '4. Fake-agent监控数据作弊器', link: '/case/case4.html' }, { text: '4. Fake-agent监控数据作弊器', link: '/case/case4.html' },
{ text: '5. Nezha server over Argo tunnel 白嫖利器', link: '/case/case5.html' } { text: '5. 使用 Argo 隧道的哪吒服务端', link: '/case/case5.html' }
] ]
} }
] ]

View File

@ -1,5 +1,5 @@
# Nezha server over Argo tunnel # 使用 Argo 隧道的哪吒服务端
使用 Argo 隧道的哪吒服务端
贡献者: 贡献者:
+ [fscarmen](https://github.com/fscarmen2) + [fscarmen](https://github.com/fscarmen2)
@ -16,6 +16,10 @@
- [VPS 部署实例](case5.md#VPS-部署实例) - [VPS 部署实例](case5.md#VPS-部署实例)
- [客户端接入](case5.md#客户端接入) - [客户端接入](case5.md#客户端接入)
- [SSH 接入](case5.md#ssh-接入) - [SSH 接入](case5.md#ssh-接入)
- [自动还原备份](case5.md#自动还原备份)
- [手动还原备份](case5.md#手动还原备份)
- [完美搬家](case5.md#完美搬家)
- [主体目录文件及说明](case5.md#主体目录文件及说明)
- [鸣谢下列作者的文章和项目](case5.md#鸣谢下列作者的文章和项目) - [鸣谢下列作者的文章和项目](case5.md#鸣谢下列作者的文章和项目)
- [免责声明](case5.md#免责声明) - [免责声明](case5.md#免责声明)
@ -23,14 +27,16 @@
## 项目特点: ## 项目特点:
* 适用范围更广 --- 只要能连通网络,就能安装哪吒服务端,如 Nas 虚拟机 , Container PaaS 等 * 适用范围更广 --- 只要能连通网络,就能安装哪吒服务端,如 Nas 虚拟机 , Container PaaS 等
* Argo 隧道突破需要公网入口的限制 --- 传统的哪吒需要有两个,一个用于面板的访问,另一个用于客户端上报数据,本项目借用 Cloudflare Argo 隧道,使用内网穿透的办法 * Argo 隧道突破需要公网入口的限制 --- 传统的哪吒需要有两个公网端口,一个用于面板的访问,另一个用于客户端上报数据,本项目借用 Cloudflare Argo 隧道,使用内网穿透的办法
* IPv4 / v6 具备更高的灵活性 --- 传统哪吒需要处理服务端和客户端的 IPv4/v6 兼容性问题,还需要通过 warp 等工具来解决不对应的情况。然而,本项目可以完全不需要考虑这些问题,可以任意对接,更加方便和简便 * IPv4 / v6 具备更高的灵活性 --- 传统哪吒需要处理服务端和客户端的 IPv4/v6 兼容性问题,还需要通过 warp 等工具来解决不对应的情况。然而,本项目可以完全不需要考虑这些问题,可以任意对接,更加方便和简便
* 一条 Argo 隧道分流多个域名和协议 --- 建立一条内网穿透的 Argo 隧道,即可分流三个域名(hostname)和协议(protocal),分别用于面板的访问(http),客户端上报数据(tcp)和 ssh可选 * 一条 Argo 隧道分流多个域名和协议 --- 建立一条内网穿透的 Argo 隧道,即可分流三个域名(hostname)和协议(protocal),分别用于面板的访问(http),客户端上报数据(tcp)和 ssh可选
* Nginx 反向代理的 gRPC 数据端口 --- 配上证书做 tls 终结,然后 Argo 的隧道配置用 https 服务指向这个反向代理启用http2回源grpc(nezha)->h2(nginx)->argo->cf cdn edge->agent * Nginx 反向代理的 gRPC 数据端口 --- 配上证书做 tls 终结,然后 Argo 的隧道配置用 https 服务指向这个反向代理启用http2回源grpc(nezha)->h2(nginx)->argo->cf cdn edge->agent
* 每天自动备份 --- 每天 0 时 0 分自动备份整个哪吒面板文件夹到指定的 github 私库,包括面板主题,面板设置,探针数据和隧道信息,备份保留近 30 天数据;鉴于内容十分重要,必须要放在私库 * 每天自动备份 --- 北京时间每天 4 时 0 分自动备份整个哪吒面板文件夹到指定的 github 私库,包括面板主题,面板设置,探针数据和隧道信息,备份保留近 5 天数据;鉴于内容十分重要,必须要放在私库
* 手/自一体还原备份 --- 每分钟检测一次在线还原文件的内容,遇到有更新立刻还原
* 默认内置本机探针 --- 能很方便的监控自身服务器信息
* 数据更安全 --- Argo 隧道使用TLS加密通信可以将应用程序流量安全地传输到 Cloudflare 网络提高了应用程序的安全性和可靠性。此外Argo Tunnel也可以防止IP泄露和DDoS攻击等网络威胁 * 数据更安全 --- Argo 隧道使用TLS加密通信可以将应用程序流量安全地传输到 Cloudflare 网络提高了应用程序的安全性和可靠性。此外Argo Tunnel也可以防止IP泄露和DDoS攻击等网络威胁
<img width="1298" alt="image" src="https://user-images.githubusercontent.com/92626977/233363248-e2caa687-b513-448c-a92f-c870db0e4236.png"> <img width="1298" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/6535a060-2138-4c72-9ffa-1175dc6f5c25.png">
## 准备需要用的变量 ## 准备需要用的变量
@ -38,13 +44,13 @@
<img width="1040" alt="image" src="https://user-images.githubusercontent.com/92626977/231084930-02e3c2de-c52b-420d-b39c-9f135d040b3b.png"> <img width="1040" alt="image" src="https://user-images.githubusercontent.com/92626977/231084930-02e3c2de-c52b-420d-b39c-9f135d040b3b.png">
* 到 Cloudflare 官,在相应的域名 `DNS` 记录里加上客户端上报数据(tcp)和 ssh可选的域名打开橙色云启用 CDN * 到 Cloudflare 官,在相应的域名 `DNS` 记录里加上客户端上报数据(tcp)和 ssh可选的域名打开橙色云启用 CDN
<img width="1666" alt="image" src="https://user-images.githubusercontent.com/92626977/231087110-85ddab87-076b-45c9-97d1-c8b051dcb5b0.png"> <img width="1651" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/d5efb33d-b2a3-484c-b058-346c3e229088">
<img width="1627" alt="image" src="https://user-images.githubusercontent.com/92626977/231087714-e5a45eb9-bc47-4c38-8f5b-a4a9fb492d0d.png"> <img width="1618" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/c44b638f-9984-47a7-a342-166549f6092e">
* 到 Cloudflare 官,选择使用的域名,打开 `网络` 选项将 `gRPC` 开关打开 * 到 Cloudflare 官,选择使用的域名,打开 `网络` 选项将 `gRPC` 开关打开
<img width="1590" alt="image" src="https://user-images.githubusercontent.com/92626977/233138703-faab8596-a64a-40bb-afe6-52711489fbcf.png"> <img width="1590" alt="image" src="https://user-images.githubusercontent.com/92626977/233138703-faab8596-a64a-40bb-afe6-52711489fbcf.png">
@ -77,7 +83,8 @@
| GH_USER | 是 | github 的用户名,用于面板管理授权 | | GH_USER | 是 | github 的用户名,用于面板管理授权 |
| GH_CLIENTID | 是 | 在 github 上申请 | | GH_CLIENTID | 是 | 在 github 上申请 |
| GH_CLIENTSECRET| 是 | 在 github 上申请 | | GH_CLIENTSECRET| 是 | 在 github 上申请 |
| GH_REPO | 否 | 在 github 上备份哪吒服务端数据库文件的库 | | GH_BACKUP_USER | 否 | 在 github 上备份哪吒服务端数据库的 github 用户名,不填则与面板管理授权的账户 GH_USER 一致 |
| GH_REPO | 否 | 在 github 上备份哪吒服务端数据库文件的 github 库 |
| GH_EMAIL | 否 | github 的邮箱,用于备份的 git 推送到远程库 | | GH_EMAIL | 否 | github 的邮箱,用于备份的 git 推送到远程库 |
| GH_PAT | 否 | github 的 PAT | | GH_PAT | 否 | github 的 PAT |
| ARGO_JSON | 是 | 从 https://fscarmen.cloudflare.now.cc 获取的 Argo Json | | ARGO_JSON | 是 | 从 https://fscarmen.cloudflare.now.cc 获取的 Argo Json |
@ -86,7 +93,9 @@
| SSH_DOMAIN | 否 | ssh 用的 argo 域名 | | SSH_DOMAIN | 否 | ssh 用的 argo 域名 |
| SSH_PASSWORD | 否 | ssh 的密码,只有在设置 SSH_JSON 后才生效,默认值 password | | SSH_PASSWORD | 否 | ssh 的密码,只有在设置 SSH_JSON 后才生效,默认值 password |
1.Koyeb Koyeb
[![Deploy to Koyeb](https://www.koyeb.com/static/images/deploy/button.svg)](https://app.koyeb.com/deploy?type=docker&name=nezha&ports=80;http;/&env[GH_USER]=&env[GH_CLIENTID]=&env[GH_CLIENTSECRET]=&env[GH_REPO]=&env[GH_EMAIL]=&env[GH_PAT]=&env[ARGO_JSON]=&env[DATA_DOMAIN]=&env[WEB_DOMAIN]=&env[SSH_DOMAIN]=&env[SSH_PASSWORD]=&image=docker.io/fscarmen/argo-nezha)
<img width="927" alt="image" src="https://user-images.githubusercontent.com/92626977/231088411-fbac3e6e-a8a6-4661-bcf8-7c777aa8ffeb.png"> <img width="927" alt="image" src="https://user-images.githubusercontent.com/92626977/231088411-fbac3e6e-a8a6-4661-bcf8-7c777aa8ffeb.png">
<img width="750" alt="image" src="https://user-images.githubusercontent.com/92626977/231088973-7134aefd-4c80-4559-8e40-17c3be11d27d.png"> <img width="750" alt="image" src="https://user-images.githubusercontent.com/92626977/231088973-7134aefd-4c80-4559-8e40-17c3be11d27d.png">
@ -98,15 +107,14 @@
## VPS 部署实例 ## VPS 部署实例
* 注意: ARGO_JSON= 后面需要有单引号,不能去掉 * 注意: ARGO_JSON= 后面需要有单引号,不能去掉
* 如果 VPS 是 IPv6 only 的,请先安装 WARP IPv4 或者双栈: https://github.com/fscarmen/warp * 如果 VPS 是 IPv6 only 的,请先安装 WARP IPv4 或者双栈: https://github.com/fscarmen/warp
* 备份目录为当前路径的 dashboard 文件夹
### docker 部署 ### docker 部署
``` ```
docker run -dit \ docker run -dit \
--name nezha_dashboard \ --name nezha_dashboard \
--restart always \ --restart always \
-v ./dashboard:/dashboard \
-e GH_USER=< github 用户名> \ -e GH_USER=< github 用户名> \
-e GH_EMAIL=< github 邮箱> \ -e GH_EMAIL=< github 邮箱> \
-e GH_PAT=<填获取的> \ -e GH_PAT=<填获取的> \
@ -129,8 +137,6 @@ services:
image: fscarmen/argo-nezha image: fscarmen/argo-nezha
container_name: nezha_dashboard container_name: nezha_dashboard
restart: always restart: always
volumes:
- ./dashboard:/dashboard
environment: environment:
- GH_USER=< github 用户名> - GH_USER=< github 用户名>
- GH_EMAIL=<< github 邮箱> - GH_EMAIL=<< github 邮箱>
@ -166,14 +172,60 @@ curl -L https://raw.githubusercontent.com/naiba/nezha/master/script/install.sh -
<img width="955" alt="image" src="https://user-images.githubusercontent.com/92626977/233350802-754624e0-8456-4353-8577-1f5385fb8723.png"> <img width="955" alt="image" src="https://user-images.githubusercontent.com/92626977/233350802-754624e0-8456-4353-8577-1f5385fb8723.png">
## ## 自动还原备份
* 把需要还原的文件名改到 github 备份库里的 `README.md`,定时服务会每分钟检测更新,并把上次同步的文件名记录在本地 `/dbfile` 处以与在线的文件内容作比对
下图为以还原文件名为 `dashboard-2023-04-23-13:08:37.tar.gz` 作示例
![image](https://user-images.githubusercontent.com/92626977/233822466-c24e94f6-ba8a-47c9-b77d-aa62a56cc929.png)
## 手动还原备份
* ssh 进入容器后运行github 备份库里的 tar.gz 文件名,格式: dashboard-2023-04-22-21:42:10.tar.gz
```
bash /dashboard/restore.sh <文件名>
```
<img width="1209" alt="image" src="https://user-images.githubusercontent.com/92626977/233792709-fb37b79c-c755-4db1-96ec-1039309ff932.png">
## 完美搬家
* 备份原哪吒的 `/dashboard` 文件夹,压缩备份为 `dashboard.tar.gz` 文件
```
tar czvf dashboard.tar.gz /dashboard
```
* 下载文件并放入私库,这个私库名要与新哪吒 <GH_REPO> 完全一致,并把该库的 README.md 的内容编辑为 `dashboard.tar.gz`
* 部署本项目新哪吒,完整填入变量即可。部署完成后,自动还原脚本会每分钟作检测,发现有新的内容即会自动还原,全程约 3 分钟
## 主体目录文件及说明
```
.
|-- dashboard
| |-- app # 哪吒面板主程序
| |-- argo.json # Argo 隧道 json 文件,记录着使用隧道的信息
| |-- argo.yml # Argo 隧道 yml 文件,用于在一同隧道下,根据不同域名来分流 web, gRPC 和 ssh 协议的作用
| |-- backup.sh # 备份数据脚本
| |-- data
| | |-- config.yaml # 哪吒面板的配置,如 Github OAuth2 / gRPC 域名 / 端口 / 是否启用 TLS 等信息
| | `-- sqlite.db # SQLite 数据库文件,记录着面板设置的所有 severs 和 cron 等信息
| |-- entrypoint.sh # 主脚本,容器运行后执行
| |-- nezha-agent # 哪吒客户端,用于监控本地 localhost
| |-- nezha.csr # SSL/TLS 证书签名请求
| |-- nezha.key # SSL/TLS 证书的私钥信息
| |-- nezha.pem # SSL/TLS 隐私增强邮件
| `-- restore.sh # 还原备份脚本
`-- dbfile # 记录最新的还原或备份文件名
```
## 鸣谢下列作者的文章和项目: ## 鸣谢下列作者的文章和项目:
* 热心的朝阳群众 Robin讨论哪吒服务端与客户端的关系从而诞生了此项目 * 热心的朝阳群众 Robin讨论哪吒服务端与客户端的关系从而诞生了此项目
* 哪吒官网: https://nezha.wiki/ , TG 群: https://t.me/nezhamonitoring * 哪吒官网: https://nezha.wiki/ , TG 群: https://t.me/nezhamonitoring
* 共穷国际老中医: http://solitud.es/ * 共穷国际老中医: http://solitud.es/
* Akkia's Blog: https://blog.akkia.moe/ * Akkia's Blog: https://blog.akkia.moe/
* HiFeng's Blog: https://www.hicairo.com/
* 用 Cloudflare Tunnel 进行内网穿透: https://blog.outv.im/2021/cloudflared-tunnel/ * 用 Cloudflare Tunnel 进行内网穿透: https://blog.outv.im/2021/cloudflared-tunnel/
## 免责声明: ## 免责声明:
* 本程序仅供学习了解, 非盈利目的,请于下载后 24 小时内删除, 不得用作任何商业用途, 文字、数据及图片均有所属版权, 如转载须注明来源。 * 本程序仅供学习了解, 非盈利目的,请于下载后 24 小时内删除, 不得用作任何商业用途, 文字、数据及图片均有所属版权, 如转载须注明来源。
* 使用本程序必循遵守部署免责声明。使用本程序必循遵守部署服务器所在地、所在国家和用户所在国家的法律法规, 程序作者不对使用者任何不当行为负责。 * 使用本程序必循遵守部署免责声明。使用本程序必循遵守部署服务器所在地、所在国家和用户所在国家的法律法规, 程序作者不对使用者任何不当行为负责。

231
docs/en_US/case/case5.md Normal file
View File

@ -0,0 +1,231 @@
# Nezha server over Argo tunnel
Contributors:
+ [fscarmen](https://github.com/fscarmen2)
GitHub project: [Argo-Nezha-Service-Container](https://github.com/fscarmen2/Argo-Nezha-Service-Container)
Mirror backup (not live update): [Argo-Nezha-Service-Container](https://github.com/nezhahq/Argo-Nezha-Service-Container)
* * * *
# Catalog
- [Project Features](case5.md#project-features)
- [Variables to be used](case5.md#prepare-variables-to-be-used)
- [PaaS Deployment Example](case5.md#paas-deployment-example)
- [VPS Deployment Example](case5.md#vps-deployment-example)
- [Client Access](case5.md#client-access)
- [SSH Access](case5.md#ssh-access)
- [Auto Restore Backup](case5.md#automatically-restore-backups)
- [Manual Restore Backup](case5.md#manually-restore-the-backup)
- [Migrating data](case5.md#migrating-data)
- [Main Directory Files and Descriptions](case5.md#main-catalog-files-and-descriptions)
- [Acknowledgment of articles and projects by the following authors](case5.md#acknowledgements-for-articles-and-projects-by)
- [Disclaimer](case5.md#disclaimer)
* * *
## Project Features.
* Wider scope of application --- As long as there is a network connection, Nezha server can be installed, such as Nas Virtual Machine, Container PaaS, etc.
* Argo tunnel breaks through the restriction of requiring a public network portal --- The traditional Nezha requires two public network ports, one for panel visiting and the other for client reporting, this project uses Cloudflare Argo tunnels and uses intranet tunneling.
* IPv4 / v6 with higher flexibility --- The traditional Nezha needs to deal with IPv4/v6 compatibility between server and client, and also needs to resolve mismatches through tools such as warp. However, this project does not need to consider these issues at all, and can be docked arbitrarily, which is much more convenient and easy!
* One Argo tunnel for multiple domains and protocols --- Create an intranet-penetrating Argo tunnel for three domains (hostname) and protocols, which can be used for panel access (http), client reporting (tcp) and ssh (optional).
* Nginx reverse proxy gRPC data port --- with a certificate for tls termination, then Argo's tunnel configuration with https service pointing to this reverse proxy, enable http2 back to the source, grpc(nezha)->h2(nginx)->argo->cf cdn edge->agent
* Daily automatic backup --- every day at 04:00 BST, the entire Nezha panel folder is automatically backed up to a designated private github repository, including panel themes, panel settings, probe data and tunnel information, the backup retains nearly 5 days of data; the content is so important that it must be placed in the private repository.
* Manual/automatic restore backup --- check the content of online restore file once a minute, and restore immediately when there is any update.
* Default built-in local probes --- can easily monitor their own server information
* More secure data --- Argo Tunnel uses TLS encrypted communication to securely transmit application traffic to the Cloudflare network, improving application security and reliability. In addition, Argo Tunnel protects against network threats such as IP leaks and DDoS attacks.
<img width="1298" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/6535a060-2138-4c72-9ffa-1175dc6f5c25.png">
## Prepare variables to be used
* Easily get Argo tunnel information through Cloudflare Json generation network: https://fscarmen.cloudflare.now.cc
<img width="772" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/98f2c80c-8d45-4c70-b46e-70f552e0b572">
* Visit Cloudflare website, add the domain name of the client reporting data (tcp) and ssh (optional) in the `DNS` record of the corresponding domain, and turn on Orange Cloud to enable CDN.
<img width="1629" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/39ecc388-e66b-44a2-a339-c80e9d7ed8e2">
<img width="1632" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/1ad2042e-46e6-41c3-9c16-14dc8699ee72">
* Visit the Cloudflare website, select the domain name you want to use, and turn on the `network` option to turn the `gRPC` switch on.
<img width="1605" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/533133dc-ab46-43ff-8eec-0b57d776e4a9">
* Get github authentication license: https://github.com/settings/applications/new
Add `https://` to the beginning of the panel's domain name and `/oauth2/callback` to the end of the callback address.
<img width="1031" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/b3218cca-171d-4869-8ff9-7a569d01234a">
<img width="1023" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/c8e6370d-4307-4b88-b490-ce960b694541">
* Get a PAT (Personal Access Token) for github: https://github.com/settings/tokens/new
<img width="1368" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/96b09a43-910c-41c8-b407-1090d81ce728">
<img width="1542" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/b2bf7d3e-2370-4e12-b01d-7cfb9f2d3115">
* Create a private github repository for backups: https://github.com/new
<img width="716" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/499fb58d-9dc7-4b3f-84d7-d709d679ec80">
## PaaS Deployment Example
Image `fscarmen/argo-nezha:latest`, supports amd64 and arm64 architectures.
Variables used
| Variable Name | Required | Remarks |
| ------------ | ------ | ---- |
| GH_USER | Yes | github username for panel admin authorization |
| GH_CLIENTID | yes | apply on github |
| GH_CLIENTSECRET | yes | apply on github |
| GH_BACKUP_USER | No | The github username for backing up Nezha's server-side database on github, if not filled in, it is the same as the account GH_USER for panel management authorization |
| GH_REPO | No | The github repository for backing up Nezha's server-side database files on github |
| GH_EMAIL | No | github's mailbox for git push backups to remote repositories |
| GH_PAT | No | github's PAT |
| ARGO_JSON | Yes | Argo Json from https://fscarmen.cloudflare.now.cc |
| DATA_DOMAIN | Yes | Client-server communication argo domain name |
| WEB_DOMAIN | Yes | Panel argo domain |
| SSH_DOMAIN | No | ssh for argo domain |
| SSH_PASSWORD | no | password for ssh, only works after setting SSH_JSON, default password |
Koyeb
[![Deploy to Koyeb](https://www.koyeb.com/static/images/deploy/button.svg)](https://app.koyeb.com/deploy?type=docker&name=nezha&ports=80;http;/&env[GH_USER]=&env[GH_CLIENTID]=&env[GH_CLIENTSECRET]=&env[GH_REPO]=&env[GH_EMAIL]=&env[GH_PAT]=&env[ARGO_JSON]=&env[DATA_DOMAIN]=&env[WEB_DOMAIN]=&env[SSH_DOMAIN]=&env[SSH_PASSWORD]=&image=docker.io/fscarmen/argo-nezha)
<img width="927" alt="image" src="https://user-images.githubusercontent.com/92626977/231088411-fbac3e6e-a8a6-4661-bcf8-7c777aa8ffeb.png">
<img width="1011" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/61fad972-1be9-4e8d-829a-8faea0c8ed64">
<img width="763" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/ca294962-f10e-4f4c-b69c-9e95d3d25cac">
<img width="1214" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/ddabdf3a-ca63-4523-b839-62c4d4c0caf2">
<img width="881" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/e623f92d-878f-4eb8-9dfe-55b59770ba2f">
## VPS Deployment Example
* Note: ARGO_JSON= must be followed by single quotes, which cannot be removed.
* If the VPS is IPv6 only, please install WARP IPv4 or dual-stack first: https://github.com/fscarmen/warp
* The backup directory is the dashboard folder in the current path.
### docker deployment
```
docker run -dit \
--name nezha_dashboard \
--restart always \
-e GH_USER=<fill in github username> \
-e GH_EMAIL=<fill in github email> \
-e GH_PAT=<fill in the obtained> \
-e GH_REPO=<fill in customized> \
-e GH_CLIENTID=<fill in acquired> \
-e GH_CLIENTSECRET=<fill in acquired> \
-e ARGO_JSON='<fill in acquired>' \
-e WEB_DOMAIN=<fill in customized> \
-e DATA_DOMAIN=<fill in customized> \
-e SSH_DOMAIN=<fill in customized> \
-e SSH_PASSWORD=<insert customized> \
fscarmen/argo-nezha
```
### docker-compose deployment
```
version: '3.8'
services.
argo-nezha.
image: fscarmen/argo-nezha
container_name: nezha_dashboard
restart: always
environment:
- GH_USER=<fill in github username>
- GH_EMAIL=<fill in your github email>
- GH_PAT=<<fill in obtained>
- GH_REPO=<fill in customized>
- GH_CLIENTID=<fill in obtained>
- GH_CLIENTSECRET=<fill in fetched>
- ARGO_JSON='<fill in acquired>'
- WEB_DOMAIN=<fill customized>
- DATA_DOMAIN=<fill in customized>
- SSH_DOMAIN=<insert customized>
- SSH_PASSWORD=<fill customized>
```
## Client Access
Transfer via gRPC, no additional configuration required. Use the installation method given in the panel, for example
```
curl -L https://raw.githubusercontent.com/naiba/nezha/master/script/install.sh -o nezha.sh && chmod +x nezha.sh && sudo ./nezha.sh install_agent data.seales.nom.za 443 eAxO9IF519fKFODlW0 --tls
```
## SSH access
* Take macOS + WindTerm as an example, and other SSH tools depending on the one used, combined with the official documentation: https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/use_cases/ssh /#2-connect-as-a-user
* Official cloudflared download: https://github.com/cloudflare/cloudflared/releases
* The following are examples of input commands
```
<filepath>/cloudflared access ssh --hostname ssh.seals.nom.za
```
<img width="828" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/25c7bd31-21b5-4684-b1cf-d6d6e0e85058">
<img width="830" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/20a8661c-90b8-4b77-a046-0a2e42d7fee5">
<img width="1201" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/3146b2e2-f988-487f-ab63-00218eb4d570">
## Automatically restore backups
* Change the name of the file to be restored to `README.md` in the github backup repository, the timer service will check for updates every minute and record the last synchronized filename in the local `/dbfile` to compare with the online file content.
The following is an example of restoring a file with the name `dashboard-2023-04-23-13:08:37.tar.gz`.
! [image](https://user-images.githubusercontent.com/92626977/233822466-c24e94f6-ba8a-47c9-b77d-aa62a56cc929.png)
## Manually restore the backup
* ssh into the container and run, tar.gz filename from the github backup repository, format: dashboard-2023-04-22-21:42:10.tar.gz
```
bash /dashboard/restore.sh <filename>
```
<img width="1209" alt="image" src="https://user-images.githubusercontent.com/92626977/233792709-fb37b79c-c755-4db1-96ec-1039309ff932.png">
## Migrating data
* Backup the `/dashboard` folder of the original Nezha and zip it up to `dashboard.tar.gz` file.
```
tar czvf dashboard.tar.gz /dashboard
```
* Download the file and put it into a private repository, the name of the repository should be exactly the same as <GH_REPO>, and edit the contents of README.md of the repository to `dashboard.tar.gz`.
* Deploy the new Nezha in this project, and fill in the variables completely. After the deployment is done, the auto-restore script will check every minute, and will restore automatically if it finds any new content, the whole process will take about 3 minutes.
## Main catalog files and descriptions
```
.
|-- dashboard
| |-- app # Nezha panel main program
| |-- argo.json # Argo tunnel json file, which records information about using the tunnel.
| |-- argo.yml # Argo tunnel yml file, used for streaming web, gRPC and ssh protocols under a single tunnel with different domains.
| |-- backup.sh # Backup data scripts
| |-- data
| | |-- config.yaml # Configuration for the Nezha panel, e.g. Github OAuth2 / gRPC domain / port / TLS enabled or not.
| | `-- sqlite.db # SQLite database file that records all severs and cron settings for the panel.
| |-- entrypoint.sh # The main script, which is executed after the container is run.
| |-- nezha-agent # Nezha client, used to monitor the localhost.
| |-- nezha.csr # SSL/TLS certificate signing request
| |-- nezha.key # Private key information for SSL/TLS certificate.
| |-- nezha.pem # SSL/TLS Privacy Enhancement Email
| `-- restore.sh # Restore backup scripts
`-- dbfile # Record the name of the latest restore or backup file
```
## Acknowledgements for articles and projects by
* Robin, an enthusiastic sunrise crowd, for discussing the relationship between Nezha's server and client, which led to the birth of this project.
* Nezha website: https://nezha.wiki/ , TG Group: https://t.me/nezhamonitoring
* Common Poverty International Old Chinese Medicine: http://solitud.es/
* Akkia's Blog: https://blog.akkia.moe/
* HiFeng's Blog: https://www.hicairo.com/
* Intranet Penetration with Cloudflare Tunnel: https://blog.outv.im/2021/cloudflared-tunnel/
## Disclaimer
* This program is only for learning and understanding, non-profit purposes, please delete within 24 hours after downloading, not for any commercial purposes, text, data and images are copyrighted, if reproduced must indicate the source.
* Use of this program is subject to the deployment disclaimer. Use of this program must follow the deployment of the server location, the country and the user's country laws and regulations, the author of the program is not responsible for any misconduct of the user.