Skip to content

feat: add LOCK_DSN support, rework probes & optimize php settings - #227

Merged
Kevin Rudde (kevinrudde) merged 2 commits into
mainfrom
performance
Jul 31, 2026
Merged

feat: add LOCK_DSN support, rework probes & optimize php settings#227
Kevin Rudde (kevinrudde) merged 2 commits into
mainfrom
performance

Conversation

@kevinrudde

@kevinrudde Kevin Rudde (kevinrudde) commented Jul 29, 2026

Copy link
Copy Markdown
Member

This pull request introduces several improvements and fixes related to configuration, environment variable management, and deployment health checks for the Shopware operator. The most significant changes include the addition of a configurable lock store, improved handling of environment variables for PHP opcache and database connections, and more robust health probes for the storefront deployment.

Lock Store Configuration:

  • Added a new LockSpec to StoreSpec, allowing configuration of Symfony's lock store with support for both builtin (per-pod flock) and redis (shared across pods) adapters. This ensures safe locking in multi-replica setups and sets the LOCK_DSN environment variable when needed. (api/v1/store.go, api/v1/store_env.go, api/v1/zz_generated.deepcopy.go) [1] [2] [3] [4] [5] [6]

Environment Variable Improvements:

  • Increased PHP opcache limits to better fit Shopware's needs, preventing cache overflow and improving performance. (api/v1/store_env.go)
  • Changed the default for DATABASE_PERSISTENT_CONNECTION to "0" for storefront/admin deployments to avoid hoarding DB connections, with workers explicitly overriding this to "1" for their long-lived processes. (api/v1/store_env.go, internal/deployment/worker.go) [1] [2]

Deployment Probes and Health Checks:

  • Storefront deployment now uses php-fpm's /‐/fpm/ping endpoint on a dedicated admin port (8001) for startup and liveness probes, decoupling pod restarts from database issues and ensuring readiness only after opcache preloading. (internal/deployment/storefront.go) [1] [2]

Merging Logic Fixes:

  • Fixed ContainerSpec.Merge to append VolumeMounts and Volumes instead of overwriting, preserving existing configuration when merging. (api/v1/store.go)

These changes enhance the robustness, safety, and performance of Shopware deployments, particularly in multi-replica and high-load scenarios.

@kevinrudde
Kevin Rudde (kevinrudde) marked this pull request as ready for review July 29, 2026 12:53
@kevinrudde Kevin Rudde (kevinrudde) changed the title fix: rework probes feat: add LOCK_DSN support, rework probes & optimize php settings Jul 29, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances Shopware operator configuration and deployment health behavior by adding Symfony lock-store configuration (via LOCK_DSN), adjusting default PHP/database environment tuning, and changing storefront probes to rely on php-fpm’s ping endpoint for more resilient pod restarts under DB pressure.

Changes:

  • Add spec.lock (LockSpec) and emit LOCK_DSN when using the Redis adapter.
  • Update default envs (opcache sizing; default DATABASE_PERSISTENT_CONNECTION=0) and override to =1 in the worker deployment.
  • Rework storefront startup/liveness probes to use /-/fpm/ping on a dedicated admin port (8001), keeping readiness DB-aware.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
internal/deployment/worker.go Adds worker-specific env defaults (persistent DB connections) layered over shared env.
internal/deployment/storefront.go Introduces FPM admin port constant and switches startup/liveness probes to /-/fpm/ping on port 8001.
api/v1/zz_generated.deepcopy.go Adds deepcopy support for the new LockSpec and copies it in StoreSpec.
api/v1/store.go Adds LockSpec to StoreSpec and changes ContainerSpec.Merge volume/volumeMount handling to append.
api/v1/store_env.go Emits LOCK_DSN for Redis lock adapter; increases opcache defaults; changes default DB persistent connection behavior.
Files not reviewed (1)
  • api/v1/zz_generated.deepcopy.go: Generated file

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread api/v1/store.go
Comment thread api/v1/store.go
Comment thread internal/deployment/storefront.go

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 11 changed files in this pull request and generated 2 comments.

Files not reviewed (1)
  • api/v1/zz_generated.deepcopy.go: Generated file
Comments suppressed due to low confidence (2)

api/v1/store_env.go:393

  • OTEL_PHP_EXCLUDED_URLS is intended to exclude the readiness probe (/api/_info/health-check) and fpm-admin endpoints, but the configured value lacks the leading slashes (current probes use "/api/_info/health-check" and "/-/fpm/ping"). This likely prevents the exclusion from matching the actual request paths.
			// Skip tracing probe/monitoring requests entirely (no span, no export).
			// The readiness probe (/api/_info/health-check) and the fpm-admin
			// endpoints hit workers frequently; tracing them stalls workers on span
			// export, inflating php-fpm active_processes and breaking autoscaling.
			{
				Name:  "OTEL_PHP_EXCLUDED_URLS",
				Value: "api/_info/health-check,-/fpm/",
			},

api/v1/store_env.go:585

  • SQL_SET_DEFAULT_SESSION_VARIABLES is no longer set in GetEnv() (it appears to have been replaced by the new opcache sizing envs). If the Shopware image default for this setting is not already "0", this changes runtime behavior implicitly. If the intent is to keep the previous behavior, re-add the env var alongside the new opcache settings.
		{
			Name:  "PHP_OPCACHE_MAX_ACCELERATED_FILES",
			Value: "20000",
		},

Comment thread api/v1/store.go
Comment thread api/v1/store.go
Comment thread internal/deployment/storefront.go Outdated
Comment thread internal/deployment/storefront.go Outdated
@kevinrudde
Kevin Rudde (kevinrudde) merged commit 80d7946 into main Jul 31, 2026
4 checks passed
@kevinrudde
Kevin Rudde (kevinrudde) deleted the performance branch July 31, 2026 07:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants