Skip to content

diskerror/m2install

 
 

Repository files navigation

Magento 2 Bash Install/Restore Script

Build Status Code Climate Packagist GitHub closed pull requests GitHub closed issues

This script is designed to simplify the installation process of Magento 2 and rapid deployment of merchant code and DB dumps.

m2install can be a helpful tool for support teams and teams who often need to install or deploy merchant backups or dumps.

The main purpose of this script is run m2install, wait a bit and get a working magento instance. Don't waste time on routine operations.

If you have any issues please report them to https://github.com/rwoodbury/m2install/issues

What can m2install exactly do?

  • Can automatically restore backup files created by
  • php bin/magento setup:backup --code --db
  • Can automatically restore support dumps created by Enterpsie Support Tool
  • php bin/magento support:backup:code (db)
  • Script can automatically install vanilla magento

What does this fork add?

  • Wraps deployed dumps with a local git repository.
  • When using -s git it will pull from local git repository as a worktree.

Installation

Download latest version by curl

curl -o m2install.sh https://raw.githubusercontent.com/rwoodbury/m2install/master/m2install.sh

In case you are using bash completion you can download completion for this script.

#For Linux User
curl -o /etc/bash_completion.d/m2install-bash-completion https://raw.githubusercontent.com/rwoodbury/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/rwoodbury/m2install/master/m2install-bash-completion

Usage

$ 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.
    -v, --version                        Magento Version from Composer or GIT Branch
    -b, --new-branch [MDVA-123]          New branch name if using work tree. Parameter is optional.
                                             If empty then "MDVA-<directory name>" will be used.
    -d, --sample-data                    Install sample data.
    --ee                                 Install Enterprise Edition.
    -f, --force                          Install/Restore without any confirmations.
    --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_db restore_code configure_db configure_files configure install_magento)
                                         Specify step through comma without spaces.
                                         - Example: $(basename "$0") --step restore_db,configure_db
    --restore-table                      Restore only the specific table from DB dumps
    --debug                              Enable debug mode

How to deploy backup/support dumps

In order to deploy the customer dumps you need:

  • Put DB and code dumps to new directory
  • Go to directory and run m2install

How to install Magento 2 using GIT

To install Magento 2 from git repository run m2install with --source git param

  • m2install --source git or
  • m2install -s git

Repository data can come from a remote source or a local repository using the git worktree add construct. See parameter names at the start of the install script. These can be preset in your configuration file.

How to install Magento 2 using Composer

To install Magento 2 from composer run m2install with --source composer param

  • m2install --source composer or
  • m2install -s composer

How to Install Magento 2 with Sample Data

  • Run m2install
  • Use wizard to install the sample data.

Wizard

m2install shows you wizard on first run and prompts to save entered values to config file.

$ m2install.sh
Current Directory: /Users/rwoodbury/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]

How to use configuration files

The config file allows you to store params for DB and URL. Example of config file

HTTP_HOST=http://your-mage-host.com/
BASE_PATH=your/base/path/${CURRENT_DIR_NAME}
DB_HOST=localhost
DB_USER=root
DB_PASSWORD=dbpassword

When you first run m2install script, it shows wizard which prompts to save the config file to your home directory.

m2install uses fallback mechanism to find config files recursively from home directory to current directory. For example if you want to install magento to directory ~/www/m2/ga/magento2ee

you can override config file which is placed in your home directory.

~/.m2install.conf
~/www/.m2install.conf
~/www/m2/.m2install.conf
~/www/m2/ga/.m2install.conf
~/www/m2/ga/magento2ee/.m2install.conf

About

Magento 2 Bash Install/Restore Script

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Shell 100.0%