Week 1 infrastructure: Docker environments, deploy pipeline, bookstore-core scaffold
Docker Compose environments for dev/staging/production (MariaDB, Redis, Caddy, Action Scheduler cron sidecar), an idempotent deploy script, git-hook-based deploy pipeline, backup/restore scripts, and the bookstore-core plugin stub with WooCommerce HPOS compatibility declared. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
:80 {
|
||||
root * /var/www/html
|
||||
|
||||
request_body {
|
||||
max_size 32MB
|
||||
}
|
||||
|
||||
php_fastcgi wordpress:9000
|
||||
file_server
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
{$SITE_DOMAIN} {
|
||||
encode gzip
|
||||
|
||||
root * /var/www/html
|
||||
|
||||
@no_cache path /cart* /checkout* /my-account* /wp-admin* /wp-login.php
|
||||
header @no_cache Cache-Control "no-store, no-cache, must-revalidate"
|
||||
|
||||
request_body {
|
||||
max_size 32MB
|
||||
}
|
||||
|
||||
php_fastcgi wordpress:9000
|
||||
file_server
|
||||
|
||||
log {
|
||||
output file /data/access.log {
|
||||
roll_size 50MiB
|
||||
roll_keep 10
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
{$SITE_DOMAIN} {
|
||||
encode gzip
|
||||
|
||||
# Launch gate: "No staging URLs are publicly indexed." Belt-and-suspenders
|
||||
# with wp_option blog_public=0, which deploy.sh sets on staging.
|
||||
basic_auth {
|
||||
{$STAGING_BASIC_AUTH_USER} {$STAGING_BASIC_AUTH_HASH}
|
||||
}
|
||||
header X-Robots-Tag "noindex, nofollow, noarchive"
|
||||
|
||||
root * /var/www/html
|
||||
|
||||
@no_cache path /cart* /checkout* /my-account* /wp-admin* /wp-login.php
|
||||
header @no_cache Cache-Control "no-store, no-cache, must-revalidate"
|
||||
|
||||
request_body {
|
||||
max_size 32MB
|
||||
}
|
||||
|
||||
php_fastcgi wordpress:9000
|
||||
file_server
|
||||
}
|
||||
Executable
+14
@@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
# System-cron replacement for Action Scheduler / WP-Cron (design doc §01).
|
||||
# WORDPRESS_CONFIG_EXTRA sets DISABLE_WP_CRON, so this loop is the only
|
||||
# thing driving scheduled events in every environment.
|
||||
set -eu
|
||||
|
||||
echo "bookstore-core cron sidecar starting (60s interval)"
|
||||
|
||||
while true; do
|
||||
if ! wp cron event run --due-now --path=/var/www/html --allow-root 2>/tmp/cron-last-error.log; then
|
||||
echo "cron run failed: $(cat /tmp/cron-last-error.log)"
|
||||
fi
|
||||
sleep 60
|
||||
done
|
||||
@@ -0,0 +1,23 @@
|
||||
# PHP-FPM + WordPress core, plus the tooling deploy.sh and the cron
|
||||
# sidecar need: wp-cli, composer, and the redis extension for object cache.
|
||||
FROM wordpress:php8.3-fpm
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
git \
|
||||
unzip \
|
||||
less \
|
||||
default-mysql-client \
|
||||
&& pecl install redis \
|
||||
&& docker-php-ext-enable redis \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
|
||||
|
||||
RUN curl -o /usr/local/bin/wp -sSL \
|
||||
https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar \
|
||||
&& chmod +x /usr/local/bin/wp
|
||||
|
||||
COPY php.ini /usr/local/etc/php/conf.d/zz-bookstore.ini
|
||||
|
||||
WORKDIR /var/www/html
|
||||
@@ -0,0 +1,13 @@
|
||||
[PHP]
|
||||
upload_max_filesize = 32M
|
||||
post_max_size = 32M
|
||||
memory_limit = 256M
|
||||
max_execution_time = 120
|
||||
max_input_vars = 3000
|
||||
|
||||
[opcache]
|
||||
opcache.enable = 1
|
||||
opcache.memory_consumption = 128
|
||||
opcache.max_accelerated_files = 10000
|
||||
opcache.validate_timestamps = 1
|
||||
opcache.revalidate_freq = 2
|
||||
Reference in New Issue
Block a user