Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add minio #161

Merged
merged 3 commits into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions hosts/idols-aquamarine/caddy.nix
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,38 @@ in {
encode zstd gzip
reverse_proxy http://localhost:9093
'';
virtualHosts."minio.writefor.fun".extraConfig = ''
${hostCommonConfig}
encode zstd gzip
reverse_proxy http://localhost:9096 {
header_up Host {http.request.host}
header_up X-Real-IP {http.request.remote.host}
header_up X-Forwarded-For {http.request.header.X-Forwarded-For}
header_up X-Forwarded-Proto {scheme}
transport http {
dial_timeout 300s
read_timeout 300s
write_timeout 300s
}
}
'';
virtualHosts."minio-ui.writefor.fun".extraConfig = ''
${hostCommonConfig}
encode zstd gzip
reverse_proxy http://localhost:9097 {
header_up Host {http.request.host}
header_up X-Real-IP {http.request.remote.host}
header_up X-Forwarded-For {http.request.header.X-Forwarded-For}
header_up X-Forwarded-Proto {scheme}
header_up Upgrade {http.request.header.Upgrade}
header_up Connection {http.request.header.Connection}
transport http {
dial_timeout 300s
read_timeout 300s
write_timeout 300s
}
}
'';
};
networking.firewall.allowedTCPPorts = [80 443];

Expand Down
18 changes: 18 additions & 0 deletions hosts/idols-aquamarine/minio.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{config, ...}: let
dataDir = ["/data/apps/minio/data"];
configDir = "/data/apps/minio/config";
in {
# https://github.com/NixOS/nixpkgs/blob/nixos-24.05/nixos/modules/services/web-servers/minio.nix
services.minio = {
enable = true;
browser = true; # Enable or disable access to web UI.

inherit dataDir configDir;
listenAddress = "127.0.0.1:9096";
consoleAddress = "127.0.0.1:9097"; # Web UI
region = "us-east-1"; # default to us-east-1, same as AWS S3.

# File containing the MINIO_ROOT_USER, default is “minioadmin”, and MINIO_ROOT_PASSWORD (length >= 8), default is “minioadmin”;
rootCredentialsFile = config.age.secrets."minio.env".path;
};
}
5 changes: 5 additions & 0 deletions secrets/nixos.nix
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,11 @@ in {
mode = "0400";
owner = "sftpgo";
};
"minio.env" = {
file = "${mysecrets}/server/minio.env.age";
mode = "0400";
owner = "minio";
};
};
})

Expand Down