nezhahq.github.io/assets/en_US_guide_dashboard.md.d3da906a.js

22 lines
16 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{_ as e,o as a,c as t,R as o}from"./chunks/framework.44fd0451.js";const y=JSON.parse('{"title":"","description":"","frontmatter":{},"headers":[],"relativePath":"en_US/guide/dashboard.md","filePath":"en_US/guide/dashboard.md","lastUpdated":1698375851000}'),s={name:"en_US/guide/dashboard.md"},n=o(`<h2 id="preparations" tabindex="-1">Preparations <a class="header-anchor" href="#preparations" aria-label="Permalink to &quot;Preparations&quot;"></a></h2><p>To setup a Nezha monitorning Dashboard, you need these things:</p><ol><li>A VPS that can connect to the Internet, firewall and security policies need to open ports 8008 and 5555, otherwise it will be inaccessible and unable to receive data. A 1 core 512MB RAM server is sufficient for most usage scenarios</li><li>A domain name that has been set up with an A record that resolves to the Dashboard server IP</li></ol><div class="tip custom-block"><p class="custom-block-title">TIP</p><p>If you want to use CDN, please prepare two domains, one connect to CDN for public access, CDN needs to support WebSocket protocol; the other domain should not connect to CDN, use it as Agent to send data to Dashboard.<br> This document uses &quot;cdn.example.com&quot; and &quot;data.example.com&quot; domains to demonstrate respectively</p></div><ol start="3"><li>A Github or Gitlab account</li></ol><p><strong>This document will use the aaPanel as an example, with future versions of the changes, some of the features may change, this document is for reference only</strong></p><div class="warning custom-block"><p class="custom-block-title">WARNING</p><p>This project does not rely on aaPanel, you can choose to use any server panel you like, and if you are capable enough, you can manually install NginX or Caddy to configure SSL and reverse proxy.<br> If you don&#39;t think it&#39;s necessary to use port 80 or 443 to access Dashboard, you don&#39;t even need to install NginX and you can just use the install script.</p></div><br><br><h2 id="get-the-client-id-and-client-secret-on-github-gitlab" tabindex="-1">Get the Client ID and Client Secret on Github/Gitlab <a class="header-anchor" href="#get-the-client-id-and-client-secret-on-github-gitlab" aria-label="Permalink to &quot;Get the Client ID and Client Secret on Github/Gitlab&quot;"></a></h2><p>Nezha Monitor uses a Github account as the login account for the admin panel</p><ul><li>First we need to create a new authentication application, after logging into Github, open <a href="https://github.com/settings/developers" target="_blank" rel="noreferrer">https://github.com/settings/developers</a> and select &quot;OAuth Apps&quot; - &quot;New OAuth App &quot;<br><code>Application name</code> - Fill in as you like<br><code>Homepage URL</code> - Fill in the panel&#39;s access domain name, such as: &quot;<a href="http://cdn.example.com" target="_blank" rel="noreferrer">http://cdn.example.com</a>&quot;<br><code>Authorization callback URL</code> - Fill in the callback address, e.g., &quot;<a href="http://cdn.example.com/oauth2/callback" target="_blank" rel="noreferrer">http://cdn.example.com/oauth2/callback</a>&quot;</li><li>Click on &quot;Registration Application&quot;</li><li>Remember the Client ID in the page, then click &quot;Generate a new client secret&quot; to create a new Client Secret, the new secret will be displayed only once, please save it properly <br><br></li><li>If you&#39;re using Gitlab, you&#39;ll need to go to <a href="https://gitlab.com/-/profile/applications" target="_blank" rel="noreferrer">https://gitlab.com/-/profile/applications</a> to create a new application</li><li>Fill in <code>Redirect URL</code> with the callback address</li><li>In <code>Scopes</code>, select <code>read_user</code> and <code>read_api</code></li><li>Once created, save the Application ID and Secret</li></ul><h2 id="installing-dashboard-on-the-server" tabindex="-1">Installing Dashboard on the server <a class="header-anchor" href="#installing-dashboard-on-the-server" aria-label="Permalink to &quot;Installing Dashboard on the server&quot;"></a></h2><ul><li>In the panel server, run the installation script:</li></ul><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">curl</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-L</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">https://raw.githubusercontent.com/naiba/nezha/master/script/install_en.sh</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">-o</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">nezha.sh</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&amp;&amp;</span><span style="color:#A6ACCD;"> </span><span style="color:#FFCB6B;">chmod</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">+x</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">nezha.sh</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">&amp;&amp;</span><span style="color:#A6ACCD;"> </span><span style="color:#FFCB6B;">sudo</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">./nezha.sh</span></span></code></pre></div><ul><li><p>After waiting for the Docker installation to complete, input the following settings:<br><code>OAuth2 provider</code> - Github or Gitlab<br><code>Client ID</code> - Previously saved Client ID<br><code>Client Secret</code> - Previously saved secret<br><code>GitHub/Gitee login name</code> - Github o Gitlab username<br><code>Site title</code> - Custom site title<br><code>Site access port</code> - Public access port, customizable, default 8008<br><code>RPC port</code> - The communication port between Agent and Dashboard, default 5555</p></li><li><p>After the input is complete, wait to pull the mirror<br> After the installation, if everything is fine, you can visit the domain + port number, such as &quot;<a href="http://cdn.example.com:8008" target="_blank" rel="noreferrer">http://cdn.example.com:8008</a>&quot; to view the Dashboard</p></li><li><p>In the future, if you need to run the script again, you can run:</p></li></ul><div class="language-bash"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#FFCB6B;">./nezha.sh</span></span></code></pre></div><p>to open the management script<br><br><br></p><h2 id="configure-reverse-proxy" tabindex="-1">Configure reverse proxy <a class="header-anchor" href="#configure-reverse-proxy" aria-label="Permalink to &quot;Configure reverse proxy&quot;"></a></h2><ul><li><p>Create a new site in the aaPanel, fill in the public access domain name, such as &quot;<a href="http://cdn.example.com" target="_blank" rel="noreferrer">http://cdn.example.com</a>&quot;, then click &quot;Settings&quot; to enter the site settings option, select &quot; Reverse proxy&quot; - &quot;New reverse proxy&quot;</p></li><li><p>Customize a proxy name, fill in <code>http://127.0.0.1</code> in the &quot;Target URL&quot; and click &quot;Save&quot;</p></li><li><p>Open the &quot; configuration&quot; to the right of the new reverse proxy you just created and replace the configuration file with the following:</p></li></ul><div class="language-nginx"><button title="Copy Code" class="copy"></button><span class="lang">nginx</span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#676E95;font-style:italic;">#PROXY-START/</span></span>
<span class="line"><span style="color:#C792EA;">location</span><span style="color:#A6ACCD;"> </span><span style="color:#FFCB6B;">/ </span><span style="color:#A6ACCD;">{</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;"> proxy_pass </span><span style="color:#A6ACCD;">http://127.0.0.1:8008</span><span style="color:#89DDFF;">;</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;"> proxy_set_header </span><span style="color:#A6ACCD;">Host </span><span style="color:#89DDFF;">$</span><span style="color:#A6ACCD;">http_host</span><span style="color:#89DDFF;">;</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;"> proxy_set_header </span><span style="color:#A6ACCD;"> Upgrade </span><span style="color:#89DDFF;">$</span><span style="color:#A6ACCD;">http_upgrade</span><span style="color:#89DDFF;">;</span></span>
<span class="line"><span style="color:#A6ACCD;">}</span></span>
<span class="line"><span style="color:#C792EA;">location</span><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;">~</span><span style="color:#A6ACCD;"> </span><span style="color:#C3E88D;">^/(ws|terminal/.+)$ </span><span style="color:#A6ACCD;">{</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;"> proxy_pass </span><span style="color:#A6ACCD;">http://127.0.0.1:8008</span><span style="color:#89DDFF;">;</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;"> proxy_http_version </span><span style="color:#A6ACCD;">1.1</span><span style="color:#89DDFF;">;</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;"> proxy_set_header </span><span style="color:#A6ACCD;">Upgrade </span><span style="color:#89DDFF;">$</span><span style="color:#A6ACCD;">http_upgrade</span><span style="color:#89DDFF;">;</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;"> proxy_set_header </span><span style="color:#A6ACCD;">Connection </span><span style="color:#C3E88D;">&quot;Upgrade&quot;</span><span style="color:#89DDFF;">;</span></span>
<span class="line"><span style="color:#A6ACCD;"> </span><span style="color:#89DDFF;"> proxy_set_header </span><span style="color:#A6ACCD;">Host </span><span style="color:#89DDFF;">$</span><span style="color:#A6ACCD;">http_host</span><span style="color:#89DDFF;">;</span></span>
<span class="line"><span style="color:#A6ACCD;">}</span></span>
<span class="line"><span style="color:#676E95;font-style:italic;">#PROXY-END/</span></span></code></pre></div><ul><li>Click &quot;Save&quot;<br> Now, you should be able to access the panel directly using a domain name such as: &quot;<a href="http://cdn.example.com" target="_blank" rel="noreferrer">http://cdn.example.com</a>&quot;<br><br></li></ul><h4 id="other" tabindex="-1">Other: <a class="header-anchor" href="#other" aria-label="Permalink to &quot;Other:&quot;"></a></h4><ul><li><p>CaddyServer v1v2 no special configuration required</p><div class="language-"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki material-theme-palenight"><code><span class="line"><span style="color:#A6ACCD;">proxy /ws http://ip:8008 {</span></span>
<span class="line"><span style="color:#A6ACCD;"> websocket</span></span>
<span class="line"><span style="color:#A6ACCD;"> header_upstream -Origin</span></span>
<span class="line"><span style="color:#A6ACCD;">}</span></span>
<span class="line"><span style="color:#A6ACCD;">proxy /terminal/* http://ip:8008 {</span></span>
<span class="line"><span style="color:#A6ACCD;"> websocket</span></span>
<span class="line"><span style="color:#A6ACCD;"> header_upstream -Origin</span></span>
<span class="line"><span style="color:#A6ACCD;">}</span></span></code></pre></div></li></ul><br><br><h2 id="configuring-ssl-in-the-aapanel" tabindex="-1">Configuring SSL in the aaPanel <a class="header-anchor" href="#configuring-ssl-in-the-aapanel" aria-label="Permalink to &quot;Configuring SSL in the aaPanel&quot;"></a></h2><p>First, temporarily disable the reverse proxy<br> As with other websites, you can choose to automatically apply for a Let´s Encrypt certificate or manually configure an existing certificate by going to &quot;SSL&quot; in the site settings<br> After you finish setting up SSL, you need to go back to <a href="https://github.com/settings/developers" target="_blank" rel="noreferrer">https://github.com/settings/developers</a> and edit the authentication application you created before, change all the domain names in the &quot;Homepage URL&quot; and &quot;Authorization callback URL&quot; you filled in before from <code>http</code> to <code>https</code>, such as: &quot;<a href="https://cdn.example.com" target="_blank" rel="noreferrer">https://cdn.example.com</a>&quot; and &quot;<a href="https://cdn.example.com/oauth2/callback" target="_blank" rel="noreferrer">https://cdn.example.com/oauth2/callback</a>&quot;, <strong>If you don&#39;t change these links, you may not be able to log into the admin panel</strong></p><h2 id="faq" tabindex="-1">FAQ <a class="header-anchor" href="#faq" aria-label="Permalink to &quot;FAQ&quot;"></a></h2><h3 id="what-should-i-do-if-terminal-or-ws-cannot-be-connected-after-https-is-enabled" tabindex="-1">What should I do if /terminal or /ws cannot be connected after HTTPS is enabled? <a class="header-anchor" href="#what-should-i-do-if-terminal-or-ws-cannot-be-connected-after-https-is-enabled" aria-label="Permalink to &quot;What should I do if /terminal or /ws cannot be connected after HTTPS is enabled?&quot;"></a></h3><p>It is often caused by incomplete certificates. Please add -d to the agent running parameters. If there is x509: certificate signed by unknown authority in the log, replacing the complete certificate can solve the problem 100%.</p><h3 id="i-am-not-satisfied-with-the-data-modification-or-addition-function-provided-by-the-dashboard-what-if-i-want-to-modify-or-add-data-myself" tabindex="-1">I am not satisfied with the data modification or addition function provided by the Dashboard, what if I want to modify or add data myself? <a class="header-anchor" href="#i-am-not-satisfied-with-the-data-modification-or-addition-function-provided-by-the-dashboard-what-if-i-want-to-modify-or-add-data-myself" aria-label="Permalink to &quot;I am not satisfied with the data modification or addition function provided by the Dashboard, what if I want to modify or add data myself?&quot;"></a></h3><p>Commonly used in requirements such as batch installation of Agents, where you can modify the database directly.<br> Please note that not everything can be modified in the database, wrong modification will lead to data confusion and failure to start Dashboard, <strong>please do not modify the database at will!</strong></p><div class="danger custom-block"><p class="custom-block-title">DANGER</p><p>Again, <strong>please do not modify the database at will!</strong></p></div><p>If you need to modify the data in the database, please <strong>stop</strong> the Dashboard container before modifying it.<br> The database type is sqlite3, located in <code>/opt/nezha/dashboard/data/sqlite.db</code>, please backup before modifying the data</p><h3 id="what-are-each-table-or-column-in-the-database" tabindex="-1">What are each table or column in the database? <a class="header-anchor" href="#what-are-each-table-or-column-in-the-database" aria-label="Permalink to &quot;What are each table or column in the database?&quot;"></a></h3><p>The documentation does not provide an explanation of the database. If you have the ability to modify the database, you should be able to read it with a little thinking.</p><h3 id="does-dashboard-update-automatically" tabindex="-1">Does Dashboard update automatically? <a class="header-anchor" href="#does-dashboard-update-automatically" aria-label="Permalink to &quot;Does Dashboard update automatically?&quot;"></a></h3><p>The Agent normally updates automatically, but the Dashboard does not and needs to be updated manually.</p><h3 id="how-do-i-update-the-dashboard" tabindex="-1">How do I update the Dashboard? <a class="header-anchor" href="#how-do-i-update-the-dashboard" aria-label="Permalink to &quot;How do I update the Dashboard?&quot;"></a></h3><p>Run the script <code>. /nezha.sh</code> and select restart Dashboard and update</p>`,41),l=[n];function r(i,p,c,d,h,u){return a(),t("div",null,l)}const m=e(s,[["render",r]]);export{y as __pageData,m as default};