kaliop/ezpublish5universalinstaller
Composer 安装命令:
composer require kaliop/ezpublish5universalinstaller
包简介
The eZ5 Universal Installer toolset
README 文档
README
A package which makes deploying your installations a breeze. Developed for eZPublish5, works with eZPlatform 1 and 2.
Installation
-
Add this package as requirement to your project via composer: in composer.json
... "require": { ... "kaliop/ezpublish5universalinstaller": "*", ... }, ...
Execution
Different commands are available, all through a command-line application. To see the list of commands, run:
php bin/ezp5installer.php
(assuming that the top-level bin folder is set to 'bin' in composer.json, as it is by default in eZPublish)
Most commands need to have an environment defined to successfully execute. This can be set either using the '--env' option, or the SYMFONY_ENV environment variable
Feature: managing legacy settings
-
This allows to keep the settings for eZP Legacy somewhere in your eZ5 repository, outside of a Legacy Extension
-
You can store them in any dir you like, default is 'ezpublish/legacy_settings'
-
Both 'common' settings and 'per environment' settings files are allowed, with the latter overwriting the former if a file is present in both locations
-
Settings files are symlinked by default. On windows, when run as not-admin, they get copied over
-
The command to deploy the settings is:
php bin/ezp5installer.php legacy-settings:install --env <env> -
The expected structure of settings folders is:
Structure: <baseDir> |- common | |- override | |- *.ini | |- siteaccess | |- <name> | |- *.ini |- <env> |- override | |- *.ini |- siteaccess |- <name> |- *.ini
Feature: managing per-environment configuration (apache, solr, etc)
-
This makes it possible to keep files like .htaccess in the project, with one version per env or one global version, and deploy them to a target dir (inside the eZP root dir or even outside of it)
-
Using a similar subdirectory structure as legacy settings; the default dir for storing the files is 'ezpublish/misc_files'
-
The command to deploy the files is:
php bin/ezp5installer.php misc:install --env <env>If one of the target files exists and is not a symlink, deployment will fail. Use the '-o' option to allow overwrites
Feature: cleaning the database from temporary data
While developing the site, the eZ db will accumulate 'temporary cruft' in some tables, like the most searched-for contents, pending notifications and last visited pages for logged-in users.
While it is not mandatory to do so, it is a good idea to remove this data before shipping the db to UAT/PROD.
One of the available commands: database:cleanup is designed to do so.
It is also a useful tool if you use full database dumps at any point in time, and want to compare them by using 'diff' or similar tools.
Feature: purging the Memcache cache
See the memcache:purge command, eg:
php bin/ezp5installer.php memcache:purge
NB: only works when eZPublish is set up using yml config files
Feature: purging the Varnish server
See the varnish:purge command, eg:
php $DIR/ezp5installer.php varnish:purge --key=ezpublish.system.my_siteaccess_group.http_cache.purge_servers
NB: only works when eZPublish is set up using yml config files
Feature: purging the OPCache cache
In order to achieve that, we have to make an http request to the web server. One way is to:
-
set up a script to purge opcache in the web root
<?php if (function_exists('opcache_reset')) { opcache_reset(); echo 'OK'; } else { echo 'KO'; } -
protect access to it, so that it can only be requested by the deployment scripts. Ex. Apache htaccess config
# Allow ONLY TRUSTED IPS to send calls to clean the OPCache RewriteCond %{REMOTE_ADDR} ^127\.0\.0\.1 RewriteRule ^clearopcache.php - [L] -
add the url to be used to connect to the web server in some per-env. config, eg: parameters.yml
parameters: opcache_purge_url: http://localhost/clearopcache.php -
use the http:request command, eg:
php bin/ezp5installer.php http:request --key=parameters.opcache_purge_url
NB: only works when eZPublish is set up using yml config files
Feature: getting a config value
In order to allow you to build complex shell scripts for deployment, there is a small helper which gives you config values. Eg:
DBUSER=`php ./bin/ezp5installer.php config:get --key=doctrine.dbal.connections.my_project_repository_connection.user --env=uat`
Feature: etc...
No more features available at this point in time!
For an inspiration, take a look at the doc/reference folder, esp. at the phing file in there...
Developers notes
-
the ezp5installer.php app HAS to run even when eZP is misconfigured or not configured at all. So it can not just hook into the kernel. Ideally, it should work even when it is installed outside eZP, or without it (eg on a server with only solr)
-
the core logic for commands has to be in classes in the Common namespace, and not tied to the SF Commands
-
in the future we might also expose each Sf commands as Composer commands (via php classes with the good API). Advantage: they are easier to make independent of the base OS.
-
problem: how to make the ezp5installer commands use configuration options which depend on the environment? Discussion:
- at the moment the environment which is being deployed is defined by using SYMFONY_ENV env var: easy peasy
- some commands will probably need more configuration than a couple of cli switches/env vars. Where to store it? We can not hardcode the current environment in composer.json!
- a1: in composer.json, "extra" section, have a top-level key, say 'ez5ui', with sub-value per environment: ez5ui..this.that This is easy to do but a bit messy. Also, it does not work well if we keep the dedicated-command-line-tool approach
- a2: we keep the settings for the installer in a dedicated yaml file, with a known location, which depends on the environment. We could even use keys in the 'extra' section to define the location of the file (with a default value of course) to make it super flexible... (problem: the dedicated-cli-tool would not know about the extras values, but we can add cli switches for that)
To Do
-
make autoload work when this project is used standalone
-
make our commands able to echo something: inject a simple logger by default (eg https://bitbucket.org/fool/echolog), and an appropriate one when working in composer-command mode
-
add a command which does a cleanup of images in var directory which do not exist anymore in ezimage table (same with binary files)
-
instead of relying on composer autoload for the yml parser, copy it inside this project
kaliop/ezpublish5universalinstaller 适用场景与选型建议
kaliop/ezpublish5universalinstaller 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 14.43k 次下载、GitHub Stars 达 5, 最近一次更新时间为 2016 年 05 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 kaliop/ezpublish5universalinstaller 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 kaliop/ezpublish5universalinstaller 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 14.43k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0
- 更新时间: 2016-05-18