更新DDNS及公开备注文档,增加自定义主题说明 (#103)

* 更新DDNS及公开备注文档

* 增加自定义主题说明
This commit is contained in:
UUBulb
2024-10-18 00:03:16 +08:00
committed by GitHub
parent 54ff2467eb
commit 0b492ad7a5
7 changed files with 245 additions and 211 deletions
+77
View File
@@ -0,0 +1,77 @@
---
outline: deep
---
# DDNS
The DDNS functionality is designed for servers with dynamic IP addresses. When the Agent server reports a new IP (every 10 minutes), Dashboard will automatically update the DNS record based on the configuration.
### Why should I use Nezha's DDNS functionality?
- Convenient centralized management of DDNS settings, instead of deploying a DDNS service on every server.
- Your confidential information is only stored on the Dashboard server, preventing leaks.
### Configuration
You can directly add DDNS configurations in the Dashboard management page.
1. Click on the "Dynamic DNS" option in the menu bar to enter the configuration page.
2. Click the "New Profile" button and fill in the required information in the pop-up window. Option details:
- **Name**: The name of the configuration.
- **DDNS Provider**: The type of provider, determining the method used to update DNS records.
- **Domains (separate with comma)**: The domain(s), if you enter multiple domains, they should be separated by commas. IDNs (Internationalized Domain Names) are supported.
- **Maximum retry attempts**: The number of attempts for updating DDNS, default is 3, and the range is between 1 and 10.
- **DDNS Credential 1** and **DDNS Credential 2** are optional. Typically, at least one needs to be provided. The [table](#provider-list) below lists the options for all providers.
3. If using the `webhook` provider, the corresponding options need to be filled out as required. For detailed instructions, see [Webhook Configuration](#webhook-configuration).
4. You need to check at least one of **IPv4 Enabled** and **IPv6 Enabled**; otherwise, no update operations will be performed.
5. After adding a new configuration, you also need to modify the server settings to activate DDNS. Server-related options include:
- **Enable DDNS**: Enable DDNS functionality for this server.
- **DDNS Profiles**: The list of DDNS configuration IDs to use, searchable by configuration name.
## Webhook Configuration
Webhook requires manually constructing HTTP requests, suitable for using other provider services when operations are simple.
Webhook option descriptions:
- **Webhook URL**: The URL for the HTTP request, where parameters can use placeholders.
- **Webhook Request Method**: The HTTP request method. Supported methods include `GET`, `POST`, `PATCH`, `DELETE`, and `PUT`.
- **Webhook Request Type**: The format of the HTTP request body, either `JSON` or `Form`.
- **Webhook Request Headers**: HTTP request headers, filled in JSON format, but nesting is not supported.
- **Webhook Request Body**: The HTTP request body. It won't be used for `GET` and `DELETE`. If you need to use a nested format, you must choose `JSON` as the request type.
Supported Webhook placeholders:
- `#ip#`: Host IP.
- `#domain#`: DDNS domain. Each request is made separately for each domain, so this value will be a single domain string.
- `#type#`: IP type, either `"ipv4"` or `"ipv6"`.
- `#record#`: Record type, either `"A"` or `"AAAA"`.
- `#access_id#`: DDNS Credential 1.
- `#access_secret#`: DDNS Credential 2.
### Oray Webhook Example
<details>
<summary>Click to expand/collapse</summary>
- URL`http://ddns.oray.com/ph/update?hostname=#domain#&myip=#ip#`
- Request Method: `GET`
- Request Header`{"Authorization": "Basic pass"}`, replace `pass` with the Base64-encoded userpass (e.g., `user:pass` becomes `dXNlcjpwYXNzCg==`).
- Oray only supports A records, so only enable IPv4. Other Webhook options are not required.
</details>
## Provider List
| Provider | Credential 1 (ID) | Credential 2 (Secret) |
| ------------ | ----------- | --------------- |
| `dummy` | ❌️ | ❌️ |
| `webhook` | Optional | Optional |
| `cloudflare` | ❌️ | ✅ |
| `tencentcloud`| ✅ | ✅ |
## Viewing Logs
In the Dashboard logs, you can see the relevant logs for the DDNS functionality. When configured correctly, there will be corresponding log entries when updating DNS records.
```shell
dashboard_1 | 2024/03/16 23:16:25 NEZHA>> 正在尝试更新域名(ddns.example.com)DDNS(1/3)
dashboard_1 | 2024/03/16 23:16:28 NEZHA>> 尝试更新域名(ddns.example.com)DDNS成功
```
+9 -110
View File
@@ -31,7 +31,9 @@ The forced update will not work if `disable-force-update` is enabled.
* Enable DDNS: When true, if the server IP changes, the Dashboard will automatically update the DNS records.
* DDNS Domain: The DDNS domain configured for this server.
* Secret: The secret/key used for configuring the Agent, which is used to verify communication between the Agent and the Dashboard.
* One-Click Install: Click the corresponding system button to copy the command and execute it on the server for a one-click installation.
* Note: Server notes, visible only after verification.
* Public Note: Server public notes, visible on the frontend. You can customize frontend theme based on this field; see [Public Note Example](#public-note-example) for details.
* Installation commands: Click the corresponding system button to copy the command and execute it on the server for an instant installation.
* Management: Connects to WebShell, modifies server configuration, or deletes the server.
## WebSSH Terminal
@@ -44,114 +46,11 @@ If the connection fails, refer to [Real-Time Channel Disconnection/Online Termin
Added in Dashboard v0.19.1 / Agent v0.19.0. A pseudo file manager embedded in WebShell, supports file download/upload, directory navigation and copying current path. Access it by clicking the blue button in the bottom-right corner of the WebShell.
## DDNS Functionality
## Public Note Example
The DDNS functionality is suitable for servers with dynamic IPs. When the Agent reports a new IP (every 10 minutes), the Dashboard will automatically update the DNS records based on the configuration.
### ServerStatus Theme Agent Billing Information Display
<details>
<summary>Click to expand/collapse</summary>
### Why Use Nezha Monitoring's DDNS Functionality?
- Centralized management of DDNS settings instead of deploying a DDNS service on each server.
- Confidential information is only stored on the Dashboard server, preventing leakage.
### Configuration Instructions
You can choose to use profiles or not; If no profile is set, all Agent servers will use the same configuration to update DDNS. If profiles are used, each server can have a specific configuration for updating DDNS, providing greater flexibility.
#### Without Profiles
::: warning
This configuration is deprecated and will be removed in a future release. Please switch to using profiles instead.
:::
```yaml
DDNS:
Enable: true
Provider: "webhook"
AccessID: ""
AccessSecret: ""
WebhookMethod: ""
WebhookURL: ""
WebhookRequestBody: ""
WebhookHeaders: ""
MaxRetries: 3
Profiles: null
```
- `Enable`: Boolean value to enable or disable the DDNS functionality.
- `Provider`: The name of the DDNS provider; currently supports `webhook`, `cloudflare`, and `tencentcloud`.
- `AccessID`: Token ID for the DDNS provider; only applicable to the `tencentcloud` provider.
- `AccessSecret`: Token Secret for the DDNS provider; only applicable to the `cloudflare` and `tencentcloud` providers.
- `WebhookMethod`: The request method for the webhook, such as `GET` or `POST`; only applicable to the `webhook` provider.
- `WebhookURL`: The request URL for the webhook; only applicable to the `webhook` provider.
- `WebhookRequestBody`: The request body for the webhook; only applicable to the `webhook` provider.
- `WebhookHeaders`: The request headers for the webhook; only applicable to the `webhook` provider.
- `MaxRetries`: The number of retry attempts when a request fails.
- `Profiles`: Multi-configuration settings; ignored in single configuration settings.
The `WebhookURL`, `WebhookRequestBody`, and `WebhookHeaders` can include the following placeholders:
- `{ip}`: The current IP of the server.
- `{domain}`: The DDNS domain. If used with `WebhookURL`, only query values will be replaced.
- `{type}`: The IP type, either "ipv4" or "ipv6".
- `{access_id}`: Credential 1.
- `{access_secret}`: Credential 2.
Example Configuration:
```yaml
WebhookHeaders: |
a:{access_id}
b:{access_secret}
WebhookRequestBody: '{"domain": "{domain}", "ip": "{ip}", "type": "{type}"}'
```
#### With Profiles
When using profiles, leave the `DDNS.Provider` value empty. If `DDNS.Provider` is not empty, this configuration will be ignored.
```yaml
DDNS:
Enable: true
MaxRetries: 3
Profiles:
example:
Provider: ""
AccessID: ""
AccessSecret: ""
WebhookMethod: ""
WebhookURL: ""
WebhookRequestBody: ""
WebhookHeaders: ""
```
- `Profiles`: Profile field.
- `example`: Can be replaced with any string as the DDNS configuration name.
Other options can be referenced from the [Without Profiles](#Without-Profiles) section.
#### Dashboard Configuration
After modifying the configuration file, you also need to modify the server settings in the Dashboard for the DDNS to take effect.
DDNS related options:
- `Enable DDNS`: Enable the DDNS functionality for this server.
- `Enable DDNS IPv4`: Enable IPv4 resolution when updating DDNS records.
- `Enable DDNS IPv6`: Enable IPv6 resolution when updating DDNS records.
- `DDNS Domain`: The domain the record points to.
- `DDNS Configuration`: The DDNS configuration name to use in multiple configurations.
::: warning
When you modify the configuration and save it in the Dashboard settings, it will populate the default configuration options in `config.yaml`, and all options in the DDNS field will be set with a default value (see [Without Profiles](#Without-Profiles)).
- If not using profiles, configure `DDNS.Provider` and ignore the `Profiles` options.
- To use profiles, leave `DDNS.Provider` empty. If `DDNS.Provider` is not empty, the `Profiles` field will be ignored.
:::
#### Viewing Logs
In the Dashboard logs, you can see the relevant logs for the DDNS functionality. When configured correctly, there will be corresponding log entries when updating DNS records.
```shell
dashboard_1 | 2024/03/16 23:16:25 NEZHA>> 正在尝试更新域名(ddns.example.com)DDNS(1/3) # Attempting to update domain (ddns.example.com) DDNS (1/3)
dashboard_1 | 2024/03/16 23:16:28 NEZHA>> 尝试更新域名(ddns.example.com)DDNS成功 # Successfully updated domain (ddns.example.com) DDNS
```
See https://github.com/naiba/nezha/pull/425.
</details>
+5 -2
View File
@@ -15,8 +15,11 @@ You can customize the site title in this section.
## Theme
Select the theme for the homepage and admin panel here. If a theme that already exists is not in the options, update the Dashboard.
Before enabling the Custom theme, ensure you have installed the custom theme; otherwise, the Dashboard will not display correctly after enabling this option.
Select the theme for the frontend and dashboard here. If a theme that already exists is not in the options, update the Dashboard.
To use a custom frontend theme, you need to create a theme description file. For more information on custom themes, please refer to [Nezha Theme Development Environment](/en_US/developer/theme.html).
Before enabling the dashboard Custom theme, ensure you have installed the custom theme; otherwise, the Dashboard will not display correctly after enabling this option.
## Language