mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-10 12:47:04 +00:00
Two addons with disjoint mechanisms. s3-uploads is the upstream plugin: the
Dockerfile fetches the pinned release archive and tasks/addons/s3-uploads.yml
stages and activates it. infinito-s3-uploads is a mu_plugin that supplies what
upstream has no constant for -- the endpoint and path-style addressing -- by
hooking s3_uploads_s3_client_params, whose array Aws\\Sdk::mergeArgs forwards
verbatim to the S3 client.
The mu-plugin defines all five settings or none. S3-Uploads 3.0.10 gates on
defined() rather than on a value and drops falsy credentials from the client
params, so an empty constant buys an unsigned client instead of a fallback to
local storage.
Two defects found while reviewing this:
The release archive was fetched on every WordPress image build. vars/main.yml
resolved the URL unconditionally and compose.yml.j2 passed it as a build arg
regardless of the flag, so a GitHub outage or a retired release would turn
compose build red on every WordPress node, including ones that will never use
object storage. The variable is now empty when the addon is off and the RUN is
guarded on it, which is how nextcloud and mediawiki already gate the same kind
of fetch.
meta/addons/s3-uploads.yml declared update.monitored with no version. A missing
version makes utils/update/addons.py return the empty string, and
version_is_newer("", x) is False unconditionally, so the pin at 3.0.10 would
never have been flagged when upstream moved -- the exact input to the failure
above. The version is now declared.
With the object store off the mu-plugin returns at include scope before
defining anything, the env block in templates/env.j2 is not rendered, and the
plugin is never activated.
An inventory generated before this change carries no objstore_secret_key for
the role, which renders an empty secret and 403s at the first upload without
failing the deploy. Regenerate the inventory before deploying this.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
26 lines
976 B
Docker
26 lines
976 B
Docker
ARG WORDPRESS_IMAGE
|
|
ARG WORDPRESS_VERSION
|
|
FROM ${WORDPRESS_IMAGE}:${WORDPRESS_VERSION}
|
|
|
|
RUN rm -rf /var/lib/apt/lists/* && \
|
|
apt-get -o Acquire::Retries=3 update && \
|
|
apt-get -o Acquire::Retries=3 install -y ca-certificates msmtp msmtp-mta unzip && \
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
RUN curl --connect-timeout 5 --max-time 300 -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar && \
|
|
chmod +x wp-cli.phar && \
|
|
mv wp-cli.phar /usr/local/bin/wp
|
|
|
|
ARG WORDPRESS_S3_UPLOADS_ARCHIVE
|
|
ARG WORDPRESS_S3_UPLOADS_SRC
|
|
RUN if [ -n "${WORDPRESS_S3_UPLOADS_ARCHIVE}" ]; then \
|
|
curl -fsSL --connect-timeout 5 --max-time 300 -o /tmp/s3-uploads.zip \
|
|
"${WORDPRESS_S3_UPLOADS_ARCHIVE}" && \
|
|
mkdir -p "${WORDPRESS_S3_UPLOADS_SRC}" && \
|
|
unzip -q /tmp/s3-uploads.zip -d "${WORDPRESS_S3_UPLOADS_SRC}" && \
|
|
rm /tmp/s3-uploads.zip; \
|
|
fi
|
|
|
|
ARG WORDPRESS_CONFIG_UPLD_REL
|
|
COPY ${WORDPRESS_CONFIG_UPLD_REL} $PHP_INI_DIR/conf.d/
|