summaryrefslogtreecommitdiff
path: root/adonis
diff options
context:
space:
mode:
authortoufic ar <contact@toufy.me>2026-07-11 15:46:19 +0300
committertoufic ar <contact@toufy.me>2026-07-11 15:46:19 +0300
commitfc41175d7cb18c9612be2881addc29e862d6a251 (patch)
tree85c0256467f56e93455097929c65790a172c271c /adonis
parentba817db0f81426d500d793af17cf1622cf67298e (diff)
downloadservers-fc41175d7cb18c9612be2881addc29e862d6a251.tar.gz
servers-fc41175d7cb18c9612be2881addc29e862d6a251.zip
autopush setup
Diffstat (limited to 'adonis')
-rw-r--r--adonis/autopush/default.nix60
-rw-r--r--adonis/ntfy/default.nix20
2 files changed, 60 insertions, 20 deletions
diff --git a/adonis/autopush/default.nix b/adonis/autopush/default.nix
new file mode 100644
index 0000000..4a6b85e
--- /dev/null
+++ b/adonis/autopush/default.nix
@@ -0,0 +1,60 @@
+{
+ config,
+ pkgs,
+ ...
+}: let
+ domain = "push.${config.customOps.domain.fqdn}";
+ port = 2586;
+ redisPort = 6369;
+ endpointPort = 443;
+ autopush = pkgs.autopush-rs;
+in {
+ sops.secrets = {
+ "autopush/autoconnect" = {
+ owner = "autopush";
+ };
+ "autopush/autoendpoint" = {
+ owner = "autopush";
+ };
+ };
+ users.users."autopush" = {
+ group = "autopush";
+ useDefaultShell = true;
+ };
+ environment.systemPackages = [autopush];
+ services.redis.servers."autopush" = {
+ enable = true;
+ port = redisPort;
+ };
+ systemd.services = {
+ autopush-autoconnect = {
+ environment = {
+ AUTOCONNECT__DB_DSN = "redis://127.0.0.1:${redisPort}";
+ AUTOCONNECT__ENDPOINT_SCHEME = "https";
+ AUTOCONNECT__ENDPOINT_HOSTNAME = "update.${domain}";
+ AUTOCONNECT__ENDPOINT_PORT = endpointPort;
+ AUTOCONNECT__ROUTER_HOSTNAME = "127.0.0.1";
+ };
+ wantedBy = ["multi-user.target"];
+ unitConfig.ConditionUser = "autopush";
+ serviceConfig = {
+ EnvironmentFile = config.sops.secrets."autopush/autoconnect".path;
+ ExecStart = "${autopush}/bin/autoconnect";
+ };
+ };
+ autopush-autoendpoint = {
+ environment = {
+ AUTOEND__DB_DSN = "redis://127.0.0.1:${redisPort}";
+ AUTOEND__HOST = "0.0.0.0";
+ AUTOEND__PORT = port;
+ AUTOEND__ENDPOINT_URL = "https://update.${domain}";
+ };
+ wantedBy = ["multi-user.target"];
+ unitConfig.ConditionUser = "autopush";
+ serviceConfig = {
+ EnvironmentFile = config.sops.secrets."autopush/autoendpoint".path;
+ ExecStart = "${autopush}/bin/autoendpoint";
+ };
+ };
+ };
+}
diff --git a/adonis/ntfy/default.nix b/adonis/ntfy/default.nix
deleted file mode 100644
index 9f97e86..0000000
--- a/adonis/ntfy/default.nix
+++ /dev/null
@@ -1,20 +0,0 @@
-{config, ...}: let
- ntfyDomain = "push.${config.customOps.domain.fqdn}";
- listen = "127.0.0.1:2586";
-in {
- services.ntfy-sh = {
- enable = true;
- settings = {
- base-url = "https://${ntfyDomain}";
- behind-proxy = true;
- auth-access = ["*:up*:write-only"];
- listen-http = listen;
- };
- };
-
- services.nginx.virtualHosts.${ntfyDomain} = {
- forceSSL = true;
- enableACME = true;
- locations."/".proxyPass = "http://${listen}";
- };
-}