mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-04-24 08:58:26 +02:00
Merge pull request #149 from ryan4yin/fix-nodejs-based-apps
fix: fix nodejs-based apps
This commit is contained in:
@@ -2,36 +2,12 @@
|
|||||||
|
|
||||||
LUKS encrypted SSD for NixOS, on Orange Pi 5 Plus.
|
LUKS encrypted SSD for NixOS, on Orange Pi 5 Plus.
|
||||||
|
|
||||||
Storage, operation and maintenance related services are running on this host:
|
TODO
|
||||||
|
|
||||||
1. Storage such as git server, file server/browser, torrent downloader,, etc.
|
|
||||||
1. Backup or sync my personal data to cloud or NAS.
|
|
||||||
- For safety, those data should be encrypted before sending to the cloud or my NAS.
|
|
||||||
1. Collect and monitor the metrics/logs of my homelab.
|
|
||||||
|
|
||||||
## Showcases
|
## Showcases
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## Features
|
|
||||||
|
|
||||||
Services:
|
|
||||||
|
|
||||||
1. prometheus + alertmanager + grafana + loki: Monitor the metrics/logs of my homelab.
|
|
||||||
1. restic: Backup my personal data to cloud or NAS.
|
|
||||||
1. synthing: Sync file between android/macbook/PC and NAS.
|
|
||||||
1. gitea: Self-hosted git service.
|
|
||||||
1. sftpgo: SFTP server.
|
|
||||||
1. transmission & AriaNg: Torrent downloader and HTTP downloader
|
|
||||||
1. alist/filebrower: File browser for local/SMB/Cloud
|
|
||||||
|
|
||||||
All the services assumes a reverse proxy to be setup in the front, they are all listening on
|
|
||||||
localhost, and a caddy service is listening on the local network interface and proxy the requests to
|
|
||||||
the services.
|
|
||||||
|
|
||||||
TODO: create a private PKI for caddy, to achieve end-to-end encryption between caddy and the
|
|
||||||
services.
|
|
||||||
|
|
||||||
## Misc
|
## Misc
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
{
|
|
||||||
# Replace dashy with gethomepage, because dashy is too slow to start/reload.
|
|
||||||
|
|
||||||
# # Install the dashy configuration file instead of symlink it
|
|
||||||
# system.activationScripts.installDashyConfig = ''
|
|
||||||
# install -Dm 600 ${./dashy_conf.yml} /etc/dashy/dashy_conf.yml
|
|
||||||
# '';
|
|
||||||
#
|
|
||||||
# # https://github.com/NixOS/nixpkgs/blob/nixos-24.05/nixos/modules/virtualisation/oci-containers.nix
|
|
||||||
# virtualisation.oci-containers.containers = {
|
|
||||||
# # check its logs via `journalctl -u podman-dashy`
|
|
||||||
# dashy = {
|
|
||||||
# hostname = "dashy";
|
|
||||||
# image = "lissy93/dashy:latest";
|
|
||||||
# ports = ["127.0.0.1:4000:80"];
|
|
||||||
# environment = {
|
|
||||||
# "NODE_ENV" = "production";
|
|
||||||
# };
|
|
||||||
# volumes = [
|
|
||||||
# "/etc/dashy/dashy_conf.yml:/app/public/conf.yml"
|
|
||||||
# ];
|
|
||||||
# autoStart = true;
|
|
||||||
# # cmd = [];
|
|
||||||
# };
|
|
||||||
# };
|
|
||||||
}
|
|
||||||
@@ -1,3 +1,24 @@
|
|||||||
# Idols - Aquamarine
|
# Idols - Aquamarine
|
||||||
|
|
||||||
TODO
|
Storage, operation and maintenance related services are running on this host:
|
||||||
|
|
||||||
|
1. Storage such as git server, file server/browser, torrent downloader,, etc.
|
||||||
|
1. Backup or sync my personal data to cloud or NAS.
|
||||||
|
- For safety, those data should be encrypted before sending to the cloud or my NAS.
|
||||||
|
1. Collect and monitor the metrics/logs of my homelab.
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
Services:
|
||||||
|
|
||||||
|
1. prometheus + alertmanager + grafana + loki: Monitor the metrics/logs of my homelab.
|
||||||
|
1. restic: Backup my personal data to cloud or NAS.
|
||||||
|
1. synthing: Sync file between android/macbook/PC and NAS.
|
||||||
|
1. gitea: Self-hosted git service.
|
||||||
|
1. sftpgo: SFTP server.
|
||||||
|
1. transmission & AriaNg: Torrent downloader and HTTP downloader
|
||||||
|
1. alist/filebrower: File browser for local/SMB/Cloud
|
||||||
|
|
||||||
|
All the services assumes a reverse proxy to be setup in the front, they are all listening on
|
||||||
|
localhost, and a caddy service is listening on the local network interface and proxy the requests to
|
||||||
|
the services.
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ in {
|
|||||||
# Dashboard
|
# Dashboard
|
||||||
virtualHosts."home.writefor.fun".extraConfig = ''
|
virtualHosts."home.writefor.fun".extraConfig = ''
|
||||||
${hostCommonConfig}
|
${hostCommonConfig}
|
||||||
reverse_proxy http://localhost:4401
|
reverse_proxy http://localhost:54401
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# https://caddyserver.com/docs/caddyfile/directives/file_server
|
# https://caddyserver.com/docs/caddyfile/directives/file_server
|
||||||
@@ -64,7 +64,7 @@ in {
|
|||||||
# Monitoring
|
# Monitoring
|
||||||
virtualHosts."uptime-kuma.writefor.fun".extraConfig = ''
|
virtualHosts."uptime-kuma.writefor.fun".extraConfig = ''
|
||||||
encode zstd gzip
|
encode zstd gzip
|
||||||
reverse_proxy http://localhost:3350
|
reverse_proxy http://localhost:53350
|
||||||
'';
|
'';
|
||||||
virtualHosts."grafana.writefor.fun".extraConfig = ''
|
virtualHosts."grafana.writefor.fun".extraConfig = ''
|
||||||
encode zstd gzip
|
encode zstd gzip
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
# Homepage for my Homelab
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
{
|
|
||||||
lib,
|
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
configDir = "/data/apps/homepage-dashboard";
|
|
||||||
in {
|
|
||||||
# https://github.com/NixOS/nixpkgs/blob/nixos-unstable/nixos/modules/services/misc/homepage-dashboard.nix
|
|
||||||
services.homepage-dashboard = {
|
|
||||||
enable = true;
|
|
||||||
listenPort = 4401;
|
|
||||||
openFirewall = false;
|
|
||||||
};
|
|
||||||
systemd.services.homepage-dashboard.environment = {
|
|
||||||
HOMEPAGE_CONFIG_DIR = lib.mkForce configDir;
|
|
||||||
|
|
||||||
# 1. The value of env var HOMEPAGE_VAR_XXX will replace {{HOMEPAGE_VAR_XXX}} in any config
|
|
||||||
# HOMEPAGE_VAR_XXX_APIKEY = "myapikey";
|
|
||||||
# 2. The value of env var HOMEPAGE_FILE_XXX must be a file path,
|
|
||||||
# the contents of which will be used to replace {{HOMEPAGE_FILE_XXX}} in any config
|
|
||||||
};
|
|
||||||
# Install the homepage-dashboard configuration files
|
|
||||||
system.activationScripts.installHomepageDashboardConfig = ''
|
|
||||||
mkdir -p ${configDir}
|
|
||||||
${pkgs.rsync}/bin/rsync -avz --chmod=D2755,F600 ${./config}/ ${configDir}/
|
|
||||||
|
|
||||||
${pkgs.systemdMinimal}/bin/systemctl restart homepage-dashboard
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
@@ -6,18 +6,18 @@
|
|||||||
- KubeVirt-Shoryu:
|
- KubeVirt-Shoryu:
|
||||||
icon: si-kubevirt
|
icon: si-kubevirt
|
||||||
description: "CPU: R7-5825U / MEM: 64G / DISK: 1T"
|
description: "CPU: R7-5825U / MEM: 64G / DISK: 1T"
|
||||||
href: http://grafana.writefor.fun/d/rYdddlPWk/node-exporter-full?orgId=1&var-node=192.168.5.181:9100
|
href: https://grafana.writefor.fun/d/rYdddlPWk/node-exporter-full?orgId=1&var-node=192.168.5.181:9100
|
||||||
siteMonitor: http://grafana.writefor.fun/d/rYdddlPWk/node-exporter-full?orgId=1&var-node=192.168.5.181:9100
|
siteMonitor: https://grafana.writefor.fun/d/rYdddlPWk/node-exporter-full?orgId=1&var-node=192.168.5.181:9100
|
||||||
- KubeVirt-Shushou:
|
- KubeVirt-Shushou:
|
||||||
icon: si-kubevirt
|
icon: si-kubevirt
|
||||||
description: "CPU: R9-5900HX / MEM: 64G / DISK: 1T"
|
description: "CPU: R9-5900HX / MEM: 64G / DISK: 1T"
|
||||||
href: http://grafana.writefor.fun/d/rYdddlPWk/node-exporter-full?orgId=1&var-node=192.168.5.182:9100
|
href: https://grafana.writefor.fun/d/rYdddlPWk/node-exporter-full?orgId=1&var-node=192.168.5.182:9100
|
||||||
siteMonitor: http://grafana.writefor.fun/d/rYdddlPWk/node-exporter-full?orgId=1&var-node=192.168.5.182:9100
|
siteMonitor: https://grafana.writefor.fun/d/rYdddlPWk/node-exporter-full?orgId=1&var-node=192.168.5.182:9100
|
||||||
- KubeVirt-Youko:
|
- KubeVirt-Youko:
|
||||||
icon: si-kubevirt
|
icon: si-kubevirt
|
||||||
description: "CPU: R5-5625U / MEM: 32G / DISK: 512G+4T*2"
|
description: "CPU: R5-5625U / MEM: 32G / DISK: 512G+4T*2"
|
||||||
href: http://grafana.writefor.fun/d/rYdddlPWk/node-exporter-full?orgId=1&var-node=192.168.5.183:9100
|
href: https://grafana.writefor.fun/d/rYdddlPWk/node-exporter-full?orgId=1&var-node=192.168.5.183:9100
|
||||||
siteMonitor: http://grafana.writefor.fun/d/rYdddlPWk/node-exporter-full?orgId=1&var-node=192.168.5.183:9100
|
siteMonitor: https://grafana.writefor.fun/d/rYdddlPWk/node-exporter-full?orgId=1&var-node=192.168.5.183:9100
|
||||||
- LongHorn-Storage:
|
- LongHorn-Storage:
|
||||||
icon: si-longhorn
|
icon: si-longhorn
|
||||||
href: http://longhorn.writefor.fun/
|
href: http://longhorn.writefor.fun/
|
||||||
@@ -31,26 +31,26 @@
|
|||||||
- Homelab Monitoring:
|
- Homelab Monitoring:
|
||||||
- Grafana:
|
- Grafana:
|
||||||
icon: si-grafana
|
icon: si-grafana
|
||||||
href: http://grafana.writefor.fun
|
href: https://grafana.writefor.fun
|
||||||
description: Data visualised on dashboards
|
description: Data visualised on dashboards
|
||||||
siteMonitor: http://grafana.writefor.fun
|
siteMonitor: https://grafana.writefor.fun
|
||||||
- Prometheus Dashboard:
|
- Prometheus Dashboard:
|
||||||
icon: si-prometheus
|
icon: si-prometheus
|
||||||
href: http://prometheus.writefor.fun
|
href: https://prometheus.writefor.fun
|
||||||
description: Monitoring - Prometheus
|
description: Monitoring - Prometheus
|
||||||
siteMonitor: http://prometheus.writefor.fun
|
siteMonitor: https://prometheus.writefor.fun
|
||||||
- Uptime Kuma:
|
- Uptime Kuma:
|
||||||
icon: si-uptimekuma
|
icon: si-uptimekuma
|
||||||
href: http://uptime-kuma.writefor.fun
|
href: https://uptime-kuma.writefor.fun
|
||||||
description: Uptime Checking
|
description: Uptime Checking
|
||||||
siteMonitor: http://uptime-kuma.writefor.fun
|
siteMonitor: https://uptime-kuma.writefor.fun
|
||||||
|
|
||||||
- Homelab Applications:
|
- Homelab Applications:
|
||||||
- SFTPGO:
|
- SFTPGO:
|
||||||
icon: sftpgo.png
|
icon: sftpgo.png
|
||||||
href: "http://sftpgo.writefor.fun/web/admin/folders"
|
href: "https://sftpgo.writefor.fun/web/admin/folders"
|
||||||
description: WebDAV & SFTP server
|
description: WebDAV & SFTP server
|
||||||
siteMonitor: http://sftpgo.writefor.fun/
|
siteMonitor: https://sftpgo.writefor.fun/
|
||||||
# - Kubernetes Monitoring:
|
# - Kubernetes Monitoring:
|
||||||
# # TODO: Update this
|
# # TODO: Update this
|
||||||
# - Emby:
|
# - Emby:
|
||||||
41
hosts/idols-aquamarine/oci-containers/homepage/default.nix
Normal file
41
hosts/idols-aquamarine/oci-containers/homepage/default.nix
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
user = "homepage";
|
||||||
|
configDir = "/data/apps/homepage-dashboard";
|
||||||
|
in {
|
||||||
|
users.groups.${user} = {};
|
||||||
|
users.users.${user} = {
|
||||||
|
group = user;
|
||||||
|
home = configDir;
|
||||||
|
isSystemUser = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Install the homepage-dashboard configuration files
|
||||||
|
system.activationScripts.installHomepageDashboardConfig = ''
|
||||||
|
mkdir -p ${configDir}
|
||||||
|
${pkgs.rsync}/bin/rsync -avz --chmod=D2755,F644 ${./config}/ ${configDir}/
|
||||||
|
chown -R ${user}:${user} ${configDir}
|
||||||
|
'';
|
||||||
|
|
||||||
|
# https://github.com/NixOS/nixpkgs/blob/nixos-24.05/nixos/modules/virtualisation/oci-containers.nix
|
||||||
|
virtualisation.oci-containers.containers = {
|
||||||
|
# check its logs via `journalctl -u podman-homepage`
|
||||||
|
homepage = {
|
||||||
|
hostname = "homepage";
|
||||||
|
image = "ghcr.io/gethomepage/homepage:latest";
|
||||||
|
ports = ["127.0.0.1:54401:3000"];
|
||||||
|
# https://github.com/louislam/uptime-kuma/wiki/Environment-Variables
|
||||||
|
environment = {
|
||||||
|
# "PUID" = config.users.users.${user}.uid;
|
||||||
|
# "PGID" = config.users.groups.${user}.gid;
|
||||||
|
};
|
||||||
|
volumes = [
|
||||||
|
"${configDir}:/app/config"
|
||||||
|
];
|
||||||
|
autoStart = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
{config, ...}: let
|
||||||
|
user = "kuma";
|
||||||
|
dataDir = "/data/apps/uptime-kuma";
|
||||||
|
in {
|
||||||
|
users.groups.${user} = {};
|
||||||
|
users.users.${user} = {
|
||||||
|
group = user;
|
||||||
|
home = dataDir;
|
||||||
|
isSystemUser = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Create Directories
|
||||||
|
systemd.tmpfiles.rules = [
|
||||||
|
"d ${dataDir} 0755 ${user} ${user}"
|
||||||
|
];
|
||||||
|
|
||||||
|
# https://github.com/NixOS/nixpkgs/blob/nixos-24.05/nixos/modules/virtualisation/oci-containers.nix
|
||||||
|
virtualisation.oci-containers.containers = {
|
||||||
|
# check its logs via `journalctl -u podman-homepage`
|
||||||
|
uptime-kuma = {
|
||||||
|
hostname = "uptime-kuma";
|
||||||
|
image = "louislam/uptime-kuma:1";
|
||||||
|
ports = ["127.0.0.1:53350:3001"];
|
||||||
|
# https://github.com/louislam/uptime-kuma/wiki/Environment-Variables
|
||||||
|
environment = {
|
||||||
|
# "PUID" = config.users.users.${user}.uid;
|
||||||
|
# "PGID" = config.users.groups.${user}.gid;
|
||||||
|
};
|
||||||
|
volumes = [
|
||||||
|
"${dataDir}:/app/data"
|
||||||
|
];
|
||||||
|
autoStart = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
{lib, ...}: {
|
|
||||||
# https://github.com/NixOS/nixpkgs/blob/nixos-24.05/nixos/modules/services/monitoring/uptime-kuma.nix
|
|
||||||
services.uptime-kuma = {
|
|
||||||
enable = true;
|
|
||||||
# https://github.com/louislam/uptime-kuma/wiki/Environment-Variables
|
|
||||||
settings = lib.mkForce {
|
|
||||||
"UPTIME_KUMA_HOST" = "127.0.0.1";
|
|
||||||
"UPTIME_KUMA_PORT" = "3350";
|
|
||||||
"DATA_DIR" = "/data/apps/uptime-kuma/";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user