shopware / deployment-helper

Simplify Shopware Deployments
https://developer.shopware.com/docs/guides/hosting/installation-updates/deployments/deployment-helper.html
9 stars 4 forks source link

App registration fails #17

Closed dallyger closed 3 weeks ago

dallyger commented 1 month ago

Summary

Apps cannot be installed via composer using deployment helper.

The init container, which enables the app using the deployment-helper, crashes with error message "Could not sign payload with store secret".

Cannot install apps via the backend, because runtime management is disabled.

Cannot check installation via cli on web container. It is not deployed, because the init container fails.

Error message

=================================================
Start: php bin/console -n app:install [redacted] --activate --force
=================================================

13:19:13 CRITICAL  [console] Error thrown while running command "-n app:install [redacted] --activate --force". Message: "App registration for "[Redacted]" failed: Could not sign payload with store secret" ["exception" => Shopware\Core\Framework\App\Exception\AppRegistrationException { …},"command" => "-n app:install [Redacted] --activate --force","message" => "App registration for "[Redacted]" failed: Could not sign payload with store secret"]

In AppException.php line 105:

  App registration for "[redacted]" failed: Could not sign
   payload with store secret

In ShopSecretInvalidMiddleware.php line 48:

  Store shop secret is invalid

app:install [-f|--force] [-a|--activate] [--no-validate] [--] <name>...

In ProcessHelper.php line 49:

  Execution of bin/console -n app:install [redacted] --activate --force failed

run [--skip-theme-compile] [--skip-asset-install] [--skip-assets-install] [--timeout TIMEOUT]

Setup

Shopware setup installed via composer create-project shopware/production and composer req shopware/docker.

Install an extension using the suggestion on the Shopware account page.

Install an extension using composer

Execute this command inside the composer project to add the extension:

composer require store.shopware.com/[redacted]

shopware/core: 6.6.4.1 shopware/deployment-helper: 0.0.6 shopware/docker: 0.1.0

# File: config/packages/prod/z-shopware.yml
shopware:
  deployment:
    runtime_extension_management: false
# compose.yaml (summarized; based on: https://github.com/shopware/docker?tab=readme-ov-file#running-the-container)
x-sw6:
  <<: &sw6
    image: ...
    restart: unless-stopped
    environment:
      APP_ENV: "${APP_ENV:-prod}"
      APP_SECRET: "${APP_SECRET}"
      APP_URL: ...
      DATABASE_HOST: mysql
      DATABASE_URL: ...
      INSTALL_LOCALE: de-DE
      INSTALL_CURRENCY: EUR
      INSTANCE_ID: "${INSTANCE_ID}"
      JWT_PRIVATE_KEY: "${JWT_PRIVATE_KEY}"
      JWT_PUBLIC_KEY: "${JWT_PUBLIC_KEY}"
      MAILER_DSN:
      TRUSTED_PROXIES: "${TRUSTED_PROXIES}"
    depends_on:
      - mysql
    networks:
      - ...
    <<: &sw6volumes
      volumes:
        - "${STORAGE_PATH}/shop/files:/var/www/html/files"
        - "${STORAGE_PATH}/shop/public/media:/var/www/html/public/media"
        - "${STORAGE_PATH}/shop/public/sitemap:/var/www/html/public/sitemap"
        - "${STORAGE_PATH}/shop/public/theme:/var/www/html/public/theme"
        - "${STORAGE_PATH}/shop/public/thumbnail:/var/www/html/public/thumbnail"

services:

  init-perm:
    image: alpine
    <<: *sw6volumes
    command: chown 82:82 /var/www/html/files /var/www/html/public/theme /var/www/html/public/media /var/www/html/public/thumbnail /var/www/html/public/sitemap

  init:
    <<: *sw6
    entrypoint: /setup
    depends_on:
      mysql:
        condition: service_started
      init-perm:
        condition: service_completed_successfully
    restart: "no"

  web:
    <<: *sw6
    container_name: shop-web
    depends_on:
      init:
        condition: service_completed_successfully

  # ...
shyim commented 1 month ago

You need to login to shopware account first. I have created an issue in deployment helper to automate this...

dallyger commented 1 month ago

I've logged into the Shopware account through administration web-ui. However, it gets logged out each time the init container tries to activate the app. Will your issue solve that too or is it another bug @shyim?

shyim commented 1 month ago

that sounds like another bug 🤔 . I think it removes your authorization as the api request fails....

dallyger commented 1 month ago

Is this a bug in the deployment helper, or should I move this issue? Would be the shopware/docker or shopware/shopware repository a better fit?

shyim commented 1 month ago

I think shopware/shopware because both repos does nothing magical there

dallyger commented 1 month ago

Alright. Will move it. I hope it won't be ignored like my other issues on that repository.

dallyger commented 1 month ago

Opened issue at https://github.com/shopware/shopware/issues/5082. Will leave this one open as a reminder, as issues in the main repo get lost easily (nearly 700 open issues).