From 063e559153ddea30917b88e6658a020f49b0f44a Mon Sep 17 00:00:00 2001 From: Pedro Brochado Date: Thu, 1 Oct 2026 12:40:57 -0300 Subject: [PATCH] Replace pminio profile with s3_storage using rustfs The minio has become unmaintained and Pulp CI changed to using rustfs. Renamed the profile so it's not tied to a specific project solution. --- docs/dev/guides/agent-envs.md | 2 +- docs/dev/reference/profiles/pminio.md | 43 -------------- docs/dev/reference/profiles/s3_storage.md | 33 +++++++++++ profiles/lean/README.md | 2 +- profiles/pminio/README.md | 42 -------------- profiles/pminio/compose.yaml | 24 -------- profiles/pminio/init.sh | 38 ------------- profiles/pminio/profile_default_config.env | 6 -- profiles/s3_storage/README.md | 33 +++++++++++ profiles/s3_storage/compose.yaml | 22 ++++++++ profiles/s3_storage/init.sh | 56 +++++++++++++++++++ .../s3_storage/profile_default_config.env | 3 + .../{pminio => s3_storage}/pulp_config.env | 0 13 files changed, 149 insertions(+), 155 deletions(-) delete mode 100644 docs/dev/reference/profiles/pminio.md create mode 100644 docs/dev/reference/profiles/s3_storage.md delete mode 100644 profiles/pminio/README.md delete mode 100644 profiles/pminio/compose.yaml delete mode 100644 profiles/pminio/init.sh delete mode 100644 profiles/pminio/profile_default_config.env create mode 100644 profiles/s3_storage/README.md create mode 100644 profiles/s3_storage/compose.yaml create mode 100644 profiles/s3_storage/init.sh create mode 100644 profiles/s3_storage/profile_default_config.env rename profiles/{pminio => s3_storage}/pulp_config.env (100%) diff --git a/docs/dev/guides/agent-envs.md b/docs/dev/guides/agent-envs.md index 4ece123..3754b0e 100644 --- a/docs/dev/guides/agent-envs.md +++ b/docs/dev/guides/agent-envs.md @@ -151,6 +151,6 @@ multi-env flow with `-e` if you prefer hand-written files; see ## When not to use lean agents -Interactive work that needs UI, Kafka, OpenTelemetry, MinIO, or other sidecars should keep using +Interactive work that needs UI, Kafka, OpenTelemetry, RustFS, or other sidecars should keep using the normal profiles. Add those profiles with `--env COMPOSE_PROFILE=lean:…` only when required — they increase resource use and reduce how many agents fit on one machine. diff --git a/docs/dev/reference/profiles/pminio.md b/docs/dev/reference/profiles/pminio.md deleted file mode 100644 index 6a04359..0000000 --- a/docs/dev/reference/profiles/pminio.md +++ /dev/null @@ -1,43 +0,0 @@ -# pminio - -## Usage - -Adding this profile sets up a Minio instance that is configured as Pulp's S3 backend. The Minio -instance is launched as a separate service and can be accessed inside the main container at -`http://pminio:9000`. The Minio Client CLI,`mc`, is also installed and configured inside the main -container to talk to the Minio service. - -If you want to interact with Pulp distributions from your host, -add a new entry to `/etc/hosts` on the host machine for the `pminio` alias, like so: - -``` -127.0.0.1 localhost localhost4 pminio -::1 localhost localhost6 pminio -``` - -The same entry should not exist in the container's `/etc/hosts` file because the `pminio` service -is already addressable from the internal network. - -Note that it is suggested to create a `pulp` bucket beforehand. - -## Extra Variables - -Below are the default variables used in configuring the Minio instance. If you are using -multiple OCI environments you must change the `MINIO_PORT` and `MINIO_CONSOLE_PORT` in your -`compose.env` profiles to allow the multiple services to bind correctly. - -- `S3_ENDPOINT_URL` - - Description: The internal url the Minio instance will be available at. - - Default: http://pminio:9000 -- `S3_ACCESS_KEY` - - Description: The S3 access key used to access the Minio instance. - - Default: pulpminioaccesskey -- `S3_SECRET_KEY` - - Description: The S3 secret key used to access the Minio instance. - - Default: pulpminioinsecuresecretkey -- `MINIO_PORT` - - DESCRIPTION: The outside port that the Minio instance will be exposed at. - - DEFAULT: 9000 -- `MINIO_CONSOLE_PORT` - - DESCRIPTION: The outside port that the Minio Console will be exposed at. - - DEFAULT: 9090 diff --git a/docs/dev/reference/profiles/s3_storage.md b/docs/dev/reference/profiles/s3_storage.md new file mode 100644 index 0000000..a189c46 --- /dev/null +++ b/docs/dev/reference/profiles/s3_storage.md @@ -0,0 +1,33 @@ +# s3_storage + +## Usage + +This profile starts a RustFS S3-compatible storage service and configures Pulp to use it. The S3 API +is available inside the environment at `http://rustfs:9000`. Neither the S3 API nor the RustFS +console is published to the host by default. + +If you want to access Pulp distributions from the host, add the `rustfs` alias to `/etc/hosts`: + +``` +127.0.0.1 localhost localhost4 rustfs +::1 localhost localhost6 rustfs +``` + +The alias is not needed in the container because the `rustfs` service is addressable on the internal +network. The profile creates the configured `pulp` bucket during startup. + +To expose the S3 API on the host, add a port mapping under the `rustfs` service in a Compose +override, for example `127.0.0.1:9100:9000`. Add `127.0.0.1:9101:9001` if you also want to expose +the RustFS console. The internal S3 URL used by Pulp remains `http://rustfs:9000`. + +## Extra Variables + +- `S3_ENDPOINT_URL` + - Description: The internal URL for the RustFS S3 API. + - Default: http://rustfs:9000 +- `S3_ACCESS_KEY` + - Description: The S3 access key used by Pulp and RustFS. + - Default: pulps3storageaccesskey +- `S3_SECRET_KEY` + - Description: The S3 secret key used by Pulp and RustFS. + - Default: pulps3storageinsecuresecretkey diff --git a/profiles/lean/README.md b/profiles/lean/README.md index b05e5bc..85f4f90 100644 --- a/profiles/lean/README.md +++ b/profiles/lean/README.md @@ -8,7 +8,7 @@ coding agents running scoped functional tests). - Sets `PULP_WORKERS=1` so each environment runs a single task worker - Caps the `pulp` container with `mem_limit` and `cpus` so parallel stacks do not starve the host -This profile does **not** add sidecars (UI, Kafka, OpenTelemetry, MinIO, etc.). Combine it with +This profile does **not** add sidecars (UI, Kafka, OpenTelemetry, RustFS, etc.). Combine it with other profiles only when those services are required. ## Usage diff --git a/profiles/pminio/README.md b/profiles/pminio/README.md deleted file mode 100644 index d102f97..0000000 --- a/profiles/pminio/README.md +++ /dev/null @@ -1,42 +0,0 @@ -# pminio - -## Usage - -Adding this profile sets up a Minio instance that is configured as Pulp's S3 backend. The Minio -instance is launched as a separate service and can be accessed inside the main container at -`http://pminio:9000`. The Minio Client CLI,`mc`, is also installed and configured inside the main -container to talk to the Minio service. - -Do not forget to add a new entry to `/etc/hosts` on the host machine for the `pminio` alias, like -so: -``` -127.0.0.1 localhost localhost4 pminio -::1 localhost localhost6 pminio -``` - -The same entry should not exist in the container's `/etc/hosts` file because the `pminio` service -is already addressable from the internal network. - -Note that it is suggested to create a `pulp` bucket beforehand. - -## Extra Variables - -Below are the default variables used in configuring the Minio instance. If you are using -multiple OCI environments you must change the `MINIO_PORT` and `MINIO_CONSOLE_PORT` in your -`compose.env` profiles to allow the multiple services to bind correctly. - -- `S3_ENDPOINT_URL` - - Description: The internal url the Minio instance will be available at. - - Default: http://pminio:9000 -- `S3_ACCESS_KEY` - - Description: The S3 access key used to access the Minio instance. - - Default: pulpminioaccesskey -- `S3_SECRET_KEY` - - Description: The S3 secret key used to access the Minio instance. - - Default: pulpminioinsecuresecretkey -- `MINIO_PORT` - - DESCRIPTION: The outside port that the Minio instance will be exposed at. - - DEFAULT: 9000 -- `MINIO_CONSOLE_PORT` - - DESCRIPTION: The outside port that the Minio Console will be exposed at. - - DEFAULT: 9090 diff --git a/profiles/pminio/compose.yaml b/profiles/pminio/compose.yaml deleted file mode 100644 index ef0ed51..0000000 --- a/profiles/pminio/compose.yaml +++ /dev/null @@ -1,24 +0,0 @@ -services: - pminio: - image: quay.io/minio/minio - environment: - - "MINIO_ROOT_USER={S3_ACCESS_KEY}" - - "MINIO_ROOT_PASSWORD={S3_SECRET_KEY}" - ports: - - "{MINIO_PORT}:9000" - - "{MINIO_CONSOLE_PORT}:9091" - volumes: - - "oci_pminio:/data" - depends_on: - - _base - healthcheck: - test: curl -I http://pminio:9000/minio/health/live || exit 1 - interval: 20s - timeout: 5s - retries: 5 - start_interval: 5s - command: "server /data --console-address ':9091'" - -volumes: - oci_pminio: - name: "{COMPOSE_PROJECT_NAME}_pminio" diff --git a/profiles/pminio/init.sh b/profiles/pminio/init.sh deleted file mode 100644 index e8a226b..0000000 --- a/profiles/pminio/init.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash - -set -e - -MC_DIR="$HOME/minio-binaries" -MC_BINARY="$MC_DIR/mc" - -if command -v "$MC_BINARY" &> /dev/null; then - echo "pminio/init.sh script already run." - exit 0 -fi - -echo "Installing S3 backend" -pip3 install --prefix /usr/local/ --no-cache-dir django-storages[boto3] - -echo "Installing Minio client" -curl https://dl.min.io/client/mc/release/linux-amd64/mc \ - --create-dirs \ - -o "$MC_BINARY" -chmod +x "$MC_BINARY" -export PATH=$PATH:$MC_DIR -echo "export PATH=$PATH:$MC_DIR" >> /etc/profile.d/minioclient.sh - -echo "Setting up Minio backend" -ENDPOINT_URL="${PULP_STORAGES__default__OPTIONS__endpoint_url}" -ACCESS_KEY="${PULP_STORAGES__default__OPTIONS__access_key}" -SECRET_KEY="${PULP_STORAGES__default__OPTIONS__secret_key}" -BUCKET_NAME="${PULP_STORAGES__default__OPTIONS__bucket_name}" -mc alias set s3 ${ENDPOINT_URL} ${ACCESS_KEY} ${SECRET_KEY} --api S3v4 -mc alias rm local -mc admin info s3 - -if mc find s3/${BUCKET_NAME} &> /dev/null; then - echo "Minio ${BUCKET_NAME} bucket already created" -else - echo "Creating Minio bucket ${BUCKET_NAME}" - mc mb s3/${BUCKET_NAME} -fi diff --git a/profiles/pminio/profile_default_config.env b/profiles/pminio/profile_default_config.env deleted file mode 100644 index ff93ae9..0000000 --- a/profiles/pminio/profile_default_config.env +++ /dev/null @@ -1,6 +0,0 @@ -S3_ENDPOINT_URL=http://pminio:9000 -S3_ACCESS_KEY=pulpminioaccesskey -S3_SECRET_KEY=pulpminioinsecuresecretkey - -MINIO_PORT=9000 -MINIO_CONSOLE_PORT=9091 diff --git a/profiles/s3_storage/README.md b/profiles/s3_storage/README.md new file mode 100644 index 0000000..93b098d --- /dev/null +++ b/profiles/s3_storage/README.md @@ -0,0 +1,33 @@ +# s3_storage + +## Usage + +This profile starts a RustFS S3-compatible storage service and configures Pulp to use it. The S3 API +is available inside the environment at `http://rustfs:9000`. Neither the S3 API nor the RustFS +console is published to the host by default. + +To access Pulp distributions from the host, add the `rustfs` alias to `/etc/hosts`: + +``` +127.0.0.1 localhost localhost4 rustfs +::1 localhost localhost6 rustfs +``` + +The alias is not needed in the container because the `rustfs` service is addressable on the internal +network. The profile creates the configured `pulp` bucket during startup. + +To expose the S3 API on the host, add a port mapping under the `rustfs` service in a Compose +override, for example `127.0.0.1:9100:9000`. Add `127.0.0.1:9101:9001` if you also want to expose +the RustFS console. The internal S3 URL used by Pulp remains `http://rustfs:9000`. + +## Extra Variables + +- `S3_ENDPOINT_URL` + - Description: The internal URL for the RustFS S3 API. + - Default: http://rustfs:9000 +- `S3_ACCESS_KEY` + - Description: The S3 access key used by Pulp and RustFS. + - Default: pulps3storageaccesskey +- `S3_SECRET_KEY` + - Description: The S3 secret key used by Pulp and RustFS. + - Default: pulps3storageinsecuresecretkey diff --git a/profiles/s3_storage/compose.yaml b/profiles/s3_storage/compose.yaml new file mode 100644 index 0000000..724d414 --- /dev/null +++ b/profiles/s3_storage/compose.yaml @@ -0,0 +1,22 @@ +services: + rustfs: + image: rustfs/rustfs:latest + environment: + - "RUSTFS_ACCESS_KEY={S3_ACCESS_KEY}" + - "RUSTFS_SECRET_KEY={S3_SECRET_KEY}" + - "RUSTFS_VOLUMES=/data" + - "RUSTFS_ADDRESS=0.0.0.0:9000" + - "RUSTFS_CONSOLE_ADDRESS=0.0.0.0:9001" + - "RUSTFS_CONSOLE_ENABLE=true" + volumes: + - "oci_s3_storage:/data" + healthcheck: + test: ["CMD", "curl", "-fsS", "http://127.0.0.1:9000/health"] + interval: 20s + timeout: 5s + retries: 5 + start_interval: 5s + +volumes: + oci_s3_storage: + name: "{COMPOSE_PROJECT_NAME}_s3_storage" diff --git a/profiles/s3_storage/init.sh b/profiles/s3_storage/init.sh new file mode 100644 index 0000000..8a31ccd --- /dev/null +++ b/profiles/s3_storage/init.sh @@ -0,0 +1,56 @@ +#!/bin/bash + +set -e + +if ! python3 -c 'import boto3, storages' >/dev/null 2>&1; then + echo "Installing S3 backend" + pip3 install --prefix /usr/local/ --no-cache-dir 'django-storages[boto3]' +fi + +echo "Setting up RustFS backend" +python3 - <<'PY' +import os +import time + +import boto3 +from botocore.config import Config +from botocore.exceptions import ClientError + +endpoint_url = os.environ["PULP_STORAGES__default__OPTIONS__endpoint_url"] +access_key = os.environ["PULP_STORAGES__default__OPTIONS__access_key"] +secret_key = os.environ["PULP_STORAGES__default__OPTIONS__secret_key"] +bucket_name = os.environ["PULP_STORAGES__default__OPTIONS__bucket_name"] + +s3 = boto3.client( + "s3", + endpoint_url=endpoint_url, + aws_access_key_id=access_key, + aws_secret_access_key=secret_key, + region_name="us-east-1", + config=Config(signature_version="s3v4", s3={"addressing_style": "path"}), +) + +for attempt in range(1, 7): + try: + s3.create_bucket(Bucket=bucket_name) + print(f"Created RustFS {bucket_name} bucket") + break + except Exception as error: + already_exists = ( + isinstance(error, ClientError) + and error.response.get("Error", {}).get("Code") + in { + "BucketAlreadyOwnedByYou", + "BucketAlreadyExists", + } + ) + if already_exists: + print(f"RustFS {bucket_name} bucket already created") + break + if attempt == 6: + raise + print(f"RustFS bucket creation attempt {attempt}/6 failed; retrying in 5 seconds") + time.sleep(5) +else: + raise RuntimeError("Failed to create RustFS bucket") +PY diff --git a/profiles/s3_storage/profile_default_config.env b/profiles/s3_storage/profile_default_config.env new file mode 100644 index 0000000..5960a09 --- /dev/null +++ b/profiles/s3_storage/profile_default_config.env @@ -0,0 +1,3 @@ +S3_ENDPOINT_URL=http://rustfs:9000 +S3_ACCESS_KEY=pulps3storageaccesskey +S3_SECRET_KEY=pulps3storageinsecuresecretkey diff --git a/profiles/pminio/pulp_config.env b/profiles/s3_storage/pulp_config.env similarity index 100% rename from profiles/pminio/pulp_config.env rename to profiles/s3_storage/pulp_config.env