Skip to content

feat: host .env.local owns deploy env; local Compose name matches VPS - #40

Merged
ROBJkE merged 7 commits into
mainfrom
cursor/env-init-compose-project-name-415b
Sep 17, 2026
Merged

ROBJkE merged 7 commits into
mainfrom
cursor/env-init-compose-project-name-415b

Conversation

@ROBJkE

@ROBJkE ROBJkE commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Rewrite this private Flex recipe for the locked file layout:

  • Shared committed .env: no COMPOSE_PROJECT_NAME, no real SHOPWARE_DEPLOY_ENV. fyrst-cli shopware env init strips (comments out) create’s COMPOSE_PROJECT_NAME=sw-…. Flex omits SHOPWARE_DEPLOY_ENV from the marker block.
  • Host .env.local (gitignored): holds SHOPWARE_DEPLOY_ENV and COMPOSE_PROJECT_NAME=<shop-id>-<env> (acme-dev locally, acme-live on VPS — same pattern, not the folder basename and not shopware-<shop-id>).
  • Env init also sets shop-root compose.override.yaml name: so shopware-cli project dev sees that project name.
  • VPS Compose naming SoT is only deploy/compose.yaml name: ${SHOPWARE_SHOP_ID}-${SHOPWARE_DEPLOY_ENV} with host env files loaded. fyrst-cli (and raw operator Compose) pass --env-file .env then --env-file .env.local then --env-file .env.prod (if present). No -p.

What changed

Operator-facing recipe text (post-install.txt, recipe README, repo README):

  • Flex env no longer stamps SHOPWARE_DEPLOY_ENV=live into committed .env (manifest.json omits the key).
  • Env init always comments out create’s COMPOSE_PROJECT_NAME=sw-shop-… in committed .env.
  • Dual-name docs (shopware-<shop-id> local vs VPS) are gone. Local/dev uses the same <shop-id>-<env> formula as VPS.
  • VPS compose invocation is no longer --env-file .env only. Raw operator Compose must use the same --env-file chain; omit .env.prod when absent. Docs do not say fyrst-cli passes -p or that -p is a matching pin. Raw Compose examples do not use -p.
  • No --vps. Flex still does not delete create’s line on composer require.

Tests:

  • tests/init-env.test.sh: docs must say .env.local + compose.override.yaml use acme-dev / acme-live and VPS compose uses --env-file .env.local / .env.prod. Docs must not mention -p / matching pin. CLI checks assert deploy env + COMPOSE_PROJECT_NAME=<shop-id>-<env> land in .env.local, leftover Flex deploy env is migrated out of .env, create’s sw-… line is commented, and override name: matches.
  • tests/vps-hardening.test.sh: same docs contract. Create sw-shop-… warning + deploy-release footgun check stay.
  • tests/wrappers.test.sh / sync tests: --vps still rejected; identity fixtures use .env.local.

This recipe is thin (copy-from-package). Overlay bytes live in fyrst-dev/shopware-cd. Tests call fyrst-cli directly.

Out of this PR

  • fyrst-dev/cli — landing in parallel (write SHOPWARE_DEPLOY_ENV + COMPOSE_PROJECT_NAME=<shop-id>-<env> to .env.local; set compose.override.yaml name:; pass --env-file .env then .env.local then .env.prod if present; do not pass -p; stop writing those keys into committed .env; keep commenting create’s COMPOSE_PROJECT_NAME). Do not change CLI here.
  • fyrst-dev/shopware-cd overlay — follow-up belongs in shopware-cd, not here.

Tests (this revision, fyrst-cli 0.2.0)

Script Result
wrappers.test.sh pass
vps-hardening.test.sh pass
init-env.test.sh docs / strip / --vps / Flex omit / --env-file chain / no -p pass; 7 .env.local + override identity checks fail until CLI writes those keys and sets compose.override.yaml name:

CLI behavioral checks for .env.local / compose.override.yaml need the post-layout binary (parallel CLI change).

Open in Web Open in Cursor 

cursoragent and others added 3 commits September 17, 2026 06:54
Align Flex recipe docs and tests with the locked env init contract:
set COMPOSE_PROJECT_NAME=shopware-<shop-id> (no env suffix) instead of
commenting out create's line. Compose name: interpolation still exists;
COMPOSE_PROJECT_NAME wins per Docker Compose precedence and is intentional.

Co-authored-by: ROBJkE <ROBJkE@users.noreply.github.com>
Clarify that env init sets COMPOSE_PROJECT_NAME=shopware-<shop-id> for
laptop project dev / shop-root compose. VPS stacks keep
${SHOPWARE_SHOP_ID}-${SHOPWARE_DEPLOY_ENV} (acme-live); fyrst-cli pins
-p or unsets the env var so .env does not override. Live and staging
on one host stay isolated.

Co-authored-by: ROBJkE <ROBJkE@users.noreply.github.com>
…shared .env

Shared committed .env no longer carries env-specific SHOPWARE_DEPLOY_ENV
or COMPOSE_PROJECT_NAME. Flex omits deploy env from the marker block;
env init comments create's sw-… line; host .env.local owns deploy env.
VPS project name <shop-id>-<env> is derived at runtime (CLI may pin -p).

Co-authored-by: ROBJkE <ROBJkE@users.noreply.github.com>
@cursor cursor Bot changed the title feat: env init sets COMPOSE_PROJECT_NAME=shopware-<shop-id> feat: host .env.local owns deploy env; strip COMPOSE_PROJECT_NAME from shared .env Sep 17, 2026
cursoragent and others added 2 commits September 17, 2026 08:38
0.2.0 does not create .env.local yet; avoid grep noise on that path.

Co-authored-by: ROBJkE <ROBJkE@users.noreply.github.com>
…ide.yaml

env init writes SHOPWARE_DEPLOY_ENV and COMPOSE_PROJECT_NAME=<shop-id>-<env>
to gitignored .env.local (acme-dev locally, acme-live on VPS) and sets
compose.override.yaml name: so shopware-cli project dev sees it. Shared .env
still has no COMPOSE_PROJECT_NAME and no real SHOPWARE_DEPLOY_ENV.

Co-authored-by: ROBJkE <ROBJkE@users.noreply.github.com>
@cursor cursor Bot changed the title feat: host .env.local owns deploy env; strip COMPOSE_PROJECT_NAME from shared .env feat: host .env.local owns deploy env; local Compose name matches VPS Sep 17, 2026
cursoragent and others added 2 commits September 17, 2026 09:12
…local then .env.prod

Raw operator Compose must pass the same --env-file flags as fyrst-cli (not
only .env). -p stays a matching pin, not the naming SoT. Shared .env still
has no COMPOSE_PROJECT_NAME and no real SHOPWARE_DEPLOY_ENV.

Co-authored-by: ROBJkE <ROBJkE@users.noreply.github.com>
… chain

Do not document fyrst-cli passing -p or treating -p as a matching pin.
Raw Compose examples stay --env-file .env, .env.local, then .env.prod if present.

Co-authored-by: ROBJkE <ROBJkE@users.noreply.github.com>
@ROBJkE
ROBJkE marked this pull request as ready for review September 17, 2026 09:39
@ROBJkE
ROBJkE merged commit 318d68d into main Sep 17, 2026
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.

2 participants