### Download Hub Install Script Source: https://github.com/henrygd/beszel/blob/main/supplemental/guides/systemd.md Downloads the installation script for the Beszel hub. This script automates the setup process. ```bash curl -sL https://raw.githubusercontent.com/henrygd/beszel/main/supplemental/scripts/install-hub.sh -o install-hub.sh && chmod +x install-hub.sh ``` -------------------------------- ### Download Agent Install Script Source: https://github.com/henrygd/beszel/blob/main/supplemental/guides/systemd.md Downloads the installation script for the Beszel agent. This script automates the setup process. ```bash curl -sL https://raw.githubusercontent.com/henrygd/beszel/main/supplemental/scripts/install-agent.sh -o install-agent.sh && chmod +x install-agent.sh ``` -------------------------------- ### Install Beszel Hub Service Source: https://github.com/henrygd/beszel/blob/main/supplemental/guides/systemd.md Installs the Beszel hub as a systemd service using the downloaded script. Optionally specify a port with the -p flag. ```bash ./install-hub.sh ``` -------------------------------- ### Install Beszel Agent Service Source: https://github.com/henrygd/beszel/blob/main/supplemental/guides/systemd.md Installs the Beszel agent as a systemd service using the downloaded script. Optionally include SSH key and port as arguments. ```bash ./install-agent.sh ``` -------------------------------- ### Start and Enable Systemd Services Source: https://github.com/henrygd/beszel/blob/main/supplemental/guides/systemd.md Reloads the systemd daemon and enables/starts the specified Beszel service to ensure it runs on boot. ```bash sudo systemctl daemon-reload sudo systemctl enable beszel.service sudo systemctl start beszel.service ``` -------------------------------- ### Start and Enable Beszel Agent Service Source: https://github.com/henrygd/beszel/blob/main/supplemental/guides/systemd.md Reloads the systemd daemon and enables/starts the Beszel agent service to ensure it runs on boot. ```bash sudo systemctl daemon-reload sudo systemctl enable beszel-agent.service sudo systemctl start beszel-agent.service ``` -------------------------------- ### Get Application URL with NodePort Service Source: https://github.com/henrygd/beszel/blob/main/supplemental/kubernetes/beszel-hub/charts/templates/NOTES.txt This snippet retrieves the NodePort and Node IP to construct the application URL when the service type is NodePort. It requires kubectl to be installed and configured. ```bash {{- else if contains "NodePort" .Values.service.type }} export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "beszel.fullname" . }}-web) export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") echo http://$NODE_IP:$NODE_PORT {{- end }} ``` -------------------------------- ### Uninstall Beszel Hub Service Source: https://github.com/henrygd/beszel/blob/main/supplemental/guides/systemd.md Uninstalls the Beszel hub service using the install script with the -u flag. ```bash ./install-hub.sh -u ``` -------------------------------- ### Get Application URL with Ingress Source: https://github.com/henrygd/beszel/blob/main/supplemental/kubernetes/beszel-hub/charts/templates/NOTES.txt This snippet generates the application URL when Ingress is enabled. It iterates through configured hosts and paths. ```go-template {{- if .Values.ingress.enabled }} {{- range $host := .Values.ingress.hosts }} {{- range .paths }} http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} {{- end }} {{- end }} {{- end }} ``` -------------------------------- ### Uninstall Beszel Agent Service Source: https://github.com/henrygd/beszel/blob/main/supplemental/guides/systemd.md Uninstalls the Beszel agent service using the install script with the -u flag. ```bash ./install-agent.sh -u ``` -------------------------------- ### Get Application URL with LoadBalancer Service Source: https://github.com/henrygd/beszel/blob/main/supplemental/kubernetes/beszel-hub/charts/templates/NOTES.txt This snippet retrieves the LoadBalancer IP to construct the application URL when the service type is LoadBalancer. It notes that the IP may take time to become available and provides a command to watch service status. ```bash {{- else if contains "LoadBalancer" .Values.service.type }} NOTE: It may take a few minutes for the LoadBalancer IP to be available. You can watch its status by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "beszel.fullname" . }}' export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "beszel.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}) echo http://$SERVICE_IP:{{ .Values.service.port }} {{- end }} ``` -------------------------------- ### Implement Dark Mode Theming Source: https://github.com/henrygd/beszel/blob/main/internal/site/index.html This script attempts to load a UI theme from local storage. If no theme is set or it's not 'light', it checks the user's preferred color scheme. It then applies the 'dark' or 'light' class to the document element accordingly. This is useful for creating a persistent dark mode for your website. ```javascript (function() { try { var theme = localStorage.getItem('ui-theme'); var isDark = theme === 'dark' || (theme !== 'light' && window.matchMedia('(prefers-color-scheme: dark)').matches); document.documentElement.classList.add(isDark ? 'dark' : 'light'); } catch (e) {} })(); ``` -------------------------------- ### Access Application with ClusterIP Service via Port-Forward Source: https://github.com/henrygd/beszel/blob/main/supplemental/kubernetes/beszel-hub/charts/templates/NOTES.txt This snippet sets up port-forwarding for a ClusterIP service to access the application locally. It retrieves the pod name and container port, then forwards traffic from local port 8090 to the container's port. ```bash {{- else if contains "ClusterIP" .Values.service.type }} export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "beszel.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") echo "Visit http://127.0.0.1:8090 to use your application" kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8090:$CONTAINER_PORT {{- end }} ``` -------------------------------- ### Manual Hub Systemd Service Configuration Source: https://github.com/henrygd/beszel/blob/main/supplemental/guides/systemd.md Defines the systemd service unit file for the Beszel hub. Ensure to replace placeholder values. ```bash [Unit] Description=Beszel Hub Service After=network.target [Service] # update the values in the curly braces below (remove the braces) ExecStart={/path/to/working/directory}/beszel serve WorkingDirectory={/path/to/working/directory} User={YOUR_USERNAME} Restart=always [Install] WantedBy=multi-user.target ``` -------------------------------- ### Manual Agent Systemd Service Configuration Source: https://github.com/henrygd/beszel/blob/main/supplemental/guides/systemd.md Defines the systemd service unit file for the Beszel agent. Ensure to replace placeholder values for port, key, and username. ```bash [Unit] Description=Beszel Agent Service After=network.target [Service] # update the values in curly braces below (remove the braces) Environment="PORT={PASTE_YOUR_PORT_HERE}" Environment="KEY={PASTE_YOUR_KEY_HERE}" # Environment="EXTRA_FILESYSTEMS={sdb}" ExecStart={/path/to/directory}/beszel-agent User={YOUR_USERNAME} Restart=always [Install] WantedBy=multi-user.target ``` -------------------------------- ### Update Beszel Hub Service Source: https://github.com/henrygd/beszel/blob/main/supplemental/guides/systemd.md Updates the Beszel hub to the latest release and restarts the systemd service. ```bash sudo /opt/beszel/beszel update && sudo systemctl restart beszel-hub ``` -------------------------------- ### Update Beszel Agent Service Source: https://github.com/henrygd/beszel/blob/main/supplemental/guides/systemd.md Updates the Beszel agent to the latest release and restarts the systemd service. ```bash sudo /opt/beszel-agent/beszel-agent update && sudo systemctl restart beszel-agent ``` -------------------------------- ### Define Global BESZEL Object Source: https://github.com/henrygd/beszel/blob/main/internal/site/index.html This snippet defines a global `BESZEL` object with an 'info' property. This is typically used to expose project-specific information or functions globally within the application. ```javascript globalThis.BESZEL = "{info}" ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.