Skip to content

Commit c9b87ea

Browse files
committed
add docs for new systemd change
1 parent 440c5bf commit c9b87ea

4 files changed

Lines changed: 57 additions & 13 deletions

File tree

docs/docs/production.mdx

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,53 @@ However, at build time, there are some fairly memory-intensive tasks which _will
3333

3434
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.
3535

36+
## systemd
37+
38+
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:
39+
40+
```ini
41+
[Unit]
42+
Description=hyperglass
43+
After=network.target
44+
Requires=redis-server
45+
# Replace the above with Requires=redis for CentOS
46+
47+
[Service]
48+
User=<user or root>
49+
Group=<user or root>
50+
ExecStart=<path to hyperglass> start
51+
52+
[Install]
53+
WantedBy=multi-user.target
54+
```
55+
56+
Replace `<user or root>` 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.
57+
58+
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`.
59+
60+
After adding the file, run the following:
61+
62+
```bash
63+
# Replace <systemd file> with the path to the systemd file you just created.
64+
sudo ln -s <systemd file> /etc/systemd/system/hyperglass.service
65+
66+
# Tell systemd to re-look at its service files, since you just added one.
67+
sudo systemctl daemon-reload
68+
69+
# Tell systemd to run hyperglass on system startup.
70+
sudo systemctl enable hyperglass
71+
72+
# Start the hyperglass service.
73+
sudo systemctl start hyperglass
74+
75+
# Check the status of the hyperglass service.
76+
sudo systemctl status hyperglass
77+
```
78+
79+
:::important Checking the status
80+
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.
81+
:::
82+
3683
## Reverse Proxy
3784

3885
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.

docs/docs/setup.mdx

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,6 @@ You'll receive the following prompts:
4444

4545
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`.
4646

47-
### Systemd Service
48-
49-
```shell-session
50-
Do you want to generate a systemd service file? [y/N]:
51-
```
52-
53-
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:
54-
55-
```shell-session
56-
$ sudo systemctl enable hyperglass
57-
```
58-
5947
## UI Build
6048

6149
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
8068
```shell-session
8169
$ hyperglass start
8270
```
71+
72+
:::tip Production
73+
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.
74+
:::

docs/docs/ui/configuration.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ The `web` subsection contains multiple subsections of its own, should you wish t
4545
| `greeting` | Greeting Modal | <PageLink to="#greeting">➡️</PageLink> |
4646
| `logo` | Logo & Favicons | <PageLink to="logo">➡️</PageLink> |
4747
| `opengraph` | [OpenGraph](https://ogp.me/) | <PageLink to="#opengraph">➡️</PageLink> |
48+
| `help_menu` | Help Menu | <PageLink to="#help_menu">➡️</PageLink> |
4849
| `terms` | Terms & Conditions | <PageLink to="#terms">➡️</PageLink> |
4950
| `text` | Text, title, & names | <PageLink to="text">➡️</PageLink> |
5051
| `theme` | Colors & Fonts | <PageLink to="theme">➡️</PageLink> |

docs/src/theme/CodeBlock/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import styles from "./styles.module.css";
2222

2323
const highlightLinesRangeRegex = /{([\d,-]+)}/;
2424
const getHighlightDirectiveRegex = (
25-
languages = ["js", "jsBlock", "jsx", "python", "html"]
25+
languages = ["js", "jsBlock", "jsx", "python", "html", "ini"]
2626
) => {
2727
// supported types of comments
2828
const comments = {
@@ -46,6 +46,7 @@ const getHighlightDirectiveRegex = (
4646
start: "<!--",
4747
end: "-->",
4848
},
49+
ini: { start: "#", end: "" },
4950
};
5051
// supported directives
5152
const directives = [
@@ -82,6 +83,8 @@ const highlightDirectiveRegex = (lang) => {
8283
case "python":
8384
case "py":
8485
return getHighlightDirectiveRegex(["python"]);
86+
case "ini":
87+
return getHighlightDirectiveRegex(["ini"]);
8588

8689
default:
8790
// all comment types
@@ -94,6 +97,7 @@ export default ({ children, className: languageClassName, metastring }) => {
9497
(typeof global !== "undefined" ? global : window).Prism = Prism;
9598
require("prismjs/components/prism-shell-session");
9699
require("prismjs/components/prism-nginx");
100+
require("prismjs/components/prism-ini");
97101
const {
98102
siteConfig: {
99103
themeConfig: { prism = {} },

0 commit comments

Comments
 (0)