Тип сервиса
Сервис PHP (WordPress)
Среда выполнения PHP для сайтов на WordPress со сборкой из исходного кода и связями с хранилищем контента и кешем.
Этот сервис запускает ваш код: его образ собирается из Git-репозитория, а каждая сборка развёртывается в окружение.
На этой странице
Технический профиль
Версии, репозиторий исходного кода и Helm-чарт.
Стеки с этим сервисом
Публичные стеки, в которые входит этот сервис.
Сборка из исходного кода и CI/CD
Шаблоны проектов, Git-провайдеры, CI и реестры контейнеров.
Конфигурация сервиса
Тома, настройки, задачи по расписанию и связи с другими сервисами.
В StackMaster
Как PHP (WordPress) работает в StackMaster
Linked services
Links to other services reach the application as environment variables. Read them in code; do not hardcode hosts or credentials.
| Link | Variables |
|---|---|
| Database (MariaDB, MySQL or PostgreSQL) | DB_HOST, DB_PORT, DB_NAME (also DB_DATABASE), DB_USERNAME, DB_PASSWORD, DB_DRIVER (also DB_CONNECTION) |
MSMTP_HOST, MSMTP_PORT | |
| OpenTelemetry Collector | OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_PROTOCOL (http/protobuf), OTEL_EXPORTER_OTLP_HEADERS (the Collector's ingest token), OTEL_PHP_AUTOLOAD_ENABLED (true) |
Mail needs no code: PHP's mail() is delivered through the linked mail service. An SMTP library or credentials in the codebase are not required.
A variable is present only while its link exists and the linked service is enabled.
The opentelemetry extension is enabled in the image. To send traces, add the OpenTelemetry PHP SDK, the OTLP exporter and an HTTP client with Composer (open-telemetry/sdk, open-telemetry/exporter-otlp and php-http/guzzle7-adapter), plus auto-instrumentation packages for the framework if wanted; with the link, the SDK configures itself from the variables above. Set OTEL_SERVICE_NAME to name the application in traces. Without the link the SDK stays off.
Generated configuration
On every start the container writes $CONF_DIR/wodby.settings.php (normally /var/www/conf/wodby.settings.php), a $wodby array with the environment's hosts, the files directory and the linked database's connection details. Framework services built on this one extend it and include it for the application. It is outside the codebase and rewritten on start: never edit it or copy its values into the repository. In a plain PHP application, read the variables above.
PHP settings
PHP and PHP-FPM are configured through environment variables on the service, such as PHP_MEMORY_LIMIT, PHP_MAX_EXECUTION_TIME or PHP_FPM_PM_MAX_CHILDREN, not through a php.ini in the repository. A change applies with the next deployment of the service.
Environment
WODBY_HOSTSis a JSON array of the environment's hosts;WODBY_PRIMARY_HOSTandWODBY_PRIMARY_URLare the canonical ones for links generated outside a request.WODBY_ENV_TYPEtells a development environment from a production-like one.
In a development workspace
- The code is served from the checkout as it is on disk. PHP checks files for changes on every request, so an edit needs no restart.
- PHP-FPM handles requests as
wodby, the user that owns the checkout, so it reads what the developer can read and the files it writes stay editable over SSH. - Dependencies are installed by workspace setup with
composer install;/vendor/is kept out of Git status. - A change to variables or linked services still needs a deployment of the environment.
WordPress on Wodby
What Wodby sets up for a WordPress application on this service, in addition to the PHP service it is based on. Check it before adding database, URL, salt or Redis settings to wp-config.php.
What Wodby generates
On every start the container writes two files outside the codebase, from its environment variables:
$CONF_DIR/wodby.wp-config.php(normally/var/www/conf/wodby.wp-config.php): the Wodby configuration.$CONF_DIR/wp-config.php: a completewp-config.phpthat includes the file above and thenwp-settings.php.
The generic wodby.settings.php of the PHP service is removed in this image; WordPress uses wodby.wp-config.php instead. Never edit the generated files or copy their values into the repository. They hold passwords: quote constant names, not values.
The web root is the repository root, or the subdirectory named by the docroot setting of this service (variable DOCROOT_SUBDIR, web by default). WordPress core is either in the web root, or in its wp subdirectory with wp-content next to it, as in the Wodby WordPress boilerplate. In the second layout Composer installs and updates core without touching the project's themes and plugins, the site answers at the web root and core, including wp-admin, at /wp. The WordPress root below is the directory that holds core: the web root, or <web root>/wp.
Init action
On container start the service runs its init action (WODBY2_SERVICE_INIT_ACTION, here init-wordpress) against the WordPress root:
- With no
wp-config.phpthere, it creates one that includeswodby.wp-config.phpand thenwp-settings.php. - With an existing
wp-config.phpthat does not mentionwodby.wp-config.php, it inserts the include, marked// Generated by Wodby, just before the line that loadswp-settings.php. Keep that include. - It makes
wp-contentand, when present,plugins,themes,upgrade,languages,cache,wp-rocket-configandwflogsunder it writable by the web user. - It replaces
wp-content/uploadswith a link to the files volume. This fails when the directory in the codebase holds anything other than a.gitignore: keep uploads out of the repository.
What it configures
| Area | Constants | From |
|---|---|---|
| Site URL | WP_HOME, WP_SITEURL (<URL>/wp when core is in wp) | WODBY_PRIMARY_URL |
| Content directory | WP_CONTENT_DIR, WP_CONTENT_URL, only when core is in wp: the web root's wp-content | WODBY_PRIMARY_URL, DOCROOT_SUBDIR |
| Changes from wp-admin | DISALLOW_FILE_MODS, AUTOMATIC_UPDATER_DISABLED: no plugin, theme or core installs and updates, file editor or background updates, because the code is deployed as an image | WP_DISALLOW_FILE_MODS, WP_AUTOMATIC_UPDATER_DISABLED, set by this service |
| Database | DB_HOST (with the port when it is not 3306), DB_NAME, DB_USER, DB_PASSWORD, DB_CHARSET, DB_COLLATE | DB_* of the linked database, DB_CHARSET, DB_COLLATION |
| Keys and salts | AUTH_KEY, SECURE_AUTH_KEY, LOGGED_IN_KEY, NONCE_KEY and the matching *_SALT | WP_AUTH_KEY … WP_NONCE_SALT, generated by Wodby |
| Table prefix | $table_prefix | WP_TABLE_PREFIX |
| Debug | WP_DEBUG | WP_DEBUG |
| File system | FS_METHOD set to direct | — |
| Redis or Valkey | WP_REDIS_HOST, WP_REDIS_PORT, WP_REDIS_PASSWORD, WP_REDIS_DATABASE, WP_REDIS_PREFIX | REDIS_HOST, REDIS_PORT, REDIS_PASSWORD, REDIS_DATABASE, REDIS_PREFIX |
Every constant is defined only when it is not defined yet, and $table_prefix only when it is not set. A value the project defines above the Wodby include therefore wins; do not define these constants there unless an override is intended.
The file also sets $_SERVER['HTTPS'] from the X-Forwarded-Proto header and $_SERVER['REMOTE_ADDR'] from X-Real-IP, so no proxy handling is needed in wp-config.php.
Redis or Valkey object cache
A linked Redis or Valkey service sets REDIS_HOST, REDIS_PORT and REDIS_PASSWORD on this service. The WP_REDIS_* constants are defined only while REDIS_HOST is not empty. Wodby defines the connection constants and nothing else: an object cache plugin that reads WP_REDIS_*, and enabling its object cache drop-in, are the project's part.
Files
- The volume is mounted at
$FILES_DIR(/mnt/files) and shared with the web server.wp-content/uploadspoints to$FILES_DIR/public. - Only uploads are on the volume. Add plugins and themes through the repository, with Composer or as committed code; the WordPress admin does not offer to install them.
Tools and scheduled work
- WP-CLI is available as
wp. - The service declares one cron job that runs
wp cron event run --due-nowagainst the WordPress root.
Changing configuration
Set environment variables on this service (WP_DEBUG, WP_TABLE_PREFIX, REDIS_DATABASE, REDIS_PREFIX, DB_CHARSET, DB_COLLATION, and the PHP_* variables of the PHP service), or change the docroot setting. The generated files pick the values up when the container starts after the next deployment.
This service has no development workspace.
Check the result
wp eval 'echo DB_HOST, PHP_EOL, WP_HOME, PHP_EOL;' --path=<WordPress root>shows values that came through the generated file.wp eval 'var_dump(defined("WP_REDIS_HOST"));' --path=<WordPress root>tells whether the Redis constants are defined.wp db check --path=<WordPress root>confirms the database connection.
Обзор
Технический профиль PHP (WordPress)
Версии
Основан на
Репозиторий исходного кода
Публичный Helm-чарт
Постоянные тома
Стеки
Стеки, в которые входит PHP (WordPress)
CI/CD
Сборка PHP (WordPress) из Git-репозитория
Vanilla WordPress
Используйте его как есть или клонируйте в свой Git-аккаунт.
wodby/wordpress-vanillaCI-провайдеры
StackMaster CI встроен в платформу: пайплайн описывается в файле .wodby/pipeline.yml в репозитории. Для подключённого репозитория те же шаги может выполнять внешний CI-провайдер с помощью StackMaster CLI.
Реестры контейнеров
Собранные образы по умолчанию попадают в StackMaster Registry или во внешний реестр, подключённый как интеграция.
Переменные окружения из интеграций
Интеграция с переменными один раз сохраняет учётные данные стороннего сервиса. Подключите её к PHP (WordPress), и StackMaster передаст их в контейнер как переменные окружения во время работы, а не при сборке образа.
Конфигурация
Конфигурация сервиса PHP (WordPress)
Тома
Настройки
Расписания cron
Связи сервиса
Каждая связь — это подключение PHP (WordPress) к другому сервису. На какой сервис указывает связь, задаёт стек. На карточках перечислены публичные сервисы, которые подходят для каждой связи.
wp-content
Сервисы, которые подходят для этой связи
redis
Сервисы, которые подходят для этой связи
db
Сервисы, которые подходят для этой связи
sendmail
Сервисы, которые подходят для этой связи
otel
Сервисы, которые подходят для этой связи