From 75ade9c9e1af8ba60f99284c7c659c31844b30b9 Mon Sep 17 00:00:00 2001 From: Julius de Jeu Date: Sun, 22 May 2022 01:12:03 +0200 Subject: [PATCH] Registry works, update landing page --- nixos/machines/nginx/default.nix | 1 + nixos/machines/nginx/index.html | 11 ++++-- nixos/machines/registry/default.nix | 52 +++++++++++++++++++++++++++-- 3 files changed, 59 insertions(+), 5 deletions(-) diff --git a/nixos/machines/nginx/default.nix b/nixos/machines/nginx/default.nix index 249f796..cd5e836 100644 --- a/nixos/machines/nginx/default.nix +++ b/nixos/machines/nginx/default.nix @@ -45,6 +45,7 @@ in { virtualHosts."vault.asraphiel.dev" = proxy "http://vault.lxd:8200/"; virtualHosts."s3.asraphiel.dev" = bigProxy "http://minio.lxd:9000/"; virtualHosts."shell.s3.asraphiel.dev" = proxy "http://minio.lxd:9001/"; + virtualHosts."registry.asraphiel.dev" = proxy "http://registry.lxd:5000/"; }; security.acme.email = "acme@voidcorp.nl"; security.acme.acceptTerms = true; diff --git a/nixos/machines/nginx/index.html b/nixos/machines/nginx/index.html index 81d8005..8f2cf27 100644 --- a/nixos/machines/nginx/index.html +++ b/nixos/machines/nginx/index.html @@ -18,8 +18,15 @@

Welcome to my site!

-

There's absolutely nothing here for now...

-

I'm working on it trust me!

+

There's something here...

+

Services that I run here

+ \ No newline at end of file diff --git a/nixos/machines/registry/default.nix b/nixos/machines/registry/default.nix index 878ab8f..866070b 100644 --- a/nixos/machines/registry/default.nix +++ b/nixos/machines/registry/default.nix @@ -3,8 +3,54 @@ networking.hostName = "registry"; system.stateVersion = "21.11"; - deployment.keys."wahaha" = { - text = "wahaha"; - + networking.firewall.allowedTCPPorts = [ config.services.dockerRegistry.port ]; + + services.dockerRegistry = { + enable = true; + enableDelete = true; + enableGarbageCollect = true; + listenAddress = "0.0.0.0"; + storagePath = null; # We want to store in s3 + garbageCollectDates = "weekly"; + + extraConfig = { + # S3 Storages + storage.s3 = { + regionendpoint = "https://s3.asraphiel.dev"; + bucket = "docker"; + region = "us-east-1"; # Fake but needed + accesskey = "haha"; + secretkey = "hoho"; + }; + auth.htpasswd = { + realm = "Voidcorp Registry"; + path = "/var/lib/keys/htaccess"; + }; + + # notifications.endpoints = [{ + # name = "keel"; + # url = "http://10.42.20.5:9300/v1/webhooks/registry"; + # timeout = "500ms"; + # treshold = 5; + # backoff = "1s"; + # }]; + }; + }; + systemd.services.docker-registry.serviceConfig.EnvironmentFile = + "/var/lib/keys/minioSettings"; + + deployment.keys = { + "minioSettings" = { + keyCommand = [ "vault" "kv" "get" "-field=settings" "kv/registry" ]; + destDir = "/var/lib/keys"; + user = "docker-registry"; + permissions = "0660"; + }; + "htaccess" = { + keyCommand = [ "vault" "kv" "get" "-field=htpasswd" "kv/registry" ]; + destDir = "/var/lib/keys"; + user = "docker-registry"; + permissions = "0660"; + }; }; }