forked from rustfs/rustfs-flake
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnixos-configuration.nix
More file actions
112 lines (95 loc) · 3.38 KB
/
nixos-configuration.nix
File metadata and controls
112 lines (95 loc) · 3.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# Copyright 2024 RustFS Team
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# RustFS NixOS Configuration Example
#
# This example demonstrates a secure production deployment of RustFS.
# For complete security documentation, see ../docs/SECURITY.md
{ config, pkgs, ... }:
{
services.rustfs = {
enable = true;
# Storage path - use persistent storage, not /tmp
volumes = "/var/lib/rustfs/data";
# API server address (Port 9000)
# Use "0.0.0.0:9000" or ":9000" to listen on all interfaces
address = ":9000";
# Management console configuration (Port 9001)
# SECURITY: Bind console to localhost only, access via SSH tunnel
consoleEnable = true;
consoleAddress = "127.0.0.1:9001";
# Logging configuration
# Use "info" in production, not "debug" or "trace"
logLevel = "info";
# Optional: Log to files instead of systemd journal
# By default (null), logs go to systemd journal (journalctl -u rustfs)
# Uncomment to enable file logging:
# logDirectory = "/var/log/rustfs";
# TLS directory for certificates
tlsDirectory = "/etc/rustfs/tls";
# SECURITY: Use file-based secrets, never plain text!
# The accessKey and secretKey options have been removed for security.
# Always use accessKeyFile and secretKeyFile instead.
#
# Option 1: Using sops-nix (Recommended)
accessKeyFile = config.sops.secrets.rustfs-access-key.path;
secretKeyFile = config.sops.secrets.rustfs-secret-key.path;
# Option 2: Using agenix
# accessKeyFile = config.age.secrets.rustfs-access-key.path;
# secretKeyFile = config.age.secrets.rustfs-secret-key.path;
# Option 3: Manual secret files
# accessKeyFile = "/run/secrets/rustfs-access-key";
# secretKeyFile = "/run/secrets/rustfs-secret-key";
};
# Example: sops-nix configuration
# Uncomment if using sops-nix for secret management
# sops = {
# defaultSopsFile = ./secrets/rustfs.yaml;
# age.keyFile = "/var/lib/sops-nix/key.txt";
#
# secrets = {
# rustfs-access-key = {
# owner = config.services.rustfs.user;
# group = config.services.rustfs.group;
# mode = "0400";
# };
#
# rustfs-secret-key = {
# owner = config.services.rustfs.user;
# group = config.services.rustfs.group;
# mode = "0400";
# };
# };
# };
# Firewall configuration
networking.firewall = {
enable = true;
# Only allow API port
# Console is on localhost only and accessed via SSH tunnel
allowedTCPPorts = [ 9000 ];
};
# Optional: Log rotation (only needed when logDirectory is set)
# services.logrotate = {
# enable = true;
# settings.rustfs = {
# files = "/var/log/rustfs/*.log";
# frequency = "daily";
# rotate = 7;
# compress = true;
# delaycompress = true;
# missingok = true;
# notifempty = true;
# create = "0640 rustfs rustfs";
# };
# };
}