Skip to content
Draft
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
1 change: 1 addition & 0 deletions bin/update_puppetfile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ function add_module() {

# Pin to specific commit
if [[ -n "$COMMIT_HASH" ]]; then
LATEST_TAG="$COMMIT_HASH"
setup_module_git_clone "$COMMIT_HASH"
COMMIT_MESSAGE="chore: pin puppet-${MODULE_NAME} module @${COMMIT_HASH}

Expand Down
4 changes: 4 additions & 0 deletions modules/Puppetfile
Original file line number Diff line number Diff line change
Expand Up @@ -491,3 +491,7 @@ mod 'obmondo/puppetlabs-yumrepo_core',
mod 'obmondo/openvas',
:git => 'https://github.com/Obmondo/puppet-openvas',
:ref => 'v0.0.2'

mod 'obmondo/rustfs',
:git => 'https://github.com/Obmondo/puppet-rustfs.git',
:ref => 'feat/add-puppet-rustfs-module'
43 changes: 43 additions & 0 deletions modules/enableit/profile/manifests/storage/rustfs.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# @summary RustFS storage profile
#
# @param data_dir The host directory where backup data is stored.
# @param version The version of rustfs container image to use.
# @param access_key The S3 access key ID.
# @param secret_key The S3 secret access key.
# @param env_vars Additional hash of environment variables for the container.
# @param enable Whether to enable and manage the rustfs component.
# @param enable_expose Whether to expose the service via HAProxy.
# @param domains HAProxy domain configuration.
#
class profile::storage::rustfs (
Stdlib::Unixpath $data_dir = $role::storage::rustfs::data_dir,
String[1] $version = $role::storage::rustfs::version,
String[1] $access_key = $role::storage::rustfs::access_key,
String[1] $secret_key = $role::storage::rustfs::secret_key,
Hash $env_vars = $role::storage::rustfs::env_vars,
Boolean $enable = $role::storage::rustfs::enable,
Boolean $enable_expose = $role::storage::rustfs::enable_expose,
Eit_haproxy::Domains $domains = $role::storage::rustfs::domains,
) {
# 1. Manage RustFS
class { 'rustfs':
enable => $enable,
data_dir => $data_dir,
version => $version,
access_key => $access_key,
secret_key => $secret_key,
env_vars => $env_vars,
}

# 2. Conditional HAProxy Exposure using profile::web::haproxy (HAProxy 3.2 + Native ACME)
if $enable and $enable_expose {
class { 'profile::web::haproxy':
configure => 'auto',
manual_config => undef,
domains => $domains,
version => '3.2.0',
encryption_ciphers => 'Intermediate',
use_lets_encrypt => true,
}
}
}
27 changes: 27 additions & 0 deletions modules/enableit/role/manifests/storage/rustfs.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# @summary Class for managing the RustFS Storage role
#
# @param data_dir The host directory where backup data is stored.
# @param version The version of rustfs container image to use.
# @param access_key The S3 access key ID.
# @param secret_key The S3 secret access key.
# @param env_vars Additional hash of environment variables for the container.
# @param enable Whether to enable and manage the rustfs component.
# @param enable_expose Whether to expose the service via HAProxy.
# @param domains HAProxy domain configuration.
#
# @example Usage
# include role::storage::rustfs
#
class role::storage::rustfs (
Stdlib::Unixpath $data_dir = '/mnt/backups/rustfs',
String[1] $version = '1.0.0-rc.2',
String[1] $access_key = 'admin',
String[1] $secret_key = 'admin',
Hash $env_vars = {},
Boolean $enable = true,
Boolean $enable_expose = false,
Eit_haproxy::Domains $domains = {},
) inherits role::storage {
contain role::virtualization::docker
contain profile::storage::rustfs
}
661 changes: 661 additions & 0 deletions modules/upstream/rustfs/LICENSE

Large diffs are not rendered by default.

58 changes: 58 additions & 0 deletions modules/upstream/rustfs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# puppet-rustfs

Maintained by [Obmondo](https://obmondo.com).

## Description

This module manages the deployment of `rustfs` as an S3-compatible backup storage target using Docker Compose.

## Setup

### What rustfs affects

* Installs Docker and Docker Compose packages.
* Creates the `/opt/obmondo/docker-compose/rustfs` directory.
* Manages the `/opt/obmondo/docker-compose/rustfs/docker-compose.yml` file.
* Runs the `rustfs` container using Docker Compose.

### Ports Used

* **Port 9000 (S3 API / Data Port)**: Used by backup clients (Velero, PostgreSQL backup jobs, [Kubeaid](https://kubeaid.io) clusters) for all S3 read/write and backup object transfers.
* **Port 9001 (Web Console / Management UI)**: Used for accessing the web-based management interface.

### Beginning with rustfs

To get started, ensure your data directory is pre-mounted, then include the class:

```puppet
class { 'rustfs':
enable => true,
data_dir => '/mnt/backups/rustfs',
version => '1.0.0-rc.2',
access_key => 'your-access-key',
secret_key => 'your-secret-key',
}
```

## Usage

You can configure the module via Hiera. Secrets (`secret_key`) should be managed using `eyaml`.

### Common Hiera Configuration (`data/common.yaml`)

```yaml
---
rustfs::enable: true
rustfs::version: '1.0.0-rc.2'
rustfs::container_image: 'rustfs/rustfs'
rustfs::data_dir: '/mnt/backups/rustfs'
rustfs::access_key: 'my-backup'
rustfs::secret_key: 'ENC[PKCS7,...]'
rustfs::env_vars:
SOME_EXTRA_VAR: 'value'
```

## Limitations

* Currently only supports Ubuntu.
* Requires the data directory (`data_dir`) to be pre-mounted and managed by system-level configuration; the module will fail if the directory is missing.
9 changes: 9 additions & 0 deletions modules/upstream/rustfs/data/common.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
rustfs::enable: false
rustfs::version: "1.0.0-rc.2"
rustfs::dependencies: []
rustfs::container_image: "rustfs/rustfs"
rustfs::data_dir: "/opt/rustfs/data"
rustfs::access_key: "admin"
rustfs::secret_key: "admin"
rustfs::env_vars: {}
80 changes: 80 additions & 0 deletions modules/upstream/rustfs/manifests/init.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# @summary Main class for managing rustfs
#
# This class provides high-level control over whether rustfs
# should be managed via Docker Compose.
#
# @param enable
# Whether to enable and manage the rustfs component.
# @param data_dir
# The host directory where backup data is stored.
# @param version
# The version of rustfs container image to use.
# @param access_key
# The S3 access key ID for authentication.
# @param secret_key
# The S3 secret access key for authentication.
# @param env_vars
# Additional hash of environment variables for the container.
#
# @example Basic usage
# include rustfs
#
class rustfs (
Boolean $enable = false,
Stdlib::Unixpath $data_dir = '/opt/rustfs/data',
String[1] $version = lookup('rustfs::version'),
String[1] $access_key = lookup('rustfs::access_key'),
String[1] $secret_key = lookup('rustfs::secret_key'),
Hash $env_vars = {},
) {
include docker

$_osname = $facts['os']['name']
if $_osname != 'Ubuntu' {
fail("The OS you running (${_osname}) isn't supported to setup rustfs")
}

$container_image = lookup('rustfs::container_image')
$compose_dir = '/opt/obmondo/docker-compose/rustfs'

$_merged_env = {
'RUSTFS_ACCESS_KEY' => $access_key,
'RUSTFS_SECRET_KEY' => $secret_key,
} + $env_vars

if $enable {
# Validate data_dir existence
if !inline_template('<%= File.directory?(@data_dir) %>') == 'true' {
fail("rustfs: data_dir ${data_dir} must be pre-mounted and managed by system-level configuration.")
}

file { $compose_dir:
ensure => directory,
owner => 'root',
group => 'root',
mode => '0755',
}

file { "${compose_dir}/docker-compose.yml":
ensure => file,
content => epp('rustfs/docker-compose.yml.epp', {
'image' => $container_image,
'version' => $version,
'data_dir' => $data_dir,
'env_vars' => $_merged_env,
}),
require => File[$compose_dir],
}

docker_compose { 'rustfs':
ensure => present,
compose_files => ["${compose_dir}/docker-compose.yml"],
subscribe => File["${compose_dir}/docker-compose.yml"],
}
} else {
docker_compose { 'rustfs':
ensure => absent,
compose_files => ["${compose_dir}/docker-compose.yml"],
}
}
}
41 changes: 41 additions & 0 deletions modules/upstream/rustfs/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"name": "puppet-rustfs",
"version": "1.0.0",
"author": "Obmondo",
"summary": "RustFS Puppet/Openvox module",
"license": "AGPL-3.0",
"source": "https://github.com/obmondo/puppet-rustfs",
"dependencies": [
{
"name": "puppetlabs/stdlib",
"version_requirement": ">= 4.1.0"
},
{
"name": "puppetlabs/docker",
"version_requirement": ">= 7.0.0"
}
],
"operatingsystem_support": [
{
"operatingsystem": "Ubuntu",
"operatingsystemrelease": [
"22.04",
"24.04",
"26.04"
]
}
],
"requirements": [
{
"name": "puppet",
"version_requirement": ">= 7.24 < 9.0.0"
},
{
"name": "openvox",
"version_requirement": ">= 7.24 < 9.0.0"
}
],
"pdk-version": "3.4.0",
"template-url": "https://github.com/puppetlabs/pdk-templates#3.4.0",
"template-ref": "tags/3.4.0-0-gd3cc13f"
}
13 changes: 13 additions & 0 deletions modules/upstream/rustfs/templates/docker-compose.yml.epp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
services:
rustfs:
image: <%= $image %>:<%= $version %>
restart: always
volumes:
- <%= $data_dir %>:/data
environment:
<%- $env_vars.each |$key, $value| { -%>
<%= $key %>: '<%= $value %>'
<%- } -%>
ports:
- 9000:9000
- 9001:9001