mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-11-28 09:12:33 +01:00
Deploy RustFS in place of the retired MinIO and move the S3 consumers over. - flake.nix / flake.lock / outputs/default.nix: add a nixpkgs-small (nixos-unstable-small) input for the rustfs 1.0.0 package (with the web console), instantiated as pkgs-small in genSpecialArgs alongside the other nixpkgs instances; drop the rustfs flake input. The rest of the system stays on the default nixpkgs. - hosts/12kingdoms-youko/homelab-services/rustfs.nix: use nixpkgs' own services.rustfs module, with package = pkgs-small.rustfs and environmentFile = the agenix rustfs.env secret. - caddy.nix: s3.writefor.fun (S3 API) and s3-console.writefor.fun (console, redirects / to /rustfs/console/). - secrets/nixos.nix: declare a single rustfs.env (dotenv) secret holding RUSTFS_ACCESS_KEY / RUSTFS_SECRET_KEY, replacing the separate key files. - infra/minio -> infra/rustfs: buckets are managed with the hashicorp/aws provider against the RustFS S3 endpoint; IAM/ILM are applied with rc.
71 lines
2.1 KiB
Markdown
71 lines
2.1 KiB
Markdown
# Infrastructure as Code
|
|
|
|
This directory contains Infrastructure as Code (IaC) configurations using Terraform, primarily for
|
|
managing storage and backend services.
|
|
|
|
## Current Structure
|
|
|
|
```
|
|
infra/
|
|
├── README.md
|
|
└── rustfs/ # RustFS S3-compatible storage (replaced MinIO)
|
|
├── README.md # RustFS + rc runbook (buckets / IAM)
|
|
├── loki/ # Loki log storage buckets
|
|
│ ├── README.md
|
|
│ ├── loki.tf # Loki-specific bucket configuration
|
|
│ ├── main.tf # Main Terraform configuration
|
|
│ └── run.sh # Deployment script
|
|
└── tf-s3-backend/ # Terraform S3 backend setup
|
|
├── README.md
|
|
├── main.tf # Main configuration
|
|
├── run.sh # Deployment script
|
|
└── tf-s3-backend.tf # Backend bucket configuration
|
|
```
|
|
|
|
## Services Overview
|
|
|
|
### RustFS Storage
|
|
|
|
- **Loki Buckets**: Dedicated storage for Grafana Loki log aggregation
|
|
- **Terraform Backend**: Centralized state management for all Terraform configurations
|
|
|
|
RustFS speaks the S3 API but not MinIO's Admin API, so buckets/lifecycle are managed with the AWS
|
|
provider and IAM users/policies with the official `rc` client. See
|
|
[rustfs/README.md](./rustfs/README.md).
|
|
|
|
### External Resources
|
|
|
|
- **Kubernetes YAML**: Managed in separate repository
|
|
[ryan4yin/k8s-gitops](https://github.com/ryan4yin/k8s-gitops)
|
|
- **Secrets Management**: Handled via agenix in [../secrets](../secrets/)
|
|
|
|
## Usage
|
|
|
|
Each subdirectory contains its own Terraform configuration:
|
|
|
|
1. **Navigate to specific service**:
|
|
|
|
```bash
|
|
cd infra/rustfs/loki
|
|
```
|
|
|
|
2. **Deploy configuration**:
|
|
|
|
```bash
|
|
./run.sh
|
|
```
|
|
|
|
3. **Manual deployment**:
|
|
```bash
|
|
terraform init
|
|
terraform plan
|
|
terraform apply
|
|
```
|
|
|
|
## Security Considerations
|
|
|
|
- All storage buckets are configured with appropriate access policies
|
|
- State files are encrypted at rest
|
|
- Access credentials are managed through environment variables
|
|
- Network access is restricted to necessary hosts only
|