diff --git a/docs/docs/production.mdx b/docs/docs/production.mdx index b2cb936..1cb1a31 100644 --- a/docs/docs/production.mdx +++ b/docs/docs/production.mdx @@ -33,6 +33,53 @@ However, at build time, there are some fairly memory-intensive tasks which _will At **build**, hyperglass consumes approximately **196 MB** of storage. 194 MB of this is front-end dependencies, which are downloaded and installed when running a UI build. The other 2 MB is the hyperglass code itself. Once again, the minimum system requirements for most Linux distributions should be sufficient. +## systemd + +More than likely, you'll want to run hyperglass as a background system service. [systemd](https://systemd.io/) is one of the most common ways of running services on Linux. To run hyperglass as a systemd service, create a file named `hyperglass.service` in your [installation directory](setup.mdx#installation-directory) and add following to it: + +```ini +[Unit] +Description=hyperglass +After=network.target +Requires=redis-server +# Replace the above with Requires=redis for CentOS + +[Service] +User= +Group= +ExecStart= start + +[Install] +WantedBy=multi-user.target +``` + +Replace `` with whichever user you're running hyperglass as. For example, if you're running hyperglass as a non-root user, you probably used `pip3 install hyperglass` (without `sudo`) to install hyperglass, and you're probably using `~/hyperglass` as your installation directory. However, if you're running hyperglass as root, you probably used `sudo pip3 install hyperglass` to install hyperglass, and you're probably using `/etc/hyperglass` as your installation directory. + +Systemd requires an absolute path for executables. This means you can't just put `hyperglass start` in the `ExecStart` field, it needs to be the full path. The easiest way to get this is to run `which hyperglass`, which will output the full path. It should look something like `/home/username/.local/bin/hyperglass` or `/usr/local/bin/hyperglass`. + +After adding the file, run the following: + +```bash +# Replace with the path to the systemd file you just created. +sudo ln -s /etc/systemd/system/hyperglass.service + +# Tell systemd to re-look at its service files, since you just added one. +sudo systemctl daemon-reload + +# Tell systemd to run hyperglass on system startup. +sudo systemctl enable hyperglass + +# Start the hyperglass service. +sudo systemctl start hyperglass + +# Check the status of the hyperglass service. +sudo systemctl status hyperglass +``` + +:::important Checking the status +The first time hyperglass starts up, it will run through a UI build process, which will take a little time. You may have to wait a couple of minutes in between each check on hyperglass's status. +::: + ## Reverse Proxy You'll want to run hyperglass behind a reverse proxy in production to serve the static files more efficiently and offload SSL. Any reverse proxy should work, but hyperglass has been specifically tested with [Caddy](https://caddyserver.com/) and [NGINX](https://www.nginx.com/). Sample configs for both can be found below. diff --git a/docs/docs/setup.mdx b/docs/docs/setup.mdx index c38a285..7a89465 100644 --- a/docs/docs/setup.mdx +++ b/docs/docs/setup.mdx @@ -44,18 +44,6 @@ You'll receive the following prompts: hyperglass requires a directory on your system to store configuration files, the web UI, logos, etc. You may choose between the current user's home directory or `/etc`. -### Systemd Service - -```shell-session -Do you want to generate a systemd service file? [y/N]: -``` - -hyperglass also includes a [systemd](https://systemd.io/) service file, which can be installed if you use systemd. If selected, a systemd service file will be generated and copied to the installation directory. Then, it will be symlinked to `/etc/systemd/system`. All you need to do to enable the service is run: - -```shell-session -$ sudo systemctl enable hyperglass -``` - ## UI Build After running the setup, the `build-ui` command needs to be run for the first time. This command creates the required file structure for the UI, initializes frontend dependencies, and generates favicons. @@ -80,3 +68,7 @@ hyperglass won't start without a `devices.yaml` file. See the [Adding Devices](a ```shell-session $ hyperglass start ``` + +:::tip Production +Remember to check the [Production](production.mdx) section for instructions on how to run hyperglass in production. It includes instructions and examples for setting up a Reverse Proxy (such as NGINX or Caddy), and running hyperglass as a system service with systemd. +::: diff --git a/docs/docs/ui/configuration.mdx b/docs/docs/ui/configuration.mdx index 3356483..bd90e40 100644 --- a/docs/docs/ui/configuration.mdx +++ b/docs/docs/ui/configuration.mdx @@ -45,6 +45,7 @@ The `web` subsection contains multiple subsections of its own, should you wish t | `greeting` | Greeting Modal | ➡️ | | `logo` | Logo & Favicons | ➡️ | | `opengraph` | [OpenGraph](https://ogp.me/) | ➡️ | +| `help_menu` | Help Menu | ➡️ | | `terms` | Terms & Conditions | ➡️ | | `text` | Text, title, & names | ➡️ | | `theme` | Colors & Fonts | ➡️ | diff --git a/docs/src/theme/CodeBlock/index.js b/docs/src/theme/CodeBlock/index.js index d02cdd9..5fa8764 100644 --- a/docs/src/theme/CodeBlock/index.js +++ b/docs/src/theme/CodeBlock/index.js @@ -22,7 +22,7 @@ import styles from "./styles.module.css"; const highlightLinesRangeRegex = /{([\d,-]+)}/; const getHighlightDirectiveRegex = ( - languages = ["js", "jsBlock", "jsx", "python", "html"] + languages = ["js", "jsBlock", "jsx", "python", "html", "ini"] ) => { // supported types of comments const comments = { @@ -46,6 +46,7 @@ const getHighlightDirectiveRegex = ( start: "", }, + ini: { start: "#", end: "" }, }; // supported directives const directives = [ @@ -82,6 +83,8 @@ const highlightDirectiveRegex = (lang) => { case "python": case "py": return getHighlightDirectiveRegex(["python"]); + case "ini": + return getHighlightDirectiveRegex(["ini"]); default: // all comment types @@ -94,6 +97,7 @@ export default ({ children, className: languageClassName, metastring }) => { (typeof global !== "undefined" ? global : window).Prism = Prism; require("prismjs/components/prism-shell-session"); require("prismjs/components/prism-nginx"); + require("prismjs/components/prism-ini"); const { siteConfig: { themeConfig: { prism = {} },