From 757092014cee50804eb8386906557681d778e18b Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Mon, 14 Sep 2026 05:54:55 +0000 Subject: [PATCH] docs: point operators at fyrst-cli 0.1.0 and recipe wrappers Align README/CREATE with the merged Flex cutover (recipes#33). This package stays the rewrite command; deploy/sync/backup stay in fyrst-cli plus thin recipe wrappers. Dump stays shopware-cli. Co-authored-by: ROBJkE --- CREATE.md | 33 +++++++++------- README.md | 86 +++++++++++++++++++++++++----------------- composer.json | 2 +- tests/package.test.php | 47 ++++++++++++++++++++++- 4 files changed, 118 insertions(+), 50 deletions(-) diff --git a/CREATE.md b/CREATE.md index 5386396..40a22ed 100644 --- a/CREATE.md +++ b/CREATE.md @@ -2,11 +2,11 @@ Use with the locked process: [Shopware Create & Continuous Deploy](https://app.clickup.com/90151931897/docs/2kyqjkzt-915). Full narrative is in [README.md](README.md). -**Default path is near-native Shopware:** `shopware-cli` + Flex endpoint + `composer require` + Symfony Flex. No git submodule. No fyrst create/apply CLI. +**Default path is near-native Shopware:** `shopware-cli` + Flex endpoint + `composer require` + Symfony Flex + [fyrst-cli](https://github.com/fyrst-dev/cli) **0.1.0+**. No git submodule. No fyrst create/apply CLI in this package. -This package (`fyrst/shopware-cd`) is a thin Packagist library. It ships Symfony bundle `FyrstShopwareCdBundle` and `bin/console fyrst:sales-channel:rewrite-urls`. It does **not** contain overlay files; Flex loads them from [`fyrst-dev/recipes`](https://github.com/fyrst-dev/recipes). There is **no** Composer dependency on that recipes repo. Shops need `composer update fyrst/shopware-cd` for the command. +This package (`fyrst/shopware-cd`) is a thin Packagist library. It ships Symfony bundle `FyrstShopwareCdBundle` and `bin/console fyrst:sales-channel:rewrite-urls`. It does **not** contain overlay files and does **not** own deploy/sync/backup pipeline logic. Flex loads CI, CD Compose under `deploy/`, and thin wrappers from [`fyrst-dev/recipes`](https://github.com/fyrst-dev/recipes); those wrappers `exec` fyrst-cli. **Dump stays `shopware-cli project dump`.** There is **no** Composer dependency on that recipes repo. Shops need `composer update fyrst/shopware-cd` for the command. -`shopware-cli project create` owns `compose.yaml`, `.gitignore`, `.shopware-project.yml` (create’s default; `.yaml` is also accepted — do not rename), and local Docker. The fyrst Flex recipe does **not** copy those. Flex copies CI, `.dockerignore`, `.env.example`, and `deploy/` (CD Compose plus `deploy/init-env.sh`, `deploy/sync-runtime.sh` for VPS and `deploy/sync-runtime-local.sh` for local `shopware-cli project dev`). The Flex `env` configurator may **append** a `###> fyrst/shopware-cd ###` SoT block to `.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. +`shopware-cli project create` owns `compose.yaml`, `.gitignore`, `.shopware-project.yml` (create’s default; `.yaml` is also accepted — do not rename), and local Docker. The fyrst Flex recipe does **not** copy those. Flex copies CI, `.dockerignore`, `.env.example`, and `deploy/` (CD Compose plus thin wrappers `deploy/init-env.sh`, `deploy/vps-release.sh`, `deploy/vps-rollback.sh`, `deploy/sync-runtime.sh` for VPS, `deploy/sync-runtime-local.sh` for local `shopware-cli project dev`, `deploy/backup-runtime.sh`). The Flex `env` configurator may **append** a `###> fyrst/shopware-cd ###` SoT block to `.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. Shops **must** `composer require shopware/docker` on the same line as `fyrst/shopware-cd`. The image build file is always `docker/Dockerfile`. @@ -22,7 +22,10 @@ cd composer config extra.symfony.allow-contrib true composer config --json extra.symfony.endpoint '["https://raw.githubusercontent.com/fyrst-dev/recipes/flex/main/index.json","https://raw.githubusercontent.com/shopware/recipes/flex/main/index.json","flex://defaults"]' composer require shopware/docker shopware/deployment-helper fyrst/shopware-cd +# each VPS / laptop: fyrst-cli 0.1.0+ (wrappers exec it) +curl -fsSL https://raw.githubusercontent.com/fyrst-dev/cli/main/scripts/install.sh | bash bash deploy/init-env.sh --shop-id +# same as: fyrst-cli shopware env init --shop-id # VPS: bash deploy/init-env.sh --shop-id --vps ``` @@ -33,14 +36,15 @@ Prefer Composer inside the web container when it is running: `docker compose exe - [ ] `extra.symfony.endpoint` is **fyrst-dev/recipes**, then shopware/recipes, then `flex://defaults` — set **before** `composer require` - [ ] Flex dropped `docker/Dockerfile` from `shopware/docker` (required; same `composer require` as `fyrst/shopware-cd`) - [ ] CI `DOCKERFILE=docker/Dockerfile` (or default to that). Do not add a shop-root `Dockerfile`. -- [ ] Flex copied `.github/workflows/cd.yaml`, `.gitlab-ci.yaml`, `.dockerignore`, `.env.example`, `deploy/` (`deploy/compose.yaml`, `deploy/compose.prod.yaml`, `deploy/compose.vps.yaml`, `deploy/init-env.sh`, `deploy/sync-runtime.sh`, `deploy/sync-runtime-local.sh`) +- [ ] Flex copied `.github/workflows/cd.yaml`, `.gitlab-ci.yaml`, `.dockerignore`, `.env.example`, `deploy/` (`deploy/compose.yaml`, `deploy/compose.prod.yaml`, `deploy/compose.vps.yaml`, thin wrappers `deploy/init-env.sh`, `deploy/vps-release.sh`, `deploy/sync-runtime.sh`, `deploy/sync-runtime-local.sh` that `exec` fyrst-cli 0.1.0+) +- [ ] fyrst-cli **0.1.0+** is on `PATH` on each VPS and laptop (`scripts/install.sh`). Wrappers fail without it. - [ ] VPS deploy uses `deploy/compose.yaml` + `deploy/compose.prod.yaml` + `deploy/compose.vps.yaml`, not the CLI-managed root `compose.yaml` - [ ] Copied overlay files **committed** in the shop (`vendor/` is gitignored) -- [ ] Flex may have appended a `###> fyrst/shopware-cd ###` SoT block to `.env` (empty shop id). It does **not** overwrite create’s whole `.env`. Ran `bash deploy/init-env.sh --shop-id ` (see `deploy/README.md`) +- [ ] Flex may have appended a `###> fyrst/shopware-cd ###` SoT block to `.env` (empty shop id). It does **not** overwrite create’s whole `.env`. Ran `bash deploy/init-env.sh --shop-id ` (`fyrst-cli shopware env init`; see `deploy/README.md`) - [ ] Identity (locked hybrid): required `SHOPWARE_SHOP_ID` (stable shop slug, same on live/staging/laptop) + `SHOPWARE_DEPLOY_ENV` (`live` / `staging` / …). Optional `SHOPWARE_DATA_BASE`. `COMPOSE_PROJECT_NAME` and `SHOPWARE_DATA_ROOT` are **optional** — Docker Compose and sync derive `COMPOSE_PROJECT_NAME=${SHOPWARE_SHOP_ID}-${SHOPWARE_DEPLOY_ENV}` and `SHOPWARE_DATA_ROOT=${SHOPWARE_DATA_BASE:-/var/lib/shopware/data}/${SHOPWARE_SHOP_ID}/${SHOPWARE_DEPLOY_ENV}`. Compose uses those SoT vars directly. Do not hardcode Compose project name `shopware`. -- [ ] VPS `.env` does **not** keep create’s `COMPOSE_PROJECT_NAME=sw-shop-…` line (that **overrides** Compose `name:`). Comment it out with `bash deploy/init-env.sh --vps` (or by hand). Flex does not delete it on `composer require` (create owns local `project dev`). -- [ ] Same-host tag-and-load / air-gap: `PULL_POLICY=never` and `SKIP_PULL=1` (or `bash deploy/vps-release.sh --skip-pull`). Default `pull_policy` is `always` after CI pushed the tag. -- [ ] Runtime DB + media/files stay **out of git** and **out of the image**. VPS **bind mounts** under the derived shop/env root (default `/var/lib/shopware/data/${SHOPWARE_SHOP_ID}/${SHOPWARE_DEPLOY_ENV}/{files,media,thumbnail,theme,sitemap}`). Named volumes remain only for `mysql_data` / `redis_data` (scoped by the derived Compose project name). VPS env copy is `deploy/sync-runtime.sh` (SSH + dump + rsync of those host dirs; paths from shop id + deploy env). **No S3.** Local `shopware-cli project dev` uses `deploy/sync-runtime-local.sh` (rsync path remap into `files/` and `public/{media,thumbnail,theme,sitemap}`; remote auto `/var/lib/shopware/data/${SHOPWARE_SHOP_ID}/live`) — **not** `deploy/sync-runtime.sh`. +- [ ] VPS `.env` does **not** keep create’s `COMPOSE_PROJECT_NAME=sw-shop-…` line (that **overrides** Compose `name:`). Comment it out with `bash deploy/init-env.sh --vps` (or `fyrst-cli shopware env init --vps`, or by hand). Flex does not delete it on `composer require` (create owns local `project dev`). +- [ ] Same-host tag-and-load / air-gap: `PULL_POLICY=never` and `SKIP_PULL=1` (or `bash deploy/vps-release.sh --skip-pull` / `fyrst-cli shopware deploy release --skip-pull`). Default `pull_policy` is `always` after CI pushed the tag. +- [ ] Runtime DB + media/files stay **out of git** and **out of the image**. VPS **bind mounts** under the derived shop/env root (default `/var/lib/shopware/data/${SHOPWARE_SHOP_ID}/${SHOPWARE_DEPLOY_ENV}/{files,media,thumbnail,theme,sitemap}`). Named volumes remain only for `mysql_data` / `redis_data` (scoped by the derived Compose project name). VPS env copy is `deploy/sync-runtime.sh` → `fyrst-cli shopware sync {capture|apply|pull}` (SSH + dump + rsync of those host dirs; dump is `shopware-cli project dump`; paths from shop id + deploy env). **No S3.** Local `shopware-cli project dev` uses `deploy/sync-runtime-local.sh` → `fyrst-cli shopware sync local` (rsync path remap into `files/` and `public/{media,thumbnail,theme,sitemap}`; remote auto `/var/lib/shopware/data/${SHOPWARE_SHOP_ID}/live`; `--data all` dropped) — **not** `deploy/sync-runtime.sh`. - [ ] VPS: `mkdir -p "$SHOPWARE_DATA_ROOT"/{files,media,thumbnail,theme,sitemap}` and `chown` to uid 82 (www-data in docker-base) — shop/env root derived from shop id + deploy env, not a global `/var/lib/shopware/data` If Flex did not copy files, the shop is missing the [fyrst-dev/recipes](https://github.com/fyrst-dev/recipes) endpoint. See [README.md](README.md). Refresh later with `composer recipes:update fyrst/shopware-cd`. @@ -57,15 +61,15 @@ Fill placeholders — never commit values. - [ ] CI: `SSH_PRIVATE_KEY`, `VPS_HOST`, `VPS_USER`, `VPS_PATH` (Compose primary) - [ ] CI: `SSH_KNOWN_HOSTS` (recommended) - [ ] Runtime: `APP_URL`, `APP_SECRET`, `DATABASE_URL` -- [ ] Runtime: `SHOPWARE_SHOP_ID` (stable shop slug) — **required** (`bash deploy/init-env.sh --shop-id `) +- [ ] Runtime: `SHOPWARE_SHOP_ID` (stable shop slug) — **required** (`bash deploy/init-env.sh --shop-id ` / `fyrst-cli shopware env init`) - [ ] Runtime: `SHOPWARE_DEPLOY_ENV` (`live` / `staging` / …) — **required** - [ ] Optional: `SHOPWARE_DATA_BASE` (prefix `/var/lib/shopware/data` when unset) - [ ] Optional: `COMPOSE_PROJECT_NAME` / `SHOPWARE_DATA_ROOT` — Compose and sync derive `COMPOSE_PROJECT_NAME=${SHOPWARE_SHOP_ID}-${SHOPWARE_DEPLOY_ENV}` and `/var/lib/shopware/data/${SHOPWARE_SHOP_ID}/${SHOPWARE_DEPLOY_ENV}` when unset. Compose uses those SoT vars directly. Do **not** leave create’s `COMPOSE_PROJECT_NAME=sw-shop-…` on the VPS. - [ ] Runtime: `INSTALL_ADMIN_USERNAME` / `INSTALL_ADMIN_PASSWORD` / `INSTALL_ADMIN_EMAIL` (first install only) - [ ] Planned only: managed host (`deploy/managed/README.md`) is **not implemented**. Do not set `DEPLOY_TARGET=managed` expecting a deploy. - [ ] **Live:** uncomment `COMPOSE_PROFILES=redis,worker,scheduler` in `.env` (worker + scheduler; redis if used). Leave unset on staging unless you need async/scheduled tasks. Release warns on live when empty; it does not auto-enable. -- [ ] Optional: on staging/playground/dev, copy `deploy/sync.env.example` → `deploy/sync.env` (`SYNC_SSH_*` to live, `SYNC_ENV` = this env). Cron `deploy/sync-runtime.sh` **on the consumer** (live → this env). Script uses shop id + deploy env (source default: same shop id + `live`) unless `SHOPWARE_DATA_ROOT` / `SYNC_REMOTE_DATA_ROOT` override. Opt-in sales-channel rewrite: `SYNC_REWRITE_APP_URL` / `bin/console fyrst:sales-channel:rewrite-urls` after `composer update fyrst/shopware-cd` (default off; refused on live; `SYNC_ALLOW_LIVE_RESTORE=1` does not bypass). Review payment/shipping webhooks after a live pull. Never commit filled `deploy/sync.env`. Never auto-push into live. `deploy/init-env.sh` stays bash — it is not a console command. -- [ ] Optional: on a laptop, set `SHOPWARE_SHOP_ID` (same as live) and pull live media/files into `shopware-cli project dev` with `bash deploy/sync-runtime-local.sh --from live --data all` (remote auto `/var/lib/shopware/data/${SHOPWARE_SHOP_ID}/live` → `files/` and `public/{media,thumbnail,theme,sitemap}`). Do **not** use `deploy/sync-runtime.sh` locally. +- [ ] Optional: on staging/playground/dev, copy `deploy/sync.env.example` → `deploy/sync.env` (`SYNC_SSH_*` to live, `SYNC_ENV` = this env). Cron `deploy/sync-runtime.sh` **on the consumer** (live → this env; execs `fyrst-cli shopware sync pull`). Uses shop id + deploy env (source default: same shop id + `live`) unless `SHOPWARE_DATA_ROOT` / `SYNC_REMOTE_DATA_ROOT` override. Dump is `shopware-cli project dump`. Opt-in sales-channel rewrite: `SYNC_REWRITE_APP_URL` / `bin/console fyrst:sales-channel:rewrite-urls` after `composer update fyrst/shopware-cd` (default off; refused on live; `SYNC_ALLOW_LIVE_RESTORE=1` does not bypass). Review payment/shipping webhooks after a live pull. Never commit filled `deploy/sync.env`. Never auto-push into live. `deploy/init-env.sh` is a recipe wrapper for `fyrst-cli shopware env init` — it is not a console command in this package. +- [ ] Optional: on a laptop, set `SHOPWARE_SHOP_ID` (same as live) and pull live media/files into `shopware-cli project dev` with `bash deploy/sync-runtime-local.sh --from live` (`fyrst-cli shopware sync local`; remote auto `/var/lib/shopware/data/${SHOPWARE_SHOP_ID}/live` → `files/` and `public/{media,thumbnail,theme,sitemap}`; `--data all` dropped). Do **not** use `deploy/sync-runtime.sh` locally. ## First pipeline @@ -73,11 +77,14 @@ Fill placeholders — never commit values. - [ ] Build → push `:sha` (+ `:latest` on `main`) succeeds - [ ] Deploy job SSHs to the VPS, pulls, Compose up, one-shot setup - [ ] Storefront + admin + health/smoke URL verified -- [ ] Document shop-specific overrides (external DB, search, CDN) in the shop repo README. Default VPS path has **no S3** — media/files stay on host bind mounts under `/var/lib/shopware/data/${SHOPWARE_SHOP_ID}/${SHOPWARE_DEPLOY_ENV}` (Compose/sync derive that; `SHOPWARE_DATA_ROOT` is optional); live → staging/playground/dev uses `deploy/sync-runtime.sh` (shop id + deploy env). Local `shopware-cli project dev` uses `deploy/sync-runtime-local.sh` (remote auto from `SHOPWARE_SHOP_ID` + `live`). +- [ ] Document shop-specific overrides (external DB, search, CDN) in the shop repo README. Default VPS path has **no S3** — media/files stay on host bind mounts under `/var/lib/shopware/data/${SHOPWARE_SHOP_ID}/${SHOPWARE_DEPLOY_ENV}` (Compose/sync derive that; `SHOPWARE_DATA_ROOT` is optional); live → staging/playground/dev uses `deploy/sync-runtime.sh` → fyrst-cli (shop id + deploy env). Local `shopware-cli project dev` uses `deploy/sync-runtime-local.sh` → `fyrst-cli shopware sync local` (remote auto from `SHOPWARE_SHOP_ID` + `live`). ## Anti-patterns (do not) - [ ] Do not add a fyrst create wrapper or git submodule +- [ ] Do not skip fyrst-cli 0.1.0+ on the VPS or laptop (recipe wrappers `exec` it) +- [ ] Do not dump with fyrst-cli or the wrappers (dump stays `shopware-cli project dump`) +- [ ] Do not expect this PHP package to own deploy/sync/backup pipeline logic - [ ] Do not skip the fyrst-dev/recipes endpoint before `composer require` (Flex copies nothing) - [ ] Do not expect overlay files to live in this Packagist package - [ ] Do not let Flex copy or overwrite CLI-owned `compose.yaml`, `.gitignore`, or `.shopware-project.yaml` / `.shopware-project.yml` @@ -93,6 +100,6 @@ Fill placeholders — never commit values. - [ ] Do not use a single global `/var/lib/shopware/data` without `SHOPWARE_SHOP_ID` / `SHOPWARE_DEPLOY_ENV` segments - [ ] Do not hardcode Compose project name `shopware` (Compose derives `COMPOSE_PROJECT_NAME=${SHOPWARE_SHOP_ID}-${SHOPWARE_DEPLOY_ENV}`) - [ ] Do not require `COMPOSE_PROJECT_NAME` or `SHOPWARE_DATA_ROOT` in `.env` (they are optional; Compose uses those SoT vars directly) -- [ ] Do not use S3 as the default VPS env-to-env copy (SSH + dump + rsync of those host dirs via `deploy/sync-runtime.sh`) +- [ ] Do not use S3 as the default VPS env-to-env copy (SSH + dump + rsync of those host dirs via `deploy/sync-runtime.sh` → fyrst-cli) - [ ] Do not run `deploy/sync-runtime.sh` against local `shopware-cli project dev` (VPS only; local remap is `deploy/sync-runtime-local.sh`) - [ ] Do not cron a push into live (the consumer pulls from live) diff --git a/README.md b/README.md index 2b2f7cc..786f061 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,27 @@ # fyrst/shopware-cd -Reusable **fyrst.dev** overlay for Shopware create + continuous deploy. +Packagist library for fyrst.dev Shopware continuous deploy: the PHP rewrite command. -This repository is **not** a Shopware installation. It does not vendor Shopware core. The Packagist package [`fyrst/shopware-cd`](https://packagist.org/packages/fyrst/shopware-cd) is a **thin library** that ships `bin/console fyrst:sales-channel:rewrite-urls` (rewrite `sales_channel_domain.url` after a non-live DB restore). Overlay bash stays in recipes. +This repository is **not** a Shopware installation. It does not vendor Shopware core. The Packagist package [`fyrst/shopware-cd`](https://packagist.org/packages/fyrst/shopware-cd) is a **thin library** that ships `bin/console fyrst:sales-channel:rewrite-urls` (rewrite `sales_channel_domain.url` after a non-live DB restore). It does **not** own deploy, sync, backup, or env-init pipeline logic. -This package does **not** contain overlay files. **Symfony Flex** loads CI (`.github/workflows/cd.yaml`, `.gitlab-ci.yaml`), `.dockerignore`, `.env.example`, and `deploy/` (CD Compose plus `deploy/init-env.sh`, `deploy/sync-runtime.sh` for VPS and `deploy/sync-runtime-local.sh` for local `shopware-cli project dev`) from [`fyrst-dev/recipes`](https://github.com/fyrst-dev/recipes) (`fyrst/shopware-cd/1.0/`). It does **not** copy `compose.yaml`, `.gitignore`, or `.shopware-project.yaml` — `shopware-cli project create` owns those (create writes `.shopware-project.yml`; `.yaml` is also accepted — do not rename). Flex `env` may **append** a `###> fyrst/shopware-cd ###` SoT block to `.env` (empty shop id; no secrets). It does **not** overwrite create’s whole `.env`. Then run `bash deploy/init-env.sh --shop-id `. The image build file is always [`shopware/docker`](https://github.com/shopware/docker)’s `docker/Dockerfile` — shops **must** `composer require shopware/docker` on the same line as this package. +**Operator path:** [fyrst-cli](https://github.com/fyrst-dev/cli) **0.1.0+** plus the thin Flex wrappers from [`fyrst-dev/recipes`](https://github.com/fyrst-dev/recipes). Copied `deploy/*.sh` scripts `exec` fyrst-cli. **Dump stays `shopware-cli project dump` forever** — fyrst-cli and the wrappers never dump. + +This package does **not** contain overlay files. **Symfony Flex** loads CI (`.github/workflows/cd.yaml`, `.gitlab-ci.yaml`), `.dockerignore`, `.env.example`, and `deploy/` (CD Compose plus thin wrappers: `deploy/init-env.sh`, `deploy/vps-release.sh`, `deploy/vps-rollback.sh`, `deploy/sync-runtime.sh` for VPS, `deploy/sync-runtime-local.sh` for local `shopware-cli project dev`, `deploy/backup-runtime.sh`) from [`fyrst-dev/recipes`](https://github.com/fyrst-dev/recipes) (`fyrst/shopware-cd/1.0/`). It does **not** copy `compose.yaml`, `.gitignore`, or `.shopware-project.yaml` — `shopware-cli project create` owns those (create writes `.shopware-project.yml`; `.yaml` is also accepted — do not rename). Flex `env` may **append** a `###> fyrst/shopware-cd ###` SoT block to `.env` (empty shop id; no secrets). It does **not** overwrite create’s whole `.env`. Then run `bash deploy/init-env.sh --shop-id ` (execs `fyrst-cli shopware env init`). The image build file is always [`shopware/docker`](https://github.com/shopware/docker)’s `docker/Dockerfile` — shops **must** `composer require shopware/docker` on the same line as this package. Each VPS and laptop needs fyrst-cli 0.1.0+ on `PATH`. Process (locked standard): [Shopware Create & Continuous Deploy](https://app.clickup.com/90151931897/docs/2kyqjkzt-915) **Build once, run everywhere.** The image is identical for every target. The supported last mile is Docker Compose on a VPS. A managed container host is **planned / not implemented**. -There is **no** git submodule, **no** custom `fyrst-shopware-cd` CLI, **no** Composer plugin that copies files, and **no** Composer dependency on [`fyrst-dev/recipes`](https://github.com/fyrst-dev/recipes). +There is **no** git submodule, **no** custom `fyrst-shopware-cd` CLI in this package, **no** Composer plugin that copies files, and **no** Composer dependency on [`fyrst-dev/recipes`](https://github.com/fyrst-dev/recipes). Operators install **fyrst-cli** from [`fyrst-dev/cli`](https://github.com/fyrst-dev/cli) (0.1.0+), not from this repo. ## Architecture | Piece | Role | | --- | --- | -| This repo ([`fyrst-dev/shopware-cd`](https://github.com/fyrst-dev/shopware-cd)) | Packagist package [`fyrst/shopware-cd`](https://packagist.org/packages/fyrst/shopware-cd): thin library + Symfony bundle (`fyrst:sales-channel:rewrite-urls`). **No** shop file copies. | -| `shopware-cli project create` | Owns `compose.yaml`, `.gitignore`, `.shopware-project.yml` (create’s default; `.yaml` also accepted — do not rename), and local Docker (`shopware-cli project dev`). The fyrst Flex recipe does **not** copy those. | -| [`fyrst-dev/recipes`](https://github.com/fyrst-dev/recipes) | Owns and serves Flex overlay files at `fyrst/shopware-cd/1.0/`. Compiles [`flex/main/index.json`](https://raw.githubusercontent.com/fyrst-dev/recipes/flex/main/index.json). **Source of truth** for what shops get via Flex. | +| This repo ([`fyrst-dev/shopware-cd`](https://github.com/fyrst-dev/shopware-cd)) | Packagist package [`fyrst/shopware-cd`](https://packagist.org/packages/fyrst/shopware-cd): thin library + Symfony bundle (`fyrst:sales-channel:rewrite-urls`). **No** shop file copies. **No** deploy/sync/backup pipeline. | +| [fyrst-cli](https://github.com/fyrst-dev/cli) 0.1.0+ | Operator CLI: `shopware env init`, `deploy {release\|rollback}`, `sync {capture\|apply\|pull\|local}`, `backup {create\|prune\|recover}`, `db import`. **Never dumps.** | +| `shopware-cli` | `project create` owns `compose.yaml`, `.gitignore`, `.shopware-project.yml` (create’s default; `.yaml` also accepted — do not rename), and local Docker (`shopware-cli project dev`). **`project dump` is the only dump.** The fyrst Flex recipe does **not** copy those create files. | +| [`fyrst-dev/recipes`](https://github.com/fyrst-dev/recipes) | Owns and serves Flex overlay files at `fyrst/shopware-cd/1.0/`: CI, CD Compose, `.env.example`, and thin `deploy/*.sh` wrappers that `exec` fyrst-cli. Compiles [`flex/main/index.json`](https://raw.githubusercontent.com/fyrst-dev/recipes/flex/main/index.json). **Source of truth** for what shops get via Flex. | Flex maps the Packagist package name `fyrst/shopware-cd` to a recipe **only** via the shop’s `extra.symfony.endpoint` list — not via a `require` of the recipes repo. @@ -49,7 +52,11 @@ cd composer config extra.symfony.allow-contrib true composer config --json extra.symfony.endpoint '["https://raw.githubusercontent.com/fyrst-dev/recipes/flex/main/index.json","https://raw.githubusercontent.com/shopware/recipes/flex/main/index.json","flex://defaults"]' composer require shopware/docker shopware/deployment-helper fyrst/shopware-cd +# each VPS / laptop needs fyrst-cli 0.1.0+ (wrappers exec it) +curl -fsSL https://raw.githubusercontent.com/fyrst-dev/cli/main/scripts/install.sh | bash +# pin: FYRST_CLI_VERSION=0.1.0 bash deploy/init-env.sh --shop-id +# same as: fyrst-cli shopware env init --shop-id # VPS: bash deploy/init-env.sh --shop-id --vps ``` @@ -59,7 +66,7 @@ Flex then: - `shopware/docker` → **required**. Flex copies official `docker/Dockerfile`. Image builds **always** use that file. CI `DOCKERFILE=docker/Dockerfile` (or default to that). The fyrst recipe does **not** ship a shop-root `Dockerfile`. - `shopware/deployment-helper` → install/update at deploy time -- `fyrst/shopware-cd` → `.github/workflows/cd.yaml`, `.gitlab-ci.yaml`, `.dockerignore`, `.env.example`, `deploy/` including `deploy/compose.yaml`, `deploy/compose.prod.yaml`, `deploy/compose.vps.yaml`, `deploy/init-env.sh`, `deploy/sync-runtime.sh` (VPS), and `deploy/sync-runtime-local.sh` (local `shopware-cli project dev`) — from [fyrst-dev/recipes](https://github.com/fyrst-dev/recipes), not this package. Does **not** copy `compose.yaml`, `.gitignore`, or `.shopware-project.yaml` / `.shopware-project.yml`. Flex `env` appends a `###> fyrst/shopware-cd ###` block (safe defaults). Finish values with `bash deploy/init-env.sh --shop-id `. +- `fyrst/shopware-cd` → `.github/workflows/cd.yaml`, `.gitlab-ci.yaml`, `.dockerignore`, `.env.example`, `deploy/` including `deploy/compose.yaml`, `deploy/compose.prod.yaml`, `deploy/compose.vps.yaml`, and thin wrappers `deploy/init-env.sh`, `deploy/vps-release.sh`, `deploy/vps-rollback.sh`, `deploy/sync-runtime.sh` (VPS), `deploy/sync-runtime-local.sh` (local `shopware-cli project dev`), `deploy/backup-runtime.sh` — from [fyrst-dev/recipes](https://github.com/fyrst-dev/recipes), not this package. Wrappers `exec` fyrst-cli 0.1.0+. Does **not** copy `compose.yaml`, `.gitignore`, or `.shopware-project.yaml` / `.shopware-project.yml`. Flex `env` appends a `###> fyrst/shopware-cd ###` block (safe defaults). Finish values with `bash deploy/init-env.sh --shop-id ` (`fyrst-cli shopware env init`). Wizard defaults for fyrst: current stable Shopware, **Docker = yes**. @@ -91,15 +98,16 @@ See the [recipes README](https://github.com/fyrst-dev/recipes) for endpoint deta | Create | `shopware-cli project create` / `npx @shopware-ag/shopware-cli` | | CLI-owned files | `compose.yaml`, `.gitignore`, `.shopware-project.yml` (create’s default; `.yaml` also accepted — do not rename) and local Docker via CLI. Flex does **not** copy these. | | Overlay | `extra.symfony.endpoint` (fyrst-dev/recipes first) then `composer require shopware/docker shopware/deployment-helper fyrst/shopware-cd` + Symfony Flex | -| Overlay files | CI (`.github/workflows/cd.yaml`, `.gitlab-ci.yaml`), `.dockerignore`, `.env.example`, `deploy/` (`deploy/compose.yaml`, `deploy/compose.prod.yaml`, `deploy/compose.vps.yaml`, `deploy/init-env.sh`, `deploy/sync-runtime.sh`, `deploy/sync-runtime-local.sh`) | -| Local | Docker via `shopware-cli project dev` (CLI-managed root `compose.yaml`). Live media/files: `deploy/sync-runtime-local.sh` (rsync path remap into the project tree; remote auto `/var/lib/shopware/data/${SHOPWARE_SHOP_ID}/live` — not `deploy/sync-runtime.sh`) | +| Overlay files | CI (`.github/workflows/cd.yaml`, `.gitlab-ci.yaml`), `.dockerignore`, `.env.example`, `deploy/` (`deploy/compose.yaml`, `deploy/compose.prod.yaml`, `deploy/compose.vps.yaml`, thin wrappers `deploy/init-env.sh`, `deploy/vps-release.sh`, `deploy/vps-rollback.sh`, `deploy/sync-runtime.sh`, `deploy/sync-runtime-local.sh`, `deploy/backup-runtime.sh` that `exec` fyrst-cli 0.1.0+) | +| Operator CLI | [fyrst-cli](https://github.com/fyrst-dev/cli) 0.1.0+ on each VPS / laptop. Dump stays `shopware-cli project dump`. | +| Local | Docker via `shopware-cli project dev` (CLI-managed root `compose.yaml`). Live media/files: `deploy/sync-runtime-local.sh` → `fyrst-cli shopware sync local` (rsync path remap into the project tree; remote auto `/var/lib/shopware/data/${SHOPWARE_SHOP_ID}/live` — not `deploy/sync-runtime.sh`; `--data all` is dropped) | | Runtime | App **always** runs in Docker (`shopware/docker` / `ghcr.io/shopware/docker-base`) | | Image | Always `docker/Dockerfile` from required `shopware/docker`. CI `DOCKERFILE=docker/Dockerfile` (or default to that). | | Build | `shopware-cli project ci` inside that multi-stage `docker/Dockerfile` | | CI | GitHub Actions **and** GitLab CI, same stages | | Identity (hybrid) | Required SoT: `SHOPWARE_SHOP_ID` + `SHOPWARE_DEPLOY_ENV`. Optional `SHOPWARE_DATA_BASE`. `COMPOSE_PROJECT_NAME` and `SHOPWARE_DATA_ROOT` are **optional** — Docker Compose and sync derive `COMPOSE_PROJECT_NAME=${SHOPWARE_SHOP_ID}-${SHOPWARE_DEPLOY_ENV}` and `SHOPWARE_DATA_ROOT=${SHOPWARE_DATA_BASE:-/var/lib/shopware/data}/${SHOPWARE_SHOP_ID}/${SHOPWARE_DEPLOY_ENV}`. Compose uses those SoT vars directly. No hardcoded Compose project name `shopware`. | | Primary deploy | Docker Compose on a VPS using `deploy/compose.yaml` + `deploy/compose.prod.yaml` + `deploy/compose.vps.yaml` (not root `compose.yaml`) | -| Runtime data | Out of git and out of the image. VPS **bind mounts** under the derived shop/env root (`{files,media,thumbnail,theme,sitemap}`). Named volumes remain only for `mysql_data` / `redis_data` (scoped by the derived Compose project name). VPS: `deploy/sync-runtime.sh` live → staging/playground/dev (SSH + dump + rsync of those host dirs; **no S3**; cron on the consumer; paths from shop id + deploy env). Local `shopware-cli project dev`: `deploy/sync-runtime-local.sh` (rsync path remap into `files/` and `public/{media,thumbnail,theme,sitemap}`; remote default `/var/lib/shopware/data/${SHOPWARE_SHOP_ID}/live`) | +| Runtime data | Out of git and out of the image. VPS **bind mounts** under the derived shop/env root (`{files,media,thumbnail,theme,sitemap}`). Named volumes remain only for `mysql_data` / `redis_data` (scoped by the derived Compose project name). VPS: `deploy/sync-runtime.sh` → `fyrst-cli shopware sync {capture\|apply\|pull}` live → staging/playground/dev (SSH + `shopware-cli project dump` + rsync of those host dirs; **no S3**; cron on the consumer; paths from shop id + deploy env). Local `shopware-cli project dev`: `deploy/sync-runtime-local.sh` → `fyrst-cli shopware sync local` (rsync path remap into `files/` and `public/{media,thumbnail,theme,sitemap}`; remote default `/var/lib/shopware/data/${SHOPWARE_SHOP_ID}/live`) | | Managed deploy | **Planned / not implemented** (same image contract; no CI job). Compose/VPS is the only supported last mile. | | Deploy-time tasks | `vendor/bin/shopware-deployment-helper run --skip-theme-compile --skip-assets-install` | @@ -126,16 +134,16 @@ Several shops, and live + staging of the same shop, can share one VPS. Isolate t `COMPOSE_PROJECT_NAME` and `SHOPWARE_DATA_ROOT` are **optional**. `deploy/compose.yaml` interpolates `SHOPWARE_SHOP_ID`, `SHOPWARE_DEPLOY_ENV`, and `SHOPWARE_DATA_BASE` **directly** (project name + bind-mount paths). You do **not** set expanded `COMPOSE_PROJECT_NAME` / `SHOPWARE_DATA_ROOT` for Compose to work. -**VPS 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 with `bash deploy/init-env.sh --vps` (or by hand). Flex does **not** delete it on `composer require` (create owns the local flow). +**VPS 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 with `bash deploy/init-env.sh --vps` (or `fyrst-cli shopware env init --vps`, or by hand). Flex does **not** delete it on `composer require` (create owns the local flow). -After create + `composer require`, finish shop-specific `.env` values: +After create + `composer require`, finish shop-specific `.env` values (wrapper execs `fyrst-cli shopware env init`): ```bash bash deploy/init-env.sh --shop-id acme # VPS: add --vps --env live --image ghcr.io/example/acme ``` -`--shop-id` is required unless already non-empty. The script merges missing keys from `.env.example` and does not invent MYSQL passwords or `APP_URL`. See `deploy/README.md` after Flex copies it. +`--shop-id` is required unless already non-empty. fyrst-cli merges missing keys from `.env.example` and does not invent MYSQL passwords or `APP_URL`. See `deploy/README.md` after Flex copies it, and [fyrst-cli](https://github.com/fyrst-dev/cli). **Formula:** @@ -146,7 +154,7 @@ SHOPWARE_DATA_ROOT=${SHOPWARE_DATA_BASE:-/var/lib/shopware/data}/${SHOPWARE_SHOP # /var/lib/shopware/data/acme/staging/… ``` -Set `SHOPWARE_SHOP_ID` and `SHOPWARE_DEPLOY_ENV` in shop-root `.env`. Set `SHOPWARE_DATA_BASE` only when the prefix is not `/var/lib/shopware/data`. `deploy/sync-runtime.sh` derives this host from `SHOPWARE_SHOP_ID` + `SHOPWARE_DEPLOY_ENV` (and `SHOPWARE_DATA_BASE`) and the SSH source from shop id + `live` when roots are unset. `deploy/sync-runtime-local.sh` auto-derives remote `/var/lib/shopware/data/${SHOPWARE_SHOP_ID}/live`. Override with `SHOPWARE_DATA_ROOT` / `SYNC_REMOTE_DATA_ROOT` when needed. +Set `SHOPWARE_SHOP_ID` and `SHOPWARE_DEPLOY_ENV` in shop-root `.env`. Set `SHOPWARE_DATA_BASE` only when the prefix is not `/var/lib/shopware/data`. `deploy/sync-runtime.sh` (`fyrst-cli shopware sync`) derives this host from `SHOPWARE_SHOP_ID` + `SHOPWARE_DEPLOY_ENV` (and `SHOPWARE_DATA_BASE`) and the SSH source from shop id + `live` when roots are unset. `deploy/sync-runtime-local.sh` (`fyrst-cli shopware sync local`) auto-derives remote `/var/lib/shopware/data/${SHOPWARE_SHOP_ID}/live`. Override with `SHOPWARE_DATA_ROOT` / `SYNC_REMOTE_DATA_ROOT` when needed. Named volumes `mysql_data` / `redis_data` are scoped by the derived Compose project name (`COMPOSE_PROJECT_NAME=${SHOPWARE_SHOP_ID}-${SHOPWARE_DEPLOY_ENV}`). @@ -189,9 +197,9 @@ Named volumes `mysql_data` / `redis_data` are scoped by the derived Compose proj | Name | Purpose | | --- | --- | -| `deploy/sync.env` | Copied from Flex `deploy/sync.env.example`. `SYNC_SSH_*` to live; `SYNC_ENV` = staging / playground / dev. Mode `0600`. Cron `deploy/sync-runtime.sh` on this host. | +| `deploy/sync.env` | Copied from Flex `deploy/sync.env.example`. `SYNC_SSH_*` to live; `SYNC_ENV` = staging / playground / dev. Mode `0600`. Cron `deploy/sync-runtime.sh` (execs `fyrst-cli shopware sync pull`) on this host. | -Placeholders live in the Flex-copied `.github/workflows/cd.yaml`, `.gitlab-ci.yaml`, and `.env.example`. Flex may append SoT keys to `.env`; then run `bash deploy/init-env.sh --shop-id ` (VPS: `--vps`). Copy `deploy/sync.env.example` → `deploy/sync.env` on the consumer if you sync from live. +Placeholders live in the Flex-copied `.github/workflows/cd.yaml`, `.gitlab-ci.yaml`, and `.env.example`. Flex may append SoT keys to `.env`; then run `bash deploy/init-env.sh --shop-id ` (VPS: `--vps`; same as `fyrst-cli shopware env init`). Copy `deploy/sync.env.example` → `deploy/sync.env` on the consumer if you sync from live. GitLab still looks for `.gitlab-ci.yml` by default — set Settings → CI/CD → CI/CD configuration file to `.gitlab-ci.yaml`. GitHub Actions and shopware-cli load the `.yaml` names directly. @@ -201,7 +209,7 @@ Push to GitHub and/or GitLab on `main` (or a `v*` tag): 1. **Build** — `docker buildx` with BuildKit secrets; `shopware-cli project ci` inside the `shopware-cli` image. 2. **Push** — `:git-sha` always; `:latest` on default branch; `:semver` on version tags. -3. **Deploy** — SSH to the VPS, pull image, Compose up, one-shot setup. Managed host (`DEPLOY_TARGET=managed`) is **planned / not implemented** and is not a supported CI switch. +3. **Deploy** — SSH to the VPS, then `bash ./deploy/vps-release.sh` (execs `fyrst-cli shopware deploy release`): pull image, Compose up, one-shot setup. Managed host (`DEPLOY_TARGET=managed`) is **planned / not implemented** and is not a supported CI switch. Local day-to-day: @@ -209,7 +217,7 @@ Local day-to-day: shopware-cli project dev ``` -To pull live media/files into that checkout, use `deploy/sync-runtime-local.sh` (rsync path remap). Do **not** run `deploy/sync-runtime.sh` on a laptop — that script is VPS-only. +To pull live media/files into that checkout, use `deploy/sync-runtime-local.sh` → `fyrst-cli shopware sync local` (rsync path remap; do not pass `--data all` to fyrst-cli — the wrapper drops it). Do **not** run `deploy/sync-runtime.sh` on a laptop — that script is VPS-only. ## Primary vs planned deploy @@ -262,10 +270,12 @@ Shops must configure the endpoint **before** `composer require` (see [Primary pa - `deploy/compose.yaml` — CD services: `web`, bundled `mysql`, optional `redis` / `setup` / `worker` / `scheduler` profiles; interpolates `SHOPWARE_SHOP_ID` / `SHOPWARE_DEPLOY_ENV` / `SHOPWARE_DATA_BASE` **directly**; **bind mounts** under the derived shop/env root (named volumes only `mysql_data` / `redis_data`, scoped by the derived Compose project name) - `deploy/compose.prod.yaml` — VPS/prod overrides - `deploy/compose.vps.yaml` — `pull_policy: ${PULL_POLICY:-always}` (CI/VPS default after a registry push). Same-host tag-and-load / air-gap: `PULL_POLICY=never` and `SKIP_PULL=1` (or `bash deploy/vps-release.sh --skip-pull`) -- `deploy/init-env.sh` — post-create `.env` helper (Flex `env` appends safe SoT keys; this script fills shop id / env, optional `IMAGE` / `APP_SECRET`, and `--vps` comments create’s `COMPOSE_PROJECT_NAME=sw-shop-…`) -- `deploy/vps-release.sh` — release command on the VPS (also invoked from CI). `compose run` uses `--pull never` (Compose v5 dropped `--no-build` from the run subcommand). `up` uses `--no-build`. -- `deploy/sync-runtime.sh` — VPS only: live → staging/playground/dev copy of DB + host dirs (SSH + dump + rsync; **no S3**; paths from `SHOPWARE_SHOP_ID` + `SHOPWARE_DEPLOY_ENV`, optional `SHOPWARE_DATA_BASE` / `SHOPWARE_DATA_ROOT`) -- `deploy/sync-runtime-local.sh` — laptop only: live media/files into `shopware-cli project dev` (rsync path remap; remote default `/var/lib/shopware/data/${SHOPWARE_SHOP_ID}/live`; **not** `deploy/sync-runtime.sh`) +- `deploy/init-env.sh` — thin wrapper → `fyrst-cli shopware env init` (Flex `env` appends safe SoT keys; fyrst-cli fills shop id / env, optional `IMAGE` / `APP_SECRET`, and `--vps` comments create’s `COMPOSE_PROJECT_NAME=sw-shop-…`) +- `deploy/vps-release.sh` — thin wrapper → `fyrst-cli shopware deploy release` (also invoked from CI). `compose run` uses `--pull never` (Compose v5 dropped `--no-build` from the run subcommand). `up` uses `--no-build`. +- `deploy/vps-rollback.sh` — thin wrapper → `fyrst-cli shopware deploy rollback` +- `deploy/sync-runtime.sh` — thin wrapper → `fyrst-cli shopware sync {capture\|apply\|pull}`. VPS only: live → staging/playground/dev copy of DB + host dirs (SSH + `shopware-cli project dump` + rsync; **no S3**; paths from `SHOPWARE_SHOP_ID` + `SHOPWARE_DEPLOY_ENV`, optional `SHOPWARE_DATA_BASE` / `SHOPWARE_DATA_ROOT`) +- `deploy/sync-runtime-local.sh` — thin wrapper → `fyrst-cli shopware sync local`. Laptop only: live media/files into `shopware-cli project dev` (rsync path remap; remote default `/var/lib/shopware/data/${SHOPWARE_SHOP_ID}/live`; **not** `deploy/sync-runtime.sh`; `--data all` is dropped) +- `deploy/backup-runtime.sh` — thin wrapper → `fyrst-cli shopware backup {create\|prune\|recover}` (off-host DR; **not** sync; dump is still `shopware-cli project dump`) The VPS uses those deploy Compose files. It does **not** use the CLI-managed root `compose.yaml`. @@ -291,9 +301,9 @@ sudo mkdir -p "$SHOPWARE_DATA_ROOT"/{files,media,thumbnail,theme,sitemap} sudo chown -R 82:82 "$SHOPWARE_DATA_ROOT" ``` -**No S3.** Copying live → staging / playground / dev is SSH + `mysqldump` (or Compose exec on bundled MySQL) + rsync of those host dirs, not object storage. +**No S3.** Copying live → staging / playground / dev is SSH + `shopware-cli project dump` (operator-provided; fyrst-cli never dumps) + rsync of those host dirs, not object storage. Restore is `fyrst-cli shopware db import`. -Flex copies **`deploy/sync-runtime.sh`**. It rsyncs those host dirs. Paths use **shop id + deploy env**: this host from `SHOPWARE_SHOP_ID` + `SHOPWARE_DEPLOY_ENV` (and optional `SHOPWARE_DATA_BASE`); the SSH source defaults to the same shop id + `live`. Override with `SHOPWARE_DATA_ROOT` / `SYNC_REMOTE_DATA_ROOT` when needed. Run it **on the consumer** (cron on staging/playground/dev). Pull from live; never auto-push into live. This script is **not** for local `shopware-cli project dev`. +Flex copies **`deploy/sync-runtime.sh`** (thin wrapper → `fyrst-cli shopware sync {capture|apply|pull}`). It rsyncs those host dirs. Paths use **shop id + deploy env**: this host from `SHOPWARE_SHOP_ID` + `SHOPWARE_DEPLOY_ENV` (and optional `SHOPWARE_DATA_BASE`); the SSH source defaults to the same shop id + `live`. Override with `SHOPWARE_DATA_ROOT` / `SYNC_REMOTE_DATA_ROOT` when needed. Run it **on the consumer** (cron on staging/playground/dev). Pull from live; never auto-push into live. This script is **not** for local `shopware-cli project dev`. ```bash # on staging / playground / dev @@ -302,9 +312,10 @@ cd /opt/shopware/acme-staging # COMPOSE_PROJECT_NAME and SHOPWARE_DATA_ROOT stay unset (derived) cp deploy/sync.env.example deploy/sync.env # SYNC_SSH_* to live; SYNC_ENV= # Opt-in (default off; refused on live): SYNC_REWRITE_APP_URL=https://staging.example.com -# Overlay bash currently rewrites via SQL; it should call the console command in this -# package after shops `composer update fyrst/shopware-cd` (companion recipes PR). +# fyrst-cli then runs bin/console fyrst:sales-channel:rewrite-urls +# (shops need composer update fyrst/shopware-cd). bash deploy/sync-runtime.sh sync --from live --data all +# same as: fyrst-cli shopware sync pull --from live --data all ``` ```cron @@ -317,7 +328,7 @@ See `deploy/README.md` after Flex. Overlay copies live in [fyrst-dev/recipes](ht Local and VPS use **different paths**. `shopware-cli project dev` bind-mounts the **project tree**, not `SHOPWARE_DATA_ROOT`. Do **not** run `deploy/sync-runtime.sh` on a laptop. -Flex copies **`deploy/sync-runtime-local.sh`**. Laptop `.env` needs at least `SHOPWARE_SHOP_ID` (same slug as live). The remote path **auto-derives** `/var/lib/shopware/data/${SHOPWARE_SHOP_ID}/live` unless you override it (`--remote-data-root` / `SYNC_REMOTE_DATA_ROOT`). From the shop root it rsyncs live bind-mount trees into local project paths (rsync path remap): +Flex copies **`deploy/sync-runtime-local.sh`** (thin wrapper → `fyrst-cli shopware sync local`). Laptop `.env` needs at least `SHOPWARE_SHOP_ID` (same slug as live). The remote path **auto-derives** `/var/lib/shopware/data/${SHOPWARE_SHOP_ID}/live` unless you override it (`--remote-data-root` / `SYNC_REMOTE_DATA_ROOT`). From the shop root it rsyncs live bind-mount trees into local project paths (rsync path remap). fyrst-cli refuses `--data all` on `sync local`; the wrapper drops that flag and uses the CLI default (volumes only, never DB): | Live (`/var/lib/shopware/data/${SHOPWARE_SHOP_ID}/live`) | Local project | | --- | --- | @@ -330,8 +341,9 @@ Flex copies **`deploy/sync-runtime-local.sh`**. Laptop `.env` needs at least `SH ```bash cd /path/to/your-shop # .env: SHOPWARE_SHOP_ID=acme # same as live; remote → /var/lib/shopware/data/acme/live -bash deploy/sync-runtime-local.sh --from live --data all -# optional: --delete --dry-run +bash deploy/sync-runtime-local.sh --from live +# same as: fyrst-cli shopware sync local --from live +# optional: --data media,files --delete --dry-run shopware-cli project console cache:clear ``` @@ -341,12 +353,12 @@ Pulling media/files does **not** copy the database. For a full content match, du ## Sales-channel URL rewrite (console) -This package registers Symfony bundle `Fyrst\ShopwareCd\FyrstShopwareCdBundle` (`extra.symfony.bundle`) and command `fyrst:sales-channel:rewrite-urls`. Shops need a **Composer package update** (`composer update fyrst/shopware-cd`) — this is not a Flex overlay copy. `deploy/init-env.sh` stays bash in recipes; it is not a console command. +This package registers Symfony bundle `Fyrst\ShopwareCd\FyrstShopwareCdBundle` (`extra.symfony.bundle`) and command `fyrst:sales-channel:rewrite-urls`. Shops need a **Composer package update** (`composer update fyrst/shopware-cd`) — this is not a Flex overlay copy. Pipeline verbs (`env init`, deploy, sync, backup) stay in fyrst-cli 0.1.0 + recipe wrappers; they are not console commands in this package. **Discoverable in a Shopware app** after `composer require fyrst/shopware-cd` (or update) when Flex adds the bundle to `config/bundles.php`: 1. Flex reads `extra.symfony.bundle` / the Bundle class heuristic, **or** -2. A companion [fyrst-dev/recipes](https://github.com/fyrst-dev/recipes) PR lists the bundle in the recipe `manifest.json` (`"Fyrst\\ShopwareCd\\FyrstShopwareCdBundle": ["all"]`) so `composer recipes:update fyrst/shopware-cd` writes `config/bundles.php`. Until that recipe lands, add one line: +2. The [fyrst-dev/recipes](https://github.com/fyrst-dev/recipes) recipe lists the bundle in `manifest.json` (`"Fyrst\\ShopwareCd\\FyrstShopwareCdBundle": ["all"]`) so `composer recipes:update fyrst/shopware-cd` writes `config/bundles.php`. If that line is missing, add: ```php Fyrst\ShopwareCd\FyrstShopwareCdBundle::class => ['all' => true], @@ -361,7 +373,7 @@ bin/console list fyrst Opt-in only (`--app-url` / `SYNC_REWRITE_APP_URL` and/or `--map` / `SYNC_REWRITE_URL_MAP`). Requires at least one rewrite option. Updates `sales_channel_domain.url` and `updated_at = NOW(3)` only. Does **not** touch media CDN, plugin configs, `APP_URL` in `.env`, or payment/shipping webhooks. Unique `url` collisions abort. Hard-refused when `SHOPWARE_DEPLOY_ENV`, `SYNC_ENV`, `--checkout-basename`, or hostname is `live`. `SYNC_ALLOW_LIVE_RESTORE=1` does **not** bypass that refuse. -Recipes should call it from the shop checkout (same `compose run` style as `cache:clear`): +fyrst-cli `sync apply` / `sync pull` (and `deploy/sync-runtime.sh`) already call it from the shop checkout when `SYNC_REWRITE_APP_URL` / `SYNC_REWRITE_URL_MAP` is set (same `compose run` style as `cache:clear`): ```bash # origin replace (path/query/hash kept); staging / playground / dev only @@ -429,6 +441,10 @@ This package’s GitHub workflow is package tests only (`.github/workflows/ci.ym - Manual FTP/rsync of `vendor/` - Git submodules for this overlay - Custom `create` / `apply` CLIs or Composer plugins that copy files +- Putting deploy / sync / backup pipeline logic into this PHP package (operators use fyrst-cli 0.1.0 + recipe wrappers) +- Skipping fyrst-cli 0.1.0+ on the VPS or laptop (wrappers fail without it) +- Dumping with fyrst-cli or the wrappers (**Dump stays `shopware-cli project dump`**) +- Treating overlay `deploy/*.sh` as the implementation (they `exec` fyrst-cli) - Requiring `fyrst-dev/recipes` as a Composer package (Flex uses `extra.symfony.endpoint`) - Skipping the fyrst-dev/recipes endpoint before `composer require` (Flex copies nothing) - Letting the fyrst Flex recipe copy or overwrite `compose.yaml`, `.gitignore`, or `.shopware-project.yaml` / `.shopware-project.yml` @@ -444,14 +460,14 @@ This package’s GitHub workflow is package tests only (`.github/workflows/ci.ym - Using a single global `/var/lib/shopware/data` without `SHOPWARE_SHOP_ID` / `SHOPWARE_DEPLOY_ENV` segments - Hardcoding Compose project name `shopware` (Compose derives `COMPOSE_PROJECT_NAME=${SHOPWARE_SHOP_ID}-${SHOPWARE_DEPLOY_ENV}`) - Requiring `COMPOSE_PROJECT_NAME` or `SHOPWARE_DATA_ROOT` in `.env` (they are optional; Compose uses those SoT vars directly) -- Using S3/MinIO as the default way to copy live data to staging (use `deploy/sync-runtime.sh`: SSH + dump + rsync of those host dirs) +- Using S3/MinIO as the default way to copy live data to staging (use `deploy/sync-runtime.sh` → fyrst-cli: SSH + `shopware-cli project dump` + rsync of those host dirs) - Running `deploy/sync-runtime.sh` against local `shopware-cli project dev` (that script is VPS `SHOPWARE_DATA_ROOT`; use `deploy/sync-runtime-local.sh`) - Cron that pushes into live (the consumer pulls from live) - Treating managed-host deploy as a supported CI path (`DEPLOY_TARGET=managed` is planned / not implemented) ## Roadmap (ops) -Overlay work lives in [fyrst-dev/recipes](https://github.com/fyrst-dev/recipes). Package docs stay aligned with those epics: +Shared pipeline logic lives in [fyrst-cli](https://github.com/fyrst-dev/cli) 0.1.0. Overlay wrappers and Compose/CI templates live in [fyrst-dev/recipes](https://github.com/fyrst-dev/recipes). This package stays the rewrite command. Package docs stay aligned with those epics: - P0 production hardening — [recipes#10](https://github.com/fyrst-dev/recipes/issues/10) - P1 staging & day-2 ops — [recipes#11](https://github.com/fyrst-dev/recipes/issues/11) (this package: [#14](https://github.com/fyrst-dev/shopware-cd/issues/14)) diff --git a/composer.json b/composer.json index 449e8ef..930742b 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "fyrst/shopware-cd", - "description": "Thin Packagist library for fyrst.dev Shopware continuous deploy. Provides fyrst:sales-channel:rewrite-urls (sales_channel_domain.url after a non-live DB restore). Overlay files (CI, deploy Compose, .env.example) are served by Symfony Flex from fyrst-dev/recipes, not this package. Root compose.yaml, .gitignore, and .shopware-project.yml / .yaml are owned by shopware-cli. Image builds use docker/Dockerfile from shopware/docker. Not a Shopware installation.", + "description": "Thin Packagist library for fyrst.dev Shopware continuous deploy. Provides fyrst:sales-channel:rewrite-urls (sales_channel_domain.url after a non-live DB restore). Overlay files (CI, deploy Compose, .env.example, thin wrappers) are served by Symfony Flex from fyrst-dev/recipes, not this package. Operators use fyrst-cli 0.1.0+ (wrappers exec it). Dump stays shopware-cli. Root compose.yaml, .gitignore, and .shopware-project.yml / .yaml are owned by shopware-cli. Image builds use docker/Dockerfile from shopware/docker. Not a Shopware installation.", "license": "MIT", "type": "library", "keywords": [ diff --git a/tests/package.test.php b/tests/package.test.php index ad95f51..c74db41 100644 --- a/tests/package.test.php +++ b/tests/package.test.php @@ -264,9 +264,34 @@ function fyrst_assert(bool $ok, string $message): void 'README states VPS runtime sync does not use S3' ); fyrst_assert( - str_contains($readme, 'SSH + `mysqldump`'), + str_contains($readme, 'shopware-cli project dump'), + 'README states dump stays shopware-cli project dump' +); +fyrst_assert( + str_contains($readme, 'SSH + `shopware-cli project dump`') + || str_contains($readme, 'SSH + dump'), 'README states runtime sync is SSH + dump' ); +fyrst_assert( + str_contains($readme, 'fyrst-cli'), + 'README names fyrst-cli as the operator CLI' +); +fyrst_assert( + str_contains($readme, '0.1.0'), + 'README pins fyrst-cli 0.1.0' +); +fyrst_assert( + str_contains($readme, 'exec') && str_contains($readme, 'thin wrapper'), + 'README states recipe wrappers exec fyrst-cli' +); +fyrst_assert( + !str_contains($readme, 'Overlay bash currently rewrites via SQL'), + 'README does not describe overlay bash SQL rewrite as the operator path' +); +fyrst_assert( + !str_contains($readme, 'companion recipes PR'), + 'README does not wait on a companion recipes PR for rewrite' +); fyrst_assert( str_contains($readme, 'rsync of those host dirs'), 'README states deploy/sync-runtime.sh rsyncs SHOPWARE_DATA_ROOT host dirs' @@ -459,6 +484,22 @@ function fyrst_assert(bool $ok, string $message): void str_contains($create, 'SSH + dump + rsync of those host dirs'), 'CREATE.md states runtime sync is SSH + dump + rsync of host dirs' ); +fyrst_assert( + str_contains($create, 'fyrst-cli'), + 'CREATE.md names fyrst-cli as the operator CLI' +); +fyrst_assert( + str_contains($create, '0.1.0'), + 'CREATE.md pins fyrst-cli 0.1.0' +); +fyrst_assert( + str_contains($create, 'shopware-cli project dump'), + 'CREATE.md states dump stays shopware-cli project dump' +); +fyrst_assert( + str_contains($create, 'exec') && str_contains($create, 'thin wrapper'), + 'CREATE.md states recipe wrappers exec fyrst-cli' +); fyrst_assert( str_contains($create, 'SHOPWARE_DATA_ROOT'), 'CREATE.md names SHOPWARE_DATA_ROOT for VPS bind mounts' @@ -588,6 +629,10 @@ function fyrst_assert(bool $ok, string $message): void 'README links P0–P2 recipes epics' ); +fyrst_assert( + str_contains((string) ($composer['description'] ?? ''), 'fyrst-cli'), + 'description names fyrst-cli as the operator CLI' +); fyrst_assert( str_contains((string) ($composer['description'] ?? ''), 'owned by shopware-cli'), 'description states shopware-cli owns root compose.yaml'