bestit / shopware-mage-tasks
使用MagePHP部署shopware项目的常用任务
1.0.0-RC1
2022-08-30 08:28 UTC
Requires
- php: ^8.0
- andres-montanez/magallanes: ^3.0 || ^4.0
- league/flysystem: ^1.0
Requires (Dev)
- best-it/php_codesniffer: ^3.4 || ^4.0.0-RC1
- league/flysystem-memory: ^1.0
- mikey179/vfsstream: ^1.6.6
- phpunit/phpunit: ^9.0
- vlucas/phpdotenv: ^3.3
Suggests
- b3nl/sw-migrations: This library is needed if you want to use the task shopware/migrate
- dev-master
- 1.0.0-RC1
- 0.10.0
- 0.9.5
- 0.9.4
- 0.9.3
- 0.9.2
- 0.9.1
- 0.9.0
- 0.8.2
- 0.8.1
- 0.8.0
- 0.7.0
- 0.6.0
- 0.5.6
- 0.5.5
- 0.5.4
- 0.5.3
- 0.5.2
- 0.5.1
- 0.5.0
- 0.4.3
- 0.4.2
- 0.4.1
- 0.4.0
- 0.3.12
- 0.3.11
- 0.3.10
- 0.3.9
- 0.3.8
- 0.3.7
- 0.3.6
- 0.3.5
- 0.3.4
- 0.3.3
- 0.3.2
- 0.3.1
- 0.3.0
- 0.2.3
- 0.2.2
- 0.2.1
- 0.2.0
- 0.1.1
- 0.1.0
- dev-feature/cleanup-structure
- dev-feature/add-config-values-for-showare-6-deployments
- dev-feature/tar-prepare-subfolder-task
- dev-globbified-setenvparameterstask
- dev-feature/DEVHEAD-53-migration-shop-path
- dev-bugfix/set-env-task-defaults
- dev-bugfix/#42-set-env-task-failing
- dev-develop
This package is auto-updated.
Last update: 2024-08-29 05:06:31 UTC
README
此软件包包含使用MagePHP部署shopware项目的常用任务。
.mage.yml 示例
magephp: php_executable: /usr/bin/php # Leave this empty if you want to use the globally installed php executable. custom_tasks: - BestIt\Mage\Tasks\Deploy\DeployTask - BestIt\Mage\Tasks\Deploy\Tar\PrepareSubfolderTask # replaces the original deploy/tar/prepare task - BestIt\Mage\Tasks\Env\CreateEnvFileTask - BestIt\Mage\Tasks\Env\SetEnvParametersTask - BestIt\Mage\Tasks\Env\RecursiveSetEnvParametersTask - BestIt\Mage\Tasks\Misc\CopyTask - BestIt\Mage\Tasks\Misc\DenyRobotsTxtTask - BestIt\Mage\Tasks\Misc\SubComposerInstallTask - BestIt\Mage\Tasks\Opcode\BuildCleaner - BestIt\Mage\Tasks\Opcode\CleanReset - BestIt\Mage\Tasks\Release\PrepareTask - BestIt\Mage\Tasks\Release\SwPrepareTask - BestIt\Mage\Tasks\Shopware\ApplyMigrationsTask - BestIt\Mage\Tasks\Shopware\CommandTask - BestIt\Mage\Tasks\Shopware\UpdateLegacyPluginsTask - BestIt\Mage\Tasks\Shopware\UpdatePluginsTask environments: prod: user: apache host_path: /var/www/html releases: 4 # Add php_executable in environment options to overwrite the global configuration above php_executable: /usr/bin/env/path/to/php # Add console_script_path in environment options to overwrite the default ./bin/console console_script_path: ./bin/console hosts: - production_server1 pre-deploy: - env/create-env-file: file: '.env' whitelist: - foo - bar # Prefix - env/set-env-parameters: { file: 'configs/config_prod.php', prefix: 'ENV_', placeholderWrapper: '__' } # Iterates over all module sub directories, looking for parameter.xml..dist files and creates parameter.xmls from them. - env/recursive-set-env-parameters: { directory: 'custom/plugins/PluginName/Module', fileName: 'parameter.xml.dist', prefix: 'ENV_', encodeForXml: true, deleteTargets: true } - misc/deny-robots-txt: { folder: 'OPTIONAL_LOCAL_FOLDER' } - opcode/build-cleaner: { doc_root: 'RELATIVE_DOC_ROOT for saving the cleaner script.' } on-deploy: - composer/sub-install: flags: '--no-dev' globs: - '/var/www/parent/*/composer.json' - '/custom/*/*/composer.json' # Skips default prepare task which is not needed. - deploy/release/prepare # Creates new release directory and copies all content of current into the created directory. - prepare/sw-structure: { timeout: 500 } # Creates a new symlink. - fs/link: { from: '../../media', to: 'media' } - fs/link: { from: '../../files', to: 'files' } # Pushes file(s) to server(s). # If strict is true, it will actually do a sync (i.e. delete files that do not exist locally anymore). # Otherwise it would just upload&overwrite without touching files that do not exist locally anymore. - deploy: { from: 'configs/config_prod.php', to: './config.php' } - deploy: { from: 'scripts/remote/', to: './scripts/', strict: true, timeout: 500 } - deploy: { from: 'libraries/', to: './engine/Library/', strict: false } - deploy: { from: 'legacy_plugins/Community/', to: 'engine/Shopware/Plugins/Community/', strict: false } - deploy: { from: 'legacy_plugins/Local/', to: 'engine/Shopware/Plugins/Local/', strict: true } - deploy: { from: 'plugins/', to: 'custom/plugins/', strict: true } - deploy: { from: 'licenses/', to: 'licenses/', strict: true } # Execute "raw" command on remote host. - exec: { cmd: './var/cache/clear_cache.sh', desc: 'Clear shopware cache.' } # Updates all (>=5.2 system) plugins on server(s). # Single remote command for executing updates is activated, default false. # Plugin refresh before update command is activated, default true. - shopware/update-plugins: { single_remote_command: true, plugin_refresh: true } # Updates all (legacy) plugins on server(s). "Sources" are the Community/Local folders. - shopware/update-legacy-plugins: { sync_sources_folders: true, single_remote_command: false } # Executes all SQL migrations on server(s). Both parameters are optional. - shopware/migrate: { table_suffix: 'bestit', migration_dir: 'sql' } # Executes remote the shopware commands # If ignoreReturnValue is true all return values of the command will be ignored. # The usage of this option should be considered carefully because with this options no differentiation # between an successful command call and an error command call is possible. # This option is necessary because specific shopware commands like plugin install will indicate an # if the plugin is already installed # Installs an activate an plugin - shopware/command: { cmd: 'sw:plugin:install --activate Cron', ignoreReturnValue: true } # Warms up the shopware theme cache on server(s). - shopware/command: { cmd: 'sw:theme:cache:generate' } post-deploy: - opcode/build-cleaner: doc_root: 'RELATIVE_DOC_ROOT for saving the cleaner script.' urls: - $APPSERVER_URL_1 - $APPSERVER_URL_2 - $APPSERVER_URL_3
安装
步骤 1: Composer
运行
composer require bestit/shopware-mage-tasks --dev
步骤 2: .mage.yml
在项目根目录中创建一个 .mage.yml 文件,并根据上面的示例定义所需的任务。有关更多信息,请参阅文档。
步骤 3: 部署目标上的初始文件夹结构
在使用 mage 部署之前,您需要手动设置文件夹结构,因为原始的 mage deploy/release/prepare-task 被跳过,并替换为 perform an ordinary file copy from CURRENT to the newly created REALEASE 的 prepare/sw-structure-task。
- host_path on SERVER
- current -> release/initial (Symlink)
- release
- initial
- bin
- configs
- custom
- engine
- files -> ../../files (Symlink)
- media -> ../../media (Symlink)
- recovery
- scripts
- themes
- var
- vendor
- web
...
- media
- files
步骤 4: 完成即可!
您只需运行部署脚本即可
vendor/bin/mage deploy <environment>
许可证
本软件开源,采用MIT许可证。