feat: Cache | implement npm cache

This commit is contained in:
2025-11-23 00:20:55 +05:00
parent c4a94772d9
commit 945be1fa0a
5 changed files with 382 additions and 20 deletions

View File

@@ -1,17 +1,39 @@
import { Construct } from "constructs";
import { TerraformStack } from "cdktf";
import { KubernetesProvider } from "@cdktf/provider-kubernetes/lib/provider";
import { NamespaceV1 } from "@cdktf/provider-kubernetes/lib/namespace-v1";
import { NixCache } from "./nix";
import { NpmCache } from "./npm";
export class CacheInfrastructure extends TerraformStack {
constructor(scope: Construct, id: string) {
super(scope, id);
const kubernetes = new KubernetesProvider(this, "kubernetes", {
const provider = new KubernetesProvider(this, "kubernetes", {
configPath: "~/.kube/config",
});
const namespace = "package-cache";
new NamespaceV1(this, "package-cache-namespace", {
metadata: {
name: namespace,
},
});
// Add cache-related infrastructure components here
new NixCache(this, "nix-cache", kubernetes);
new NixCache(this, "nix-cache", {
provider,
namespace,
name: "nix-cache",
host: "nix.dogar.dev",
});
new NpmCache(this, "npm-cache", {
provider,
namespace,
name: "npm-cache",
host: "npm.dogar.dev",
});
}
}