From d844543ffa3a0f5f4457fc110944e734bf8abc8f Mon Sep 17 00:00:00 2001 From: ROBJkE Date: Wed, 16 Sep 2026 20:55:36 +0700 Subject: [PATCH] Add recipe for fyrst/shopware-cd (#2049) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add recipe for fyrst/shopware-cd Co-authored-by: ROBJkE * fix: use .yaml and 4-space indent for fyrst/shopware-cd recipe recipes-contrib QA rejects *.yml and YAML lines whose leading indent is not a multiple of 4. GitLab still defaults to .gitlab-ci.yml, so post-install.txt documents the CI/CD configuration file setting. shopware-cli already loads .shopware-project.yaml. Co-authored-by: ROBJkE * fix: point fyrst/shopware-cd recipe at fyrst-dev/shopware-cd Sync the Flex recipe from fyrst-dev/recipes (source of truth). The Packagist package repo is now https://github.com/fyrst-dev/shopware-cd instead of shopware-cd-template. Co-authored-by: ROBJkE * fix: require shopware/docker docker/Dockerfile in fyrst/shopware-cd Drop the root Dockerfile fallback so the recipe matches fyrst-dev/recipes. GitHub Actions, GitLab CI, and Compose now default DOCKERFILE to docker/Dockerfile from the shopware/docker Flex recipe. https://github.com/symfony/recipes-contrib/pull/2049 Co-authored-by: ROBJkE * fix: drop project-create overlaps; put CD compose in deploy/ shopware-cli project create owns shop-root compose.yaml, .gitignore, and .shopware-project.yaml. Move the CD stack to deploy/compose.yaml and deploy/compose.prod.yaml, and point vps-release.sh at -f deploy/compose.yaml -f deploy/compose.prod.yaml -f deploy/compose.vps.yaml. Co-authored-by: ROBJkE * feat: add VPS runtime sync (no S3) to fyrst/shopware-cd Copy live MySQL + Docker volumes onto lower envs over SSH (mysqldump + volume tars). Snapshot/restore stay on the VPS. Co-authored-by: ROBJkE * feat: bind-mount Shopware VPS runtime data by default Use SHOPWARE_DATA_ROOT host dirs for files/media/thumbnail/theme/sitemap instead of named volumes. Keep mysql_data/redis_data as named volumes. sync-runtime.sh rsyncs those host dirs as the primary copy path. Expand compose.yaml without YAML aliases (4-space .yaml). Feeds #2049. Co-authored-by: ROBJkE * feat: add local project-dev runtime rsync helper Copy live VPS SHOPWARE_DATA_ROOT trees into shopware-cli project dev paths via deploy/sync-runtime-local.sh (rsync, optional --delete). Co-authored-by: ROBJkE * feat: derive Compose project and data root from shop id + env SHOPWARE_SHOP_ID + SHOPWARE_DEPLOY_ENV drive COMPOSE_PROJECT_NAME and SHOPWARE_DATA_ROOT=/var/lib/shopware/data//. Compose no longer hardcodes name: shopware. Sync scripts auto-derive when those vars are unset. Co-authored-by: ROBJkE * feat: interpolate Compose name and bind mounts from shop id + env Compose uses ${SHOPWARE_SHOP_ID}-${SHOPWARE_DEPLOY_ENV} for the project name (required via :?) and bind-mounts ${SHOPWARE_DATA_BASE:-/var/lib/shopware/data}/${SHOPWARE_SHOP_ID}/${SHOPWARE_DEPLOY_ENV}/... COMPOSE_PROJECT_NAME and SHOPWARE_DATA_ROOT are no longer required for compose. Keep expanded YAML (no aliases) and 4-space indent for contrib QA. Co-authored-by: ROBJkE * docs: mark SHOPWARE_PACKAGES_TOKEN as optional * docs: mark SHOPWARE_PACKAGES_TOKEN optional in env and deploy README * docs: mark SHOPWARE_PACKAGES_TOKEN optional in GitLab CI comments * docs: mark SHOPWARE_PACKAGES_TOKEN optional in GitHub Actions comments * fix: E2E compose run, pull_policy override, and create .env footguns Mirror fyrst-dev/recipes overlay notes from Shopware 6.7 E2E: create writes .shopware-project.yml and COMPOSE_PROJECT_NAME=sw-shop-…; Compose v5 rejects run --no-build; same-host tag-and-load uses PULL_POLICY=never / SKIP_PULL=1 (default pull_policy stays always). Do not require SHOPWARE_PACKAGES_TOKEN. Recipe does not delete create's .env. * fix: E2E compose run, pull_policy override, and create .env footguns Mirror fyrst-dev/recipes overlay notes from Shopware 6.7 E2E: create writes .shopware-project.yml and COMPOSE_PROJECT_NAME=sw-shop-…; Compose v5 rejects run --no-build; same-host tag-and-load uses PULL_POLICY=never / SKIP_PULL=1 (default pull_policy stays always). Do not require SHOPWARE_PACKAGES_TOKEN. Recipe does not delete create's .env. * fix: E2E compose run, pull_policy override, and create .env footguns Mirror fyrst-dev/recipes overlay notes from Shopware 6.7 E2E: create writes .shopware-project.yml and COMPOSE_PROJECT_NAME=sw-shop-…; Compose v5 rejects run --no-build; same-host tag-and-load uses PULL_POLICY=never / SKIP_PULL=1 (default pull_policy stays always). Do not require SHOPWARE_PACKAGES_TOKEN. Recipe does not delete create's .env. * fix: E2E compose run, pull_policy override, and create .env footguns Mirror fyrst-dev/recipes overlay notes from Shopware 6.7 E2E: create writes .shopware-project.yml and COMPOSE_PROJECT_NAME=sw-shop-…; Compose v5 rejects run --no-build; same-host tag-and-load uses PULL_POLICY=never / SKIP_PULL=1 (default pull_policy stays always). Do not require SHOPWARE_PACKAGES_TOKEN. Recipe does not delete create's .env. * fix: E2E compose run, pull_policy override, and create .env footguns Mirror fyrst-dev/recipes overlay notes from Shopware 6.7 E2E: create writes .shopware-project.yml and COMPOSE_PROJECT_NAME=sw-shop-…; Compose v5 rejects run --no-build; same-host tag-and-load uses PULL_POLICY=never / SKIP_PULL=1 (default pull_policy stays always). Do not require SHOPWARE_PACKAGES_TOKEN. Recipe does not delete create's .env. * feat: Flex env SoT keys and deploy/init-env.sh after create Mirror fyrst-dev/recipes: Flex env appends safe CD keys; operators finish shop-specific values with deploy/init-env.sh --shop-id (VPS: --vps). * feat: register FyrstShopwareCdBundle in Flex recipe * feat: add slim bash guards for fyrst:sales-channel:rewrite-urls * docs: document console rewrite and Flex bundle for shops * docs: point contrib sync rewrite at fyrst:sales-channel:rewrite-urls * docs: mention console rewrite in contrib deploy README * feat(shopware-cd): call fyrst:sales-channel:rewrite-urls after restore * feat: dump VPS snapshots with shopware-cli project dump * feat: dump VPS snapshots with shopware-cli project dump * feat: dump VPS snapshots with shopware-cli project dump * feat: dump VPS snapshots with shopware-cli project dump * feat: dump VPS snapshots with shopware-cli project dump * feat: add deploy/lib/identity.sh for shopware-cd sync split * feat: add remaining deploy/lib helpers for shopware-cd sync split * feat: add sync-live and sync-app libs for shopware-cd split * feat: add sync-identity and sync-ssh libs for shopware-cd split * refactor: thin sync-runtime.sh CLI and slim rewrite lib * fix: match deploy/lib/sync-rewrite.sh to fyrst-dev/recipes main * feat: add deploy/lib/sync-volumes.sh for shopware-cd split * feat: add deploy/lib/sync-commands.sh for shopware-cd split * feat: add deploy/lib/sync-db.sh for shopware-cd split * fix: slim fyrst/shopware-cd recipe to copy-from-package Honor diimpp's review on #2049. Recipe is Flex metadata only (manifest + post-install). Overlay files come from vendor/fyrst/shopware-cd/overlay/. Toast uses fyrst-cli 0.1.0+; do not ship bash wrappers. * fix: drop fyrst/shopware-cd recipe root overlay * fix: drop fyrst/shopware-cd recipe root overlay * fix: drop fyrst/shopware-cd recipe root overlay * fix: drop fyrst/shopware-cd recipe root overlay * fix: drop fyrst/shopware-cd recipe root overlay * fix: drop fyrst/shopware-cd recipe root overlay * fix: drop fyrst/shopware-cd recipe root overlay * fix: drop fyrst/shopware-cd recipe root overlay * fix: drop fyrst/shopware-cd recipe root overlay * fix: drop fyrst/shopware-cd recipe root overlay * fix: drop fyrst/shopware-cd recipe root overlay * fix: drop fyrst/shopware-cd recipe root overlay * fix: drop fyrst/shopware-cd recipe root overlay * fix: drop fyrst/shopware-cd recipe root overlay * fix: drop fyrst/shopware-cd recipe root overlay * fix: drop fyrst/shopware-cd recipe root overlay * fix: drop fyrst/shopware-cd recipe root overlay * fix: drop fyrst/shopware-cd recipe root overlay * fix: drop fyrst/shopware-cd recipe root overlay * fix: drop fyrst/shopware-cd recipe root overlay * fix: drop fyrst/shopware-cd recipe root overlay * fix: drop fyrst/shopware-cd recipe root overlay * fix: drop fyrst/shopware-cd recipe root overlay * fix: drop fyrst/shopware-cd recipe root overlay * fix: drop fyrst/shopware-cd recipe root overlay * fix: drop fyrst/shopware-cd recipe root overlay * fix: drop fyrst/shopware-cd recipe root overlay * fix: drop fyrst/shopware-cd recipe root overlay --------- Co-authored-by: Cursor Agent Co-authored-by: ROBJkE --- fyrst/shopware-cd/1.0/manifest.json | 15 +++ fyrst/shopware-cd/1.0/post-install.txt | 124 +++++++++++++++++++++++++ 2 files changed, 139 insertions(+) create mode 100644 fyrst/shopware-cd/1.0/manifest.json create mode 100644 fyrst/shopware-cd/1.0/post-install.txt diff --git a/fyrst/shopware-cd/1.0/manifest.json b/fyrst/shopware-cd/1.0/manifest.json new file mode 100644 index 00000000..4688fc46 --- /dev/null +++ b/fyrst/shopware-cd/1.0/manifest.json @@ -0,0 +1,15 @@ +{ + "copy-from-package": { + "overlay/": "" + }, + "bundles": { + "Fyrst\\ShopwareCd\\FyrstShopwareCdBundle": [ + "all" + ] + }, + "env": { + "SHOPWARE_SHOP_ID": "", + "SHOPWARE_DEPLOY_ENV": "live", + "SHOPWARE_DATA_BASE": "/var/lib/shopware/data" + } +} diff --git a/fyrst/shopware-cd/1.0/post-install.txt b/fyrst/shopware-cd/1.0/post-install.txt new file mode 100644 index 00000000..26e12ded --- /dev/null +++ b/fyrst/shopware-cd/1.0/post-install.txt @@ -0,0 +1,124 @@ + * fyrst/shopware-cd + Flex copied CD files from the package + overlay/ into the shop root: CI, + deploy/ (including CD Compose), .dockerignore, + and .env.example + (same idea as shopware/docker copying docker/Dockerfile). + + compose.yaml, .gitignore, and + .shopware-project.yml (create’s default; + .shopware-project.yaml is also accepted — do not rename) + are owned by + shopware-cli project create / the CLI — not this recipe. + + Local: shopware-cli project dev and the CLI-managed + shop-root compose.yaml. + VPS/CD: files under deploy/ + (deploy/compose.yaml, deploy/compose.prod.yaml, + deploy/compose.vps.yaml). + Runtime DB/bind-mount copy between VPS hosts: + fyrst-cli shopware sync pull + (see deploy/sync-runtime.md). + DB snapshots use shopware-cli project dump + (fyrst-cli never dumps; restore is + fyrst-cli shopware db import). + Live backups (not sync): + fyrst-cli shopware backup create + (see deploy/backup-runtime.md). + Rollback: + IMAGE_TAG=$(cat .previous-tag) fyrst-cli shopware deploy rollback. + Each VPS needs fyrst-cli 0.1.0+ + (https://github.com/fyrst-dev/cli). + CI runs fyrst-cli shopware deploy release + with IMAGE / IMAGE_TAG / + COMPOSE_DIR. + TLS edge: deploy/edge/Caddyfile. + Live → local project dev rsync (no DB): + fyrst-cli shopware sync local + (reads SHOPWARE_SHOP_ID from local .env; + remote root /var/lib/shopware/data/${SHOPWARE_SHOP_ID}/live; + --data all is refused). + + Flex may append a ###> fyrst/shopware-cd ### + block to shop-root .env (empty + SHOPWARE_SHOP_ID, SHOPWARE_DEPLOY_ENV=live, + SHOPWARE_DATA_BASE=/var/lib/shopware/data). + It does not overwrite create’s whole .env + and does not put secrets in that block. Then run + fyrst-cli shopware env init --shop-id … + (see deploy/README). + VPS .env source of truth (required): + SHOPWARE_SHOP_ID (same slug on live + staging + laptop), + SHOPWARE_DEPLOY_ENV (live|staging|playground|dev). + Compose derives project name + (${SHOPWARE_SHOP_ID}-${SHOPWARE_DEPLOY_ENV}) + and bind-mount paths from those two plus optional + SHOPWARE_DATA_BASE (default + /var/lib/shopware/data) — three separate interpolations, + no nested defaults. It does not require + COMPOSE_PROJECT_NAME or SHOPWARE_DATA_ROOT + (optional for scripts/docs; fyrst-cli derives when unset and prefers them + when set — do not assign them empty). + WARNING: shopware-cli project create writes + COMPOSE_PROJECT_NAME=sw-shop-… into shop-root + .env for local project dev. That env var + overrides Compose name: + (${SHOPWARE_SHOP_ID}-${SHOPWARE_DEPLOY_ENV}). + On the VPS, comment out that line + (fyrst-cli shopware env init --vps or by hand). + Flex does not delete it on composer require + (create owns the local flow). + Bootstrap: + DATA="${SHOPWARE_DATA_BASE:-/var/lib/shopware/data}/${SHOPWARE_SHOP_ID}/${SHOPWARE_DEPLOY_ENV}" + then mkdir -p "${DATA}"/{files,media,thumbnail,theme,sitemap} + then chown -R 82:82 "${DATA}". + Live profiles: uncomment + COMPOSE_PROFILES=redis,worker,scheduler + in .env (worker + scheduler; redis if used). Staging leaves + this unset unless you need async tasks. + fyrst-cli shopware deploy release warns on live when it is empty; it does + not auto-enable. + Same-host tag-and-load / air-gap: PULL_POLICY=never + and SKIP_PULL=1 (or + fyrst-cli shopware deploy release --skip-pull). Default + pull_policy is always for CI/VPS. + Several shops or live+staging on one VPS share the host; shop id + env + keep stacks isolated. + + You MUST require shopware/docker in the same Composer command as + this package. That recipe copies docker/Dockerfile, which CI and + CD Compose require (default DOCKERFILE=docker/Dockerfile). This recipe + does not ship a root Dockerfile. A missing docker/Dockerfile + means shopware/docker was skipped. + + Flex may append SoT keys to .env; it does not + overwrite create’s whole .env. Then run + fyrst-cli shopware env init --shop-id … + (VPS: add --vps; see deploy/README). + If .env is missing, that command copies + .env.example first. Commit the copied files; + vendor/ is gitignored. + + shopware-cli project create writes .shopware-project.yml + (that extension is fine). shopware-cli accepts both + .yml and .yaml; do not rename. + GitHub Actions picks up + .github/workflows/cd.yaml. GitLab still defaults to + .gitlab-ci.yml: set Settings → CI/CD → CI/CD configuration file + to .gitlab-ci.yaml (or copy/symlink that name). + + Flex registers + Fyrst\ShopwareCd\FyrstShopwareCdBundle + in config/bundles.php. + Post-restore sales-channel URL rewrite uses + APP_URL in shop-root .env; + sync calls + bin/console fyrst:sales-channel:rewrite-urls. + Laptop SSH (SHOPWARE_SSH_*) belongs in + .env.local. + Shops need composer update fyrst/shopware-cd + so the command and bundle exist, then + composer recipes:update fyrst/shopware-cd. + + Refresh later with composer recipes:update fyrst/shopware-cd. + See https://github.com/fyrst-dev/shopware-cd