yvoronoy / m2install
Magento 2 Bash 安装/恢复脚本
- dev-master
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- dev-yvoronoy-patch-3
- dev-syncup
- dev-yvoronoy-patch-2
- dev-yvoronoy-patch-1
- dev-update_actions
- dev-revert-183-shellcheck
- dev-shellcheck
- dev-db-dump-validation
- dev-es-config-preselect
- dev-add_success_metric
- dev-Fix_Disable_TwoFactorAuth
- dev-fix/getTablePrefix
- dev-FIX-141
- dev-iskliarenko-patch-1
- dev-travis_unit
This package is not auto-updated.
Last update: 2024-09-14 19:47:44 UTC
README
此脚本旨在简化 Magento 2 的安装过程以及商家代码和数据库备份的快速部署。
m2install 可以作为支持团队和经常需要安装或部署商家备份或备份的团队的实用工具。
此脚本的主要目的是运行 m2install,稍作等待,然后获得一个可工作的 Magento 实例。不要浪费时间在常规操作上。
如果您有任何问题,请通过 https://github.com/yvoronoy/m2install/issues 报告
m2install 究竟能做什么?
- 可以自动恢复由
php bin/magento setup:backup --code --db
- 创建的备份文件
可以自动恢复由 Enterpsie Support Tool 创建的支持备份
- php bin/magento support:backup:code (db)
脚本可以自动安装纯 Magento
安装
curl -o m2install.sh https://raw.githubusercontent.com/yvoronoy/m2install/master/m2install.sh
通过 curl 下载最新版本
composer require yvoronoy/m2install
您可以使用 composer 安装
#For Linux User
curl -o /etc/bash_completion.d/m2install-bash-completion https://raw.githubusercontent.com/yvoronoy/m2install/master/m2install-bash-completion
#For OSX User with brew
curl -o /usr/local/etc/bash_completion.d/m2install-bash-completion https://raw.githubusercontent.com/yvoronoy/m2install/master/m2install-bash-completion
如果正在使用 bash completion
,您可以为该脚本下载完成脚本。
$ m2install.sh --help
m2install.sh is designed to simplify the installation process of Magento 2
and deployment of client dumps created by Magento 2 Support Extension.
Usage: m2install.sh [options]
Options:
-h, --help Get this help.
-s, --source (git, composer) Get source code.
-f, --force Install/Restore without any confirmations.
--sample-data (yes, no) Install sample data.
--ee Install Enterprise Edition.
--b2b Install B2B Extension.
-v, --version Magento Version - it means: Composer version or GIT Branch
--mode (dev, prod) Magento Mode. Dev mode does not generate static & di content.
--quiet Quiet mode. Suppress output all commands
--skip-post-deploy Skip the post deploy script if it is exist
--step (restore_code,restore_db Specify step through comma without spaces.
configure_db,configure_files - Example: m2install.sh --step restore_db,configure_db
installB2B --b2b - Example: m2install.sh --step installB2B --b2b
installLiveSearch) - Example: m2install.sh --step installLiveSearch
--restore-table Restore only the specific table from DB dumps
--debug Enable debug mode
--php Specify path to PHP CLI (php71 or /usr/bin/php71)
--remote-db Remote database name
--es-host, --elasticsearch-host Set the Elasticsearch host
--es-port, --elasticsearch-port Set the Elasticsearch port
--uninstall Delete database and application from the current folder
_________________________________________________________________________________________________
--ee-path (/path/to/ee) (DEPRECATED use --ee flag) Path to Enterprise Edition.
如何部署备份/支持备份
为了部署客户备份,您需要
- 将数据库和代码备份放到新目录中
- 转到目录并运行 m2install
如何使用 Git 安装 Magento 2
要从 git 存储库安装 Magento 2,请使用带有 --source git 参数的 m2install 运行
m2install --source git
或m2install -s git
如何使用 Composer 安装 Magento 2
要从 composer 安装 Magento 2,请使用带有 --source composer 参数的 m2install 运行
m2install --source composer
或m2install -s composer
如何使用示例数据安装 Magento 2
- 运行 m2install
- 使用向导安装示例数据。
如何使用 B2B 扩展安装 Magento 2
使用向导
- 运行 m2install
- 使用向导安装 B2B
使用 CLI 标志
m2install --ee --b2b
或m2install --step installB2B --b2b
如果您已经拥有 Magento EE
请记住,您必须安装企业版才能安装 B2B 扩展
向导
m2install 在首次运行时会显示向导,并提示将输入的值保存到配置文件中。
$ m2install.sh
Current Directory: /Users/yvoronoy/Sites/m2/ee202
Configuration loaded from:
Enter Server Name of Document Root (default: http://mage2.dev/):
Enter Base Path (default: ee202):
Enter DB Host (default: localhost):
Enter DB User (default: root):
Enter DB Password:
Enter DB Name (default: root_ee202):
Do you want to install Sample Data (y/N) n
Enter Path to EE or [nN] to skip EE installation: n
--------------------------------------------------
BASE URL: http://mage2.dev/ee202/
DB PARAM: root@localhost
DB NAME: root_ee202
Sample Data will NOT be installed.
Magento EE will NOT be installed.
In order to generate static/di content, add mode param: m2install.sh --mode prod
Are you sure? [y/N]
如何使用配置文件
配置文件允许您存储 DB 和 URL 的参数。配置文件示例
HTTP_HOST=http://your-mage-host.com/
BASE_PATH=your/base/path/${CURRENT_DIR_NAME}
DB_HOST=localhost
DB_USER=root
DB_PASSWORD=dbpassword
当您首次运行 m2install 脚本时,它会显示向导,并提示将配置文件保存到您的家目录。
m2install 使用回退机制从家目录递归到当前目录查找配置文件。例如,如果您想将 Magento 安装到目录 ~/www/m2/ga/magento2ee
您可以通过覆盖家目录中的配置文件来重写配置文件。
~/.m2install.conf
~/www/.m2install.conf
~/www/m2/.m2install.conf
~/www/m2/ga/.m2install.conf
~/www/m2/ga/magento2ee/.m2install.conf
如何使用 ssh 隧道进行远程数据库连接
请确保您在 .m2install.conf 文件中正确设置了参数。参数示例
REMOTE_DB_HOST=mysql-host:3306
REMOTE_HOST=user@ssh.domain
REMOTE_KEY=/Users/path/to/ssh_key
LOCAL_PORT=33060
结果您将得到
ssh -i /Users/path/to/ssh_key -o StrictHostKeyChecking=no -4fN -L 33060:mysql-host:3306 user@ssh.domain >> /dev/null
所有创建的 ssh 隧道进程 ID 位于 Magento 根目录(或 pub)中的 kill_tunnel.sh 文件中
要运行它,您只需要代码备份文件(例如 code.tar.gz)。
m2install.sh --remote-db database_name
请注意,在 --remote-db database_name 中,"_" 之前的部分是数据库用户名
请注意,在 bootstrap 中添加了 SECURE 和 UNSECURE BASE_URL 以防止修改数据库
$_ENV['CONFIG__DEFAULT__WEB__UNSECURE__BASE_URL'] = 'http://magento.local/';