This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Getting Started

Getting started with Magento CLI and running things locally

Prerequisites

Magento CLI is designed to work wtih docker and docker-compose, and requires a locally installed verison of php to use the built-in php server. If you are running php locally, you will also need to provide tools like composer.

Installation

Binaries are compiled with every release, you can grab it from the releases page, and use it as-is. These files are fit to be ran directly, from $PATH, or even committed i.e. /path/to/iac-repo/bin/magento-cli and invoked with cd /path/to/iac-repo/ && bin/magento-cli.

Homebrew

Installing with brew is the preferred way to install for most use-cases. Homebrew installs the tool globally, and is updated with every release.

    brew tap blueacorninc/magento-cli
    brew install magento-cli

Compiling From Source

If you prefer to compile from source, the Makefile can be used:

    git clone git@github.com:blueacorninc/magento-cli.git 
    cd magento-cli
    make install # runs `go build .` and copies to /usr/local/bin

Running Source Locally

    cd example/
    composer install
    go run .. serve

Try it out!

Once installed, you can test out the tool against any project!

cd example
composer install # lets install the php deps
magento install # runs setup:install and creates config.php and env.php

magento serve # That's it!

1 - MacOS

Requires php, docker and docker-compose.

Install docker and docker-compose using the Docker Installation Guide.

Review the Homebrew Installation Article for more information on how to confgiure PHP using this tool.

2 - Usage

Basic usage conventions and information

.magento-cli directories

A project repostiory can override the default configuration by storing replacement services or tasks yaml directories in .magento-cli. For example, let’s say you would like to change the database docker composition, you canc create .magento-cli/services/database.yaml and this file will be interpreted when you run magento serve instead of the version sourced by magento-cli.