Skip to content

Commit

Permalink
add: docker & nixos examples
Browse files Browse the repository at this point in the history
  • Loading branch information
paepckehh committed Oct 31, 2024
1 parent 61a0020 commit f7cc7d0
Show file tree
Hide file tree
Showing 5 changed files with 209 additions and 61 deletions.
48 changes: 45 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,64 @@
OPN_TARGETS="opn01.lan,opn02.lan" OPN_APIKEY="..." OPN_APISECRET="..." go run paepcke.de/opnborg/cmd/opnborg@main
```

# HOW TO INSTALL
# ⚡️HOW TO INSTALL

```
go install paepcke.de/opnborg/cmd/opnborg@main
```

# PRE-BUILD BINARIES (DOWNLOAD)
# ⚡️PRE-BUILD BINARIES (DOWNLOAD)
[https://github.com/paepckehh/opnborg/releases](https://github.com/paepckehh/opnborg/releases)

# EXAMPLE ENV CONFIG
# ⚡️EXAMPLE CONFIGURATION VIA ENV
```
please see:
- example.sh
- example-env-config.sh
```

# ⚡️DOCKER
```
docker pull ghcr.io/paepckehh/opnborg:latest
```

# ⚡️NIXOS SYSTEM SERVICE VIA DOCKER
see opnborg-docker.nix
see opnborg-docker-complex.nix
see opnborg-prometheus-grafana.nix

```
{config, ...}: {
####################
#-=# NETWORKING #=-#
####################
networking = {
firewall = {
allowedTCPPorts = [6464]; # open tcp port 6464
};
};
########################
#-=# VIRTUALISATION #=-#
########################
virtualisation = {
oci-containers = {
backend = "podman";
containers = {
opnborg = {
image = "ghcr.io/paepckehh/opnborg";
extraOptions = ["--network=host"];
environment = {
"OPN_TARGETS" = "opn01.lan,opn02.lan";
"OPN_APIKEY" = "+RIb6YWNdcDWMMM7W5ZYDkUvP4qx6e1r7e/Lg/Uh3aBH+veuWfKc7UvEELH/lajWtNxkOaOPjWR8uMcD";
"OPN_APISECRET" = "8VbjM3HKKqQW2ozOe5PTicMXOBVi9jZTSPCGfGrHp8rW6m+TeTxHyZyAI1GjERbuzjmz6jK/usMCWR/p";
};
};
};
};
};
}
```

# FEATURES

- Central Monitoring (version, status, online, offline, last seen, configuration compliance)
Expand Down
48 changes: 48 additions & 0 deletions opnborg-docker-complex.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{config, ...}: {
####################
#-=# NETWORKING #=-#
####################
networking = {
firewall = {
allowedTCPPorts = [6464]; # open tcp port 6464
};
};
########################
#-=# VIRTUALISATION #=-#
########################
virtualisation = {
oci-containers = {
backend = "podman";
containers = {
opnborg = {
image = "ghcr.io/paepckehh/opnborg";
extraOptions = ["--network=host"];
environment = {
"OPN_APIKEY" = "+RIb6YWNdcDWMMM7W5ZYDkUvP4qx6e1r7e/Lg/Uh3aBH+veuWfKc7UvEELH/lajWtNxkOaOPjWR8uMcD";
"OPN_APISECRET" = "8VbjM3HKKqQW2ozOe5PTicMXOBVi9jZTSPCGfGrHp8rW6m+TeTxHyZyAI1GjERbuzjmz6jK/usMCWR/p";
"OPN_TLSKEYPIN" = "8VbjM3HKKqQW2ozOe5PTicMXOBVi9jZTSPCGfGrHp8rW6m+TeTxHyZyAI1GjERbuzjmz6jK/usMCWR/p";
"OPN_MASTER" = "opn00.lan:8443";
"OPN_TARGETS_HOTSTANDBY" = "opn00.lan:8443";
"OPN_TARGETS_PRODUCTION" = "opn01.lan:8443,opn02.lan:8443";
"OPN_TARGETS_IMGURL_HOTSTANDBY" = "https://icon-library.com/images/freebsd-icon/freebsd-icon-16.jpg";
"OPN_TARGETS_IMGURL_PRODUCTION" = "https://icon-library.com/images/freebsd-icon/freebsd-icon-16.jpg";
"OPN_SLEEP" = "60";
"OPN_DEBUG" = "true";
"OPN_SYNC_PKG" = "true";
"OPN_HTTPD_ENABLE" = "true";
"OPN_HTTPD_SERVER" = "127.0.0.1:6464";
"OPN_HTTPD_COLOR_FG" = "white";
"OPN_HTTPD_COLOR_BG" = "grey";
"OPN_RSYSLOG_ENABLE" = "true";
"OPN_RSYSLOG_SERVER" = "192.168.122.1:5140";
"OPN_GRAFANA_WEBUI" = "http://localhost:9090";
"OPN_GRAFANA_DASHBOARD_FREEBSD" = "Kczn-jPZz/node-exporter-freebsd";
"OPN_GRAFANA_DASHBOARD_HAPROXY" = "rEqu1u5ue/haproxy-2-full";
"OPN_WAZUH_WEBUI" = "http://localhost:9292";
"OPN_PROMETHEUS_WEBUI" = "http://localhost:9191";
};
};
};
};
};
}
29 changes: 29 additions & 0 deletions opnborg-docker.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{config, ...}: {
####################
#-=# NETWORKING #=-#
####################
networking = {
firewall = {
allowedTCPPorts = [6464]; # open tcp port 6464
};
};
########################
#-=# VIRTUALISATION #=-#
########################
virtualisation = {
oci-containers = {
backend = "podman";
containers = {
opnborg = {
image = "ghcr.io/paepckehh/opnborg";
extraOptions = ["--network=host"];
environment = {
"OPN_TARGETS" = "opn01.lan,opn02.lan";
"OPN_APIKEY" = "+RIb6YWNdcDWMMM7W5ZYDkUvP4qx6e1r7e/Lg/Uh3aBH+veuWfKc7UvEELH/lajWtNxkOaOPjWR8uMcD";
"OPN_APISECRET" = "8VbjM3HKKqQW2ozOe5PTicMXOBVi9jZTSPCGfGrHp8rW6m+TeTxHyZyAI1GjERbuzjmz6jK/usMCWR/p";
};
};
};
};
};
}
58 changes: 0 additions & 58 deletions opnborg-prometheus-grafana-wazuh.nix

This file was deleted.

87 changes: 87 additions & 0 deletions opnborg-prometheus-grafana.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
{config, ...}: {
# example nixos config for opn01.lan & opn02.lan including prometheus & grafana
# WebUI http://localhost:6464
####################
#-=# NETWORKING #=-#
####################
networking = {
firewall = {
allowedTCPPorts = [6464]; # open tcp port 6464
};
};
########################
#-=# VIRTUALISATION #=-#
########################
virtualisation = {
oci-containers = {
backend = "podman";
containers = {
opnborg = {
image = "ghcr.io/paepckehh/opnborg";
extraOptions = ["--network=host"];
environment = {
"OPN_TARGETS" = "opn01.lan,opn02.lan";
"OPN_APIKEY" = "+RIb6YWNdcDWMMM7W5ZYDkUvP4qx6e1r7e/Lg/Uh3aBH+veuWfKc7UvEELH/lajWtNxkOaOPjWR8uMcD";
"OPN_APISECRET" = "8VbjM3HKKqQW2ozOe5PTicMXOBVi9jZTSPCGfGrHp8rW6m+TeTxHyZyAI1GjERbuzjmz6jK/usMCWR/p";
};
};
};
};
};
##################
#-=# SERVICES #=-#
##################
services = {
prometheus = {
enable = true;
alertmanager.port = 9292;
port = 9191;
retentionTime = "365d";
scrapeConfigs = [
{
job_name = "node";
static_configs = [
{
targets = [
"127.0.0.1:${toString config.services.prometheus.exporters.node.port}" # self
"opn01.lan:9100" # example opnsense node IP
"opn02.lan:9100" # example opnsense node IP
];
}
];
}
{
job_name = "haproxy";
static_configs = [
{
targets = [
"opn01.lan:8404" # example opnsense node IP
"opn02.lan:8404" # example opnsense node IP
];
}
];
}
];
exporters.node = {
enable = true;
port = 9100;
enabledCollectors = [
"logind"
"systemd"
];
disabledCollectors = [];
openFirewall = true;
};
};
grafana = {
enable = true;
settings = {
server = {
http_addr = "127.0.0.1";
http_port = 9090;
domain = "localhost";
};
};
};
};
}

0 comments on commit f7cc7d0

Please sign in to comment.