From 0b304619386b08b2d23d3e96c731e2042218719b Mon Sep 17 00:00:00 2001 From: Sergei Poljanski Date: Tue, 17 Nov 2026 13:52:15 +0400 Subject: [PATCH] services: run datacenterbingo from its flake, beside the container asxpi/datacenterbingo now exports the app (bundlerEnv) and a module running it as a hardened systemd service. services runs it on :3002 next to the container on ops; no route yet. It reaches Postgres and Garage on ops over the private network: pg_hba lets the read-only bingo role in from 10.10.0.20 (this restarts Postgres once), and its secrets, copied from the container's environment, are in services' sops file. Renovate automerges its bumps like the other apps'. Assisted-by: Claude:opus-5-5 --- nixos/flake.lock | 47 +++++++++++++++++++++++++--- nixos/flake.nix | 5 +++ nixos/hosts/asxpio-ops/postgres.nix | 1 + nixos/hosts/asxpio-services/apps.nix | 17 +++++++++- nixos/secrets/asxpio-services.yaml | 6 ++-- renovate.json | 3 +- 6 files changed, 70 insertions(+), 9 deletions(-) diff --git a/nixos/flake.lock b/nixos/flake.lock index e1fc46a..a5cab26 100644 --- a/nixos/flake.lock +++ b/nixos/flake.lock @@ -88,6 +88,26 @@ "url": "https://git.asxp.io/czsk/czsk" } }, + "datacenterbingo": { + "inputs": { + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1794908299, + "narHash": "sha256-Cmlxl1CAFbPjuIAK9fmg4bdX3H8QETTCIeoS3VzAks4=", + "ref": "main", + "rev": "adc6e824e592704968754165acd017f5f8292c28", + "revCount": 47, + "type": "git", + "url": "https://git.asxp.io/asxpi/datacenterbingo" + }, + "original": { + "ref": "main", + "rev": "adc6e824e592704968754165acd017f5f8292c28", + "type": "git", + "url": "https://git.asxp.io/asxpi/datacenterbingo" + } + }, "flake-compat": { "flake": false, "locked": { @@ -106,16 +126,16 @@ }, "nixpkgs": { "locked": { - "lastModified": 1794552581, - "narHash": "sha256-qXFIqA6FCcx7XeDzw0ZNlkDT9UiCzrNDwK8RuU8RcHM=", + "lastModified": 1794386569, + "narHash": "sha256-x9sADJvoVG0L6RejZB+/BB4YiGZFBZrfTlhF4uBq1tQ=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "f1e5c356f35d07e7b71a6b5e6c9338e0b029e0c0", + "rev": "d4f25a3e562008648d45bcf2d70bcc7422cad84e", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-26.05", + "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } @@ -136,13 +156,30 @@ "type": "github" } }, + "nixpkgs_2": { + "locked": { + "lastModified": 1794552581, + "narHash": "sha256-qXFIqA6FCcx7XeDzw0ZNlkDT9UiCzrNDwK8RuU8RcHM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "f1e5c356f35d07e7b71a6b5e6c9338e0b029e0c0", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-26.05", + "repo": "nixpkgs", + "type": "github" + } + }, "root": { "inputs": { "blog": "blog", "comin": "comin", "crawler-alert": "crawler-alert", "czsk": "czsk", - "nixpkgs": "nixpkgs", + "datacenterbingo": "datacenterbingo", + "nixpkgs": "nixpkgs_2", "nixpkgs-unstable": "nixpkgs-unstable", "sops-nix": "sops-nix" } diff --git a/nixos/flake.nix b/nixos/flake.nix index e838d48..3131c09 100644 --- a/nixos/flake.nix +++ b/nixos/flake.nix @@ -26,6 +26,9 @@ url = "git+https://git.asxp.io/czsk/czsk?ref=main&rev=25c73b9c0ac1c1bf56812e844d7f55b0a39d46eb"; inputs.nixpkgs.follows = "nixpkgs"; }; + # Ruby 4.0 and its gems come from the app's own nixpkgs: what its CI + # tested is what runs + datacenterbingo.url = "git+https://git.asxp.io/asxpi/datacenterbingo?ref=main&rev=adc6e824e592704968754165acd017f5f8292c28"; # services.crawler-alert (hosts/asxpio-ops/crawler.nix) crawler-alert = { url = "git+https://git.asxp.io/asxpi/traefik-crawlers-statistics?ref=main"; @@ -42,6 +45,7 @@ crawler-alert, blog, czsk, + datacenterbingo, ... }: let @@ -96,6 +100,7 @@ ./hosts/asxpio-services blog.nixosModules.default czsk.nixosModules.default + datacenterbingo.nixosModules.default ]; }; }; diff --git a/nixos/hosts/asxpio-ops/postgres.nix b/nixos/hosts/asxpio-ops/postgres.nix index 955fe21..104eb75 100644 --- a/nixos/hosts/asxpio-ops/postgres.nix +++ b/nixos/hosts/asxpio-ops/postgres.nix @@ -26,6 +26,7 @@ in authentication = '' host all all 10.88.0.0/16 scram-sha-256 host all all 10.89.0.0/16 scram-sha-256 + host asxpio bingo 10.10.0.20/32 scram-sha-256 ''; }; networking.firewall.interfaces."podman*".allowedTCPPorts = [ 5432 ]; diff --git a/nixos/hosts/asxpio-services/apps.nix b/nixos/hosts/asxpio-services/apps.nix index b80c040..544ffac 100644 --- a/nixos/hosts/asxpio-services/apps.nix +++ b/nixos/hosts/asxpio-services/apps.nix @@ -2,7 +2,7 @@ # ../../flake.nix) and served here; Traefik on asxpio-ops routes to them # over the private network (asxpio.routes there). A release is a bump of # the app's input in flake.lock. -{ ... }: +{ config, ... }: { # A new or changed virtual host reloads nginx instead of restarting it services.nginx.enableReload = true; @@ -10,8 +10,23 @@ services.blog.enable = true; # :8081 services.czsk.enable = true; # :8082 + # Read-only: the bingo role on Postgres and a read-only key for the + # photo bucket, both on asxpio-ops + sops.secrets."datacenterbingo/env".restartUnits = [ "datacenterbingo.service" ]; + services.datacenterbingo = { + enable = true; # :3002 + environmentFile = config.sops.secrets."datacenterbingo/env".path; + environment = { + BINGO_HOST = "datacenterbingo.xyz"; + S3_ENDPOINT = "http://10.10.0.10:3900"; + S3_REGION = "us-east-1"; + S3_BUCKET = "datacenterbingo-photos"; + }; + }; + asxpio.security.ports = [ "tcp/8081/nginx" "tcp/8082/nginx" + "tcp/3002/ruby" ]; } diff --git a/nixos/secrets/asxpio-services.yaml b/nixos/secrets/asxpio-services.yaml index d7e24c5..b4b0814 100644 --- a/nixos/secrets/asxpio-services.yaml +++ b/nixos/secrets/asxpio-services.yaml @@ -16,6 +16,8 @@ alert: runner: token: ENC[AES256_GCM,data:hzBotgtfczEBkk3pxhswbxL0CGKu8jNA9fgwSBaR4k+NZjTp6iAglg==,iv:sihXuxVDd2e1jaeLWSqbABqi3LeLIsLOZcws6g8errc=,tag:vjf3IGjFbFY6I0nYUOUmBQ==,type:str] interop_token: ENC[AES256_GCM,data:VkSIhyRlyvxQDIWyHolaJJ9i2lV+oWk/lwflpMQ1YGatMC03RXqk1w==,iv:6FyDJD6Cg7kUOYcGGFz/bd8bO72QNtqYcFEpU+BlsZQ=,tag:qSsbbg/AdyCrbgiqEIAmWQ==,type:str] +datacenterbingo: + env: ENC[AES256_GCM,data:D9NjmYBoFgETW2gIxyky3q+UYpl7fOiVEBcKOLTndU4Oqg/QUoHfeMEfwsngHGm+v29SMhXFIezApaaTXA81gOa5WhhfzzXgcanr5mHzdDfPtbtXVmx5CY2T7CVXjaYckRTdbotoyxJtA3RklFmZYXkGZOL5oXrUFT/Ti4Q2YO9Y4F2Zjuwp8Exnpwhb79Wb5j9ov8uVU+wWhzMgPICfO9v5ITAFcOSMyVXfC9ZyTQO18PAd89Y9NZeoyyuGbsUGoQmT3KvSlx8G6kF1XrVmec3jlEzUqW0IbksV9CG3dOHtbG0Mhozlit0uY14CG11w7hyEVclD61aQOrDFHEpnfIq+KP0y3m13YW5/wnYnI2JocnGfFPS38vn2T/g=,iv:VbbDL1xsaOUlNDU3lJgD6JiOjz8LbhJUHNQHQkSBl7E=,tag:+3bxdAiLfszSn8yccI18Qg==,type:str] sops: age: - enc: | @@ -36,7 +38,7 @@ sops: PNiHz6EBtNgte1ponTdSWwJ2qWO2kN6gSH6ONktA22g8N88ECtVXDg== -----END AGE ENCRYPTED FILE----- recipient: age15ws8alg3ftsgmzvqxft09556g87s4n8c8v39nmvhaz6k50gp4e7se8acmg - lastmodified: "2026-11-17T06:56:28Z" - mac: ENC[AES256_GCM,data:3S9Xk9SyNWWuSlrTV24ShYHyLWuxyBSefdFmzyk/AqWMLfmnY4VqonVfcMZh9dNZfE4NcAc2qdcnu0wXvSJlh7gZ4q+Dmbc+g7QW8KqXIF4FF03yz3MqjKPdrYZdt+fZFUfN03HUfD4tPjXkfefTNTCbBeMWl3nU1NDbRaQLKts=,iv:ZnaLHl4sffogJo/CVDgSooAji7ezYtKj59KBMmkffvU=,tag:RJ5Xg6z90fd3QTWmgt8HNA==,type:str] + lastmodified: "2026-11-17T09:48:58Z" + mac: ENC[AES256_GCM,data:MmHfVauNjOLE5UIRgvm1wXGSB8TxLNOtClYiAXK1Ab+u/FLK+aA9nPGDgHWCdSeFQHVzShFkfvv9LBimGZb0TILEYO6+CLLvmQR0qYK3bUR9U3H8uwl0T/y/YAcDVe0hGTC2utUaxWQJVgRHcPkjxwVKgnbAIbt6j39rbNR8Dp0=,iv:qAj00Ic/qZpXIql1+Q/+ZXWp4tV+Be0Y2AwrJ6s5f8Y=,tag:oG8QdRsVdAdE/yeGDbrWdQ==,type:str] unencrypted_suffix: _unencrypted version: 3.13.3 diff --git a/renovate.json b/renovate.json index 652fabb..a4b2246 100644 --- a/renovate.json +++ b/renovate.json @@ -34,7 +34,8 @@ ], "matchDepNames": [ "blog", - "czsk" + "czsk", + "datacenterbingo" ], "automerge": true, "automergeType": "branch"