From d2ab99fd7f73715b681833bba3cfb39f3145b980 Mon Sep 17 00:00:00 2001 From: Yan Lin Date: Tue, 10 Feb 2026 15:40:09 +0100 Subject: [PATCH] add mongodb to vps --- hosts/nixos/vps/containers.nix | 10 ++++++++++ hosts/nixos/vps/system.nix | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/hosts/nixos/vps/containers.nix b/hosts/nixos/vps/containers.nix index c554627..9d29999 100644 --- a/hosts/nixos/vps/containers.nix +++ b/hosts/nixos/vps/containers.nix @@ -22,5 +22,15 @@ in autoStart = true; }; + mongodb = { + image = "docker.io/mongo:7"; + volumes = [ "/var/lib/mongodb:/data/db" ]; + environment = { TZ = systemTZ; }; + environmentFiles = [ "/etc/mongodb-env" ]; + ports = [ "27017:27017" ]; + extraOptions = [ "--network=podman" ]; + autoStart = true; + }; + }; } diff --git a/hosts/nixos/vps/system.nix b/hosts/nixos/vps/system.nix index 5f64086..9264ef2 100644 --- a/hosts/nixos/vps/system.nix +++ b/hosts/nixos/vps/system.nix @@ -41,7 +41,7 @@ useDHCP = true; # VPS typically use DHCP firewall = { enable = true; - allowedTCPPorts = [ 22 80 443 ]; + allowedTCPPorts = [ 22 80 443 27017 ]; trustedInterfaces = [ "tailscale0" ]; }; };