From d854bad66cabf348603ff0358212955fa14fa3a1 Mon Sep 17 00:00:00 2001 From: Adithya Nair Date: Fri, 2 Jun 2023 12:45:51 +0530 Subject: [PATCH] rico2: setup adtya.xyz --- hosts/rico2/containers/adtya.xyz.nix | 14 ++++++++++++++ hosts/rico2/containers/default.nix | 7 +++++++ hosts/rico2/default.nix | 1 + hosts/rico2/programs/default.nix | 2 +- hosts/rico2/services/caddy.nix | 2 +- hosts/rico2/services/frpc.nix | 20 ++++++++++++++++++++ 6 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 hosts/rico2/containers/adtya.xyz.nix create mode 100644 hosts/rico2/containers/default.nix diff --git a/hosts/rico2/containers/adtya.xyz.nix b/hosts/rico2/containers/adtya.xyz.nix new file mode 100644 index 0000000..08b44ab --- /dev/null +++ b/hosts/rico2/containers/adtya.xyz.nix @@ -0,0 +1,14 @@ +{...}: { + virtualisation.oci-containers.containers."adtya.xyz" = { + image = "ghcr.io/adtya/adtya.xyz:latest"; + ports = ["3000:80"]; + }; + + services.caddy.virtualHosts."adtya.xyz" = { + hostName = "adtya.xyz"; + serverAliases = ["www.adtya.xyz" "adtya.xyz"]; + extraConfig = '' + reverse_proxy http://127.0.0.1:3000 + ''; + }; +} diff --git a/hosts/rico2/containers/default.nix b/hosts/rico2/containers/default.nix new file mode 100644 index 0000000..27576c2 --- /dev/null +++ b/hosts/rico2/containers/default.nix @@ -0,0 +1,7 @@ +{...}: { + imports = [./adtya.xyz.nix]; + + virtualisation.oci-containers = { + backend = "podman"; + }; +} diff --git a/hosts/rico2/default.nix b/hosts/rico2/default.nix index 3da43ce..a815bd4 100644 --- a/hosts/rico2/default.nix +++ b/hosts/rico2/default.nix @@ -3,6 +3,7 @@ ./hardware ./programs ./services + ./containers ./security.nix ]; diff --git a/hosts/rico2/programs/default.nix b/hosts/rico2/programs/default.nix index 562a0f3..e85c1c4 100644 --- a/hosts/rico2/programs/default.nix +++ b/hosts/rico2/programs/default.nix @@ -1,4 +1,4 @@ -{pkgs,...}: { +{pkgs, ...}: { imports = [ ./neovim.nix ./starship.nix diff --git a/hosts/rico2/services/caddy.nix b/hosts/rico2/services/caddy.nix index 190f3c3..13c8511 100644 --- a/hosts/rico2/services/caddy.nix +++ b/hosts/rico2/services/caddy.nix @@ -1,4 +1,4 @@ -{ ... }: let +{...}: let caddy_config = (import ../../../secrets.nix).caddy_config; in { services.caddy = { diff --git a/hosts/rico2/services/frpc.nix b/hosts/rico2/services/frpc.nix index e7ea324..00ade7a 100644 --- a/hosts/rico2/services/frpc.nix +++ b/hosts/rico2/services/frpc.nix @@ -25,5 +25,25 @@ in { type = tcp local_port = 22 remote_port = 6002 + + [http.adtya.xyz] + type = http + custom_domains = adtya.xyz + local_port = 80 + + [https.adtya.xyz] + type = https + custom_domains = adtya.xyz + local_port = 443 + + [http.www.adtya.xyz] + type = http + custom_domains = www.adtya.xyz + local_port = 80 + + [https.www.adtya.xyz] + type = https + custom_domains = www.adtya.xyz + local_port = 443 ''; }