nezhahq.github.io/assets/en_US_guide_dashboard.md.a9345138.js
2023-02-02 16:14:59 +00:00

26 lines
14 KiB
JavaScript

import{_ as e,c as a,o as t,a as o}from"./app.3817bf4e.js";const m='{"title":"Preparations","description":"","frontmatter":{},"headers":[{"level":2,"title":"Preparations","slug":"preparations"},{"level":2,"title":"Get the Client ID and Client Secret on Github/Gitlab","slug":"get-the-client-id-and-client-secret-on-github-gitlab"},{"level":2,"title":"Installing Dashboard on the server","slug":"installing-dashboard-on-the-server"},{"level":2,"title":"Configure reverse proxy","slug":"configure-reverse-proxy"},{"level":2,"title":"Configuring SSL in the aaPanel","slug":"configuring-ssl-in-the-aapanel"},{"level":2,"title":"FAQ","slug":"faq"},{"level":3,"title":"What should I do if /terminal or /ws cannot be connected after HTTPS is enabled?","slug":"what-should-i-do-if-terminal-or-ws-cannot-be-connected-after-https-is-enabled"},{"level":3,"title":"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?","slug":"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"},{"level":3,"title":"What are each table or column in the database?","slug":"what-are-each-table-or-column-in-the-database"},{"level":3,"title":"Does Dashboard update automatically?","slug":"does-dashboard-update-automatically"},{"level":3,"title":"How do I update the Dashboard?","slug":"how-do-i-update-the-dashboard"}],"relativePath":"en_US/guide/dashboard.md","lastUpdated":1675354460000}',n={},s=o(`<h2 id="preparations" tabindex="-1">Preparations <a class="header-anchor" href="#preparations" aria-hidden="true">#</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;<a href="http://cdn.example.com" target="_blank" rel="noopener noreferrer">cdn.example.com</a>&quot; and &quot;<a href="http://data.example.com" target="_blank" rel="noopener noreferrer">data.example.com</a>&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-hidden="true">#</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="noopener 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="noopener 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="noopener 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="noopener 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-hidden="true">#</a></h2><ul><li>In the panel server, run the installation script:</li></ul><div class="language-bash"><pre><code><span class="token function">curl</span> -L https://raw.githubusercontent.com/naiba/nezha/master/script/install_en.sh -o nezha.sh <span class="token operator">&amp;&amp;</span> <span class="token function">chmod</span> +x nezha.sh <span class="token operator">&amp;&amp;</span> <span class="token function">sudo</span> ./nezha.sh
</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="noopener 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"><pre><code>./nezha.sh
</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-hidden="true">#</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="noopener 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"><pre><code><span class="token comment">#PROXY-START/</span>
<span class="token directive"><span class="token keyword">location</span> /</span> <span class="token punctuation">{</span>
<span class="token directive"><span class="token keyword">proxy_pass</span> http://127.0.0.1:8008</span><span class="token punctuation">;</span>
<span class="token directive"><span class="token keyword">proxy_set_header</span> Host <span class="token variable">$http_host</span></span><span class="token punctuation">;</span>
<span class="token directive"><span class="token keyword">proxy_set_header</span> Upgrade <span class="token variable">$http_upgrade</span></span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
<span class="token directive"><span class="token keyword">location</span> ~ ^/(ws|terminal/.+)$</span> <span class="token punctuation">{</span>
<span class="token directive"><span class="token keyword">proxy_pass</span> http://127.0.0.1:8008</span><span class="token punctuation">;</span>
<span class="token directive"><span class="token keyword">proxy_http_version</span> 1.1</span><span class="token punctuation">;</span>
<span class="token directive"><span class="token keyword">proxy_set_header</span> Upgrade <span class="token variable">$http_upgrade</span></span><span class="token punctuation">;</span>
<span class="token directive"><span class="token keyword">proxy_set_header</span> Connection <span class="token string">&quot;Upgrade&quot;</span></span><span class="token punctuation">;</span>
<span class="token directive"><span class="token keyword">proxy_set_header</span> Host <span class="token variable">$http_host</span></span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
<span class="token comment">#PROXY-END/</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="noopener noreferrer">http://cdn.example.com</a>&quot;<br><br></li></ul><h4 id="other" tabindex="-1">Other: <a class="header-anchor" href="#other" aria-hidden="true">#</a></h4><ul><li><p>CaddyServer v1\uFF08v2 no special configuration required\uFF09</p><div class="language-"><pre><code>proxy /ws http://ip:8008 {
websocket
header_upstream -Origin
}
proxy /terminal/* http://ip:8008 {
websocket
header_upstream -Origin
}
</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-hidden="true">#</a></h2><p>First, temporarily disable the reverse proxy<br> As with other websites, you can choose to automatically apply for a Let\xB4s 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="noopener 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="noopener noreferrer">https://cdn.example.com</a>&quot; and &quot;<a href="https://cdn.example.com/oauth2/callback" target="_blank" rel="noopener 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-hidden="true">#</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-hidden="true">#</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-hidden="true">#</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">WARNING</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-hidden="true">#</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-hidden="true">#</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-hidden="true">#</a></h3><p>Run the script <code>. /nezha.sh</code> and select restart Dashboard and update</p>`,41),i=[s];function r(l,d,c,p,h,u){return t(),a("div",null,i)}var f=e(n,[["render",r]]);export{m as __pageData,f as default};