在Shopware 6中建立管理界面,无需数据库和var/plugins.json。

huangapple go评论73阅读模式
英文:

build-administration in Shopware 6 without database and without var/plugins.json

问题

我们正在CI流水线中为Shopware预构建Docker镜像。在构建过程中,没有可用的数据库。

现在我们发现自定义插件的管理界面没有构建:

在执行以下命令时:

CI=1 PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true DATABASE_URL= bin/build-administration.sh

会输出以下信息:

#20 0.512 + /var/www/bin/ci bundle:dump
#20 2.309 警告:无法加载应用程序。从本地加载应用程序。消息:在驱动程序中发生异常:SQLSTATE[HY000] [2002] php_network_getaddresses:getaddrinfo for _placeholder.test failed:Name or service not known
#20 2.312 

这是有道理的,因为没有可用的数据库。

一个解决方案是将 var/plugins.json 添加到Git仓库以使构建正常工作。

这是唯一的解决方案吗,还是有一种更“智能”的方法来生成 plugins.json,其中包含文件系统中找到的所有插件?

英文:

We are pre-building a docker image for our Shopware in the CI pipeline. During the build, no database is available.

Now we saw that the administration for custom plugins is not built:

During

CI=1 PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true DATABASE_URL= bin/build-administration.sh

This is printed:

#20 0.512 + /var/www/bin/ci bundle:dump
#20 2.309 Warning: Failed to load apps. Loading apps from local. Message: An exception occurred in driver: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo for _placeholder.test failed: Name or service not known
#20 2.312 

Which makes sense, as there is no database.

One solution would be to add the var/plugins.json to the git repository to make the build work.

Is this the only solution or is there some "smarter" way, to generate the plugins.json with all the plugins which are found in the filesystem?

答案1

得分: 1

数据库连接是必要的,以确定插件是否通过存储在“plugin”表中的数据安装和激活。因此,仅仅插件在文件系统中的存在并不足以作为充分的指示器。手动添加“plugin.json”可能是最好的选择。

英文:

The database connection is needed to determine whether a plugin is installed and activated through the data stored in the plugin table. Hence why the mere existence of the plugin in the filesystem is not a sufficient indicator. Adding the plugin.json manually is probably your best bet.

答案2

得分: 0

加到 dneustadt 的回答中:

另外,使用 SHOPWARE_SKIP_BUNDLE_DUMP 也是很重要的。否则,一些插件会被转储到 plugins.json,而自定义插件则会缺失。

因此,

  • var/plugins.json 提交到 git
  • 使用
    CI=1 SHOPWARE_SKIP_BUNDLE_DUMP=true PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true DATABASE_URL= bin/build-administration.sh
    CI=1 SHOPWARE_SKIP_BUNDLE_DUMP=true SHOPWARE_SKIP_THEME_COMPILE=true PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true DATABASE_URL= bin/build-storefront.sh
    

    进行构建

英文:

Adding to dneustadt's answer:

It is additionally important to use SHOPWARE_SKIP_BUNDLE_DUMP. Otherwise some of the plugins will be dumped to the plugins.json while custom plugins are missing.

So

  • commit the var/plugins.json to the git
  • use
    CI=1 SHOPWARE_SKIP_BUNDLE_DUMP=true PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true DATABASE_URL= bin/build-administration.sh
    CI=1 SHOPWARE_SKIP_BUNDLE_DUMP=true SHOPWARE_SKIP_THEME_COMPILE=true PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true DATABASE_URL= bin/build-storefront.sh
    

    to build

huangapple
  • 本文由 发表于 2023年3月8日 14:59:08
  • 转载请务必保留本文链接:https://go.coder-hub.com/75670136.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定