增加非容器方案;增加通过 Github 触发备份数据功能。 (#47)
This commit is contained in:
+78
-70
@@ -14,9 +14,11 @@ Mirror backup (not live update): [Argo-Nezha-Service-Container](https://github.c
|
||||
- [How to get Argo authentication: json or token](case5.md#How-to-get-Argo-authentication-json-or-token)
|
||||
- [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)
|
||||
- [VPS Deployment Method 1 --- docker](case5.md#vps-deployment-method-1-----docker)
|
||||
- [VPS Deployment Method 2 --- hosts](case5.md#vps-deployment-method-2-----hosts)
|
||||
- [Client Access](case5.md#client-access)
|
||||
- [SSH Access](case5.md#ssh-access)
|
||||
- [Manual Backup data](case5.md#manual-backup-data)
|
||||
- [Auto Restore Backup](case5.md#automatically-restore-backups)
|
||||
- [Manual Restore Backup](case5.md#manually-restore-the-backup)
|
||||
- [Migrating data](case5.md#migrating-data)
|
||||
@@ -27,7 +29,7 @@ Mirror backup (not live update): [Argo-Nezha-Service-Container](https://github.c
|
||||
* * *
|
||||
|
||||
## 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.
|
||||
* Wider scope of application --- As long as there is a network connection, Nezha server can be installed, such as LXC, OpenVZ VPS, 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).
|
||||
@@ -38,32 +40,7 @@ Mirror backup (not live update): [Argo-Nezha-Service-Container](https://github.c
|
||||
* 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/a1192434-fb60-4944-b6d0-de4235323e3d">
|
||||
|
||||
|
||||
## How to get Argo authentication: json or token
|
||||
The Argo Tunnel authentication methods are json and token, use one of the two methods.
|
||||
|
||||
### (Methods 1 - Josn):
|
||||
#### Easily get Argo tunnel json information through Cloudflare Json Generation Network: https://fscarmen.cloudflare.now.cc
|
||||
|
||||
<img width="862" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/7bf8fefd-328f-43a1-ada6-4472904e8adb">
|
||||
|
||||
#### 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">
|
||||
|
||||
### (Methods 2 - Token): Manually generate Argo tunnel token information via Cloudflare website.
|
||||
#### Go to the cf website: https://dash.cloudflare.com/ and go to zero trust to generate token tunnels and messages.
|
||||
|
||||
<img width="1672" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/c2952ef2-7a3d-4242-84bc-3cbada1d337c">
|
||||
<img width="1652" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/89b2b758-e550-413d-aa3e-216d226da7f4">
|
||||
<img width="1463" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/9f77e26b-a25d-4ff0-8425-1085708e19c3">
|
||||
<img width="1652" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/d0fba15c-f41b-4ee4-bea3-f0506d9b2d23">
|
||||
<img width="1394" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/ab526fae-7a71-4a7c-9aee-a3bfe4774958">
|
||||
<img width="1671" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/c6bcc511-e2f9-4616-bcca-47e1a8a25313">
|
||||
<img width="1670" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/7fbe3ef7-fb43-4925-9478-89ee08e44941">
|
||||
<img width="1609" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/4893c3cd-5055-468f-8138-6c5460bdd1e4">
|
||||
|
||||
|
||||
## Prepare variables to be used
|
||||
@@ -88,6 +65,29 @@ Add `https://` to the beginning of the panel's domain name and `/oauth2/callback
|
||||
<img width="716" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/499fb58d-9dc7-4b3f-84d7-d709d679ec80">
|
||||
|
||||
|
||||
## How to get Argo authentication: json or token
|
||||
Argo tunnel authentication methods include json and token, use one of the two methods. The former is recommended because the script will handle all the Argo tunnel parameters and paths, while the latter needs to be set manually on the Cloudflare website and is prone to errors.
|
||||
|
||||
### (Methods 1 - Json):
|
||||
#### Easily get Argo tunnel json information through Cloudflare Json Generation Network: https://fscarmen.cloudflare.now.cc
|
||||
|
||||
<img width="862" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/7bf8fefd-328f-43a1-ada6-4472904e8adb">
|
||||
|
||||
### (Methods 2 - Token): Manually generate Argo tunnel token information via Cloudflare website.
|
||||
#### Go to the cf website: https://dash.cloudflare.com/
|
||||
* Go to zero trust and generate token tunnel and message.
|
||||
* The data path 443/https is proto.
|
||||
* ssh path 22/ssh for < client id >.
|
||||
|
||||
<img width="1672" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/c2952ef2-7a3d-4242-84bc-3cbada1d337c">
|
||||
<img width="1652" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/89b2b758-e550-413d-aa3e-216d226da7f4">
|
||||
<img width="1463" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/9f77e26b-a25d-4ff0-8425-1085708e19c3">
|
||||
<img width="1342" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/538707e1-a17b-4a0f-a8c0-63d0c7bc96aa">
|
||||
<img width="1020" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/9f5778fd-aa94-4fda-9d85-552b68f6d530">
|
||||
<img width="1652" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/d0fba15c-f41b-4ee4-bea3-f0506d9b2d23">
|
||||
<img width="1401" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/ed3d0849-da78-4fd5-9510-d410afc5e6af">
|
||||
|
||||
|
||||
## PaaS Deployment Example
|
||||
Image `fscarmen/argo-nezha:latest`, supports amd64 and arm64 architectures.
|
||||
|
||||
@@ -102,24 +102,21 @@ Variables used
|
||||
| GH_EMAIL | No | github's mailbox for git push backups to remote repositories |
|
||||
| GH_PAT | No | github's PAT |
|
||||
| ARGO_AUTH | Yes | Argo Json from https://fscarmen.cloudflare.now.cc<br>Argo token from Cloudflare official website |
|
||||
| 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 |
|
||||
| ARGO_DOMAIN | Yes | Argo domain |
|
||||
|
||||
Koyeb
|
||||
|
||||
[](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_AUTH]=&env[DATA_DOMAIN]=&env[WEB_DOMAIN]=&env[SSH_DOMAIN]=&env[SSH_PASSWORD]=&image=docker.io/fscarmen/argo-nezha)
|
||||
[](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_AUTH]=&env[ARGO_DOMAIN]=&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="778" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/c070b085-dd7a-4182-9439-857f3116814e">
|
||||
<img width="854" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/655c889e-3037-46d7-ab00-3e6085e86f66">
|
||||
<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.
|
||||
## VPS Deployment Method 1 --- docker
|
||||
* Note: ARGO_DOMAIN= 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.
|
||||
|
||||
@@ -128,6 +125,7 @@ Koyeb
|
||||
```
|
||||
docker run -dit \
|
||||
--name nezha_dashboard \
|
||||
--pull always \
|
||||
--restart always \
|
||||
-e GH_USER=<fill in github username> \
|
||||
-e GH_EMAIL=<fill in github email> \
|
||||
@@ -136,10 +134,8 @@ docker run -dit \
|
||||
-e GH_CLIENTID=<fill in acquired> \
|
||||
-e GH_CLIENTSECRET=<fill in acquired> \
|
||||
-e ARGO_AUTH='<Fill in the fetched Argo json or token>' \
|
||||
-e WEB_DOMAIN=<fill in customized> \
|
||||
-e DATA_DOMAIN=<fill in customized> \
|
||||
-e SSH_DOMAIN=<fill in customized> \
|
||||
-e SSH_PASSWORD=<insert customized> \
|
||||
-e ARGO_DOMAIN=<fill in customized> \
|
||||
-e GH_BACKUP_USER=<If it is consistent with GH_USER, you can leave it blank> \
|
||||
fscarmen/argo-nezha
|
||||
```
|
||||
|
||||
@@ -149,6 +145,7 @@ version: '3.8'
|
||||
services.
|
||||
argo-nezha.
|
||||
image: fscarmen/argo-nezha
|
||||
--pull always
|
||||
container_name: nezha_dashboard
|
||||
restart: always
|
||||
environment:
|
||||
@@ -159,10 +156,14 @@ services.
|
||||
- GH_CLIENTID=<fill in obtained>
|
||||
- GH_CLIENTSECRET=<fill in fetched>
|
||||
- ARGO_AUTH='<Fill in the fetched Argo json or token>'
|
||||
- WEB_DOMAIN=<fill customized>
|
||||
- DATA_DOMAIN=<fill in customized>
|
||||
- SSH_DOMAIN=<insert customized>
|
||||
- SSH_PASSWORD=<fill customized>
|
||||
- ARGO_DOMAIN=<fill in customized>
|
||||
- GH_BACKUP_USER=<If it is consistent with GH_USER, you can leave it blank>
|
||||
```
|
||||
|
||||
|
||||
## VPS Deployment Method 2 --- hosts
|
||||
```
|
||||
bash <(wget -qO- https://raw.githubusercontent.com/fscarmen2/Argo-Nezha-Service-Container/main/dashboard.sh)
|
||||
```
|
||||
|
||||
|
||||
@@ -176,16 +177,25 @@ curl -L https://raw.githubusercontent.com/naiba/nezha/master/script/install.sh -
|
||||
## 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
|
||||
* The following are examples of input commands.
|
||||
SSH user: root, SSH password:<GH_CLIENTSECRET>
|
||||
```
|
||||
<filepath>/cloudflared access ssh --hostname ssh.seals.nom.za
|
||||
<filepath>/cloudflared access ssh --hostname ssh.seals.nom.za/<GH_CLIENTID>
|
||||
```
|
||||
|
||||
<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="1189" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/0aeb3939-51c7-47ac-a7fd-25a8a01d3df5">
|
||||
<img width="840" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/16961ade-aafc-4132-92a1-aa218e0fead9">
|
||||
<img width="1201" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/3146b2e2-f988-487f-ab63-00218eb4d570">
|
||||
|
||||
|
||||
## Manually backing up your data
|
||||
Method 1: Change the contents of the `README.md` file in the Github backup repository to `backup`
|
||||
|
||||
<img width="970" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/c5b6bc4b-e69c-48ce-97d4- 3f9be88515f3">
|
||||
|
||||
Method 2: After ssh, run `/dashboard/backup.sh` for container version; `/opt/nezha/dashboard/backup.sh` for VPS host version.
|
||||
|
||||
|
||||
## 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.
|
||||
|
||||
@@ -213,28 +223,24 @@ tar czvf dashboard.tar.gz /dashboard
|
||||
|
||||
## 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.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
|
||||
|-- usr
|
||||
| `-- local
|
||||
| `-- bin
|
||||
| |-- cloudflared # Cloudflare Argo tunnel main program.
|
||||
| |-- grpcwebproxy # gRPC reverse proxy main program.
|
||||
| `-- nezha-agent # Nezha client, used to monitor the localhost.
|
||||
|-- dbfile # Record the name of the latest restore or backup file
|
||||
`-- version # Record the current panel app version
|
||||
/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
|
||||
|-- restore.sh # Restore backup scripts
|
||||
|-- dbfile # Record the name of the latest restore or backup file
|
||||
|-- resource # Folders of information on panel themes, languages, flags, etc.
|
||||
|-- 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.csr # SSL/TLS certificate signing request
|
||||
|-- nezha.key # Private key information for SSL/TLS certificate.
|
||||
|-- nezha.pem # SSL/TLS certificate file.
|
||||
|-- cloudflared # Cloudflare Argo tunnel main program.
|
||||
|-- grpcwebproxy # gRPC reverse proxy main program.
|
||||
`-- nezha-agent # Nezha client, used to monitor the localhost.
|
||||
```
|
||||
|
||||
|
||||
@@ -243,12 +249,14 @@ tar czvf dashboard.tar.gz /dashboard
|
||||
* 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/
|
||||
* Ayaka's Blog: https://blog.xn--pn1aul.org/
|
||||
* HiFeng's Blog: https://www.hicairo.com/
|
||||
* Intranet Penetration with Cloudflare Tunnel: https://blog.outv.im/2021/cloudflared-tunnel/
|
||||
* How to add your own Runner host to GitHub Actions: https://cloud.tencent.com/developer/article/1756690
|
||||
* github self-hosted runner addition and startup: https://blog.csdn.net/sinat_32188225/article/details/125978331
|
||||
* How to export a file from a Docker image: https://www.pkslow.com/archives/extract-files-from-docker-image
|
||||
* grpcwebproxy: https://github.com/improbable-eng/grpc-web/tree/master/go/grpcwebproxy
|
||||
* Applexad's binary of Nezha's officially dashboard: https://github.com/applexad/nezha-binary-build
|
||||
|
||||
|
||||
## Disclaimer
|
||||
|
||||
Reference in New Issue
Block a user