Table of Contents
MageStack natively supports Composer and comes with a built in installer for the tool.
Ways of running composer
You can install and run composer in the conventional way for Linux for a global installation. This provides a less secure, but more compatible way of using Composer (eg. if Git repositories are accessed via Composer).
Via security wrapper
As with all tools run by command line, they should to be run in a wrapper to guarantee the application is running solely within the domain group environment, this prevents any ambiguity between the
acc environments (as the PHP versions and environment is identical when run in a wrapper)
Composer is installed globally using the default installation method.
cd /home/www-data curl -sS https://getcomposer.org/installer | php chmod +x composer.phar
If you want to make the binary available to all users, you should use the
root account to copy it to
su -l root mv /home/www-data/composer.phar /usr/local/bin/composer exit
Then you can access composer using the
composer binary name.
Via security wrapper
Composer is installed on a per
domain-group/domain basis, you only need to install it once per Magento instance. Start by identifying your domain group name and domain name, in our example we'll use
example.com respectively. Once you know these, we can pass it to the installation script
! The following should be run as the
[~]$ /microcloud/scripts_ro/composer_install.sh composer_install.sh Usage: composer_install.sh [domain-group] [domain] domain-group Domain group (eg. example) domain Domain name (eg. example.com) subdomain Subdomain (eg. www|http)
So now its just a case of running the script with your options
[~]$ /microcloud/scripts_ro/composer_install.sh example example.com http Downloading Composer ... Success: Composer is installed, use the command "cm_examplecom" to run - you must log out/in for this to be loaded
Once installed, you can either reload your
bash profile for the new function to be available, or log out/in to your SSH session. You can reload your
bash profile like this:
Then you can access the tool using the new alias that has been created
[~]$ cm_examplecom ______ / ____/___ ____ ___ ____ ____ ________ _____ / / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/ / /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ / \____/\____/_/ /_/ /_/ .___/\____/____/\___/_/ /_/ Composer version 1.0-dev (f10c71475167a4661225b14560ca0a400d730829) 2015-03-29 14:37:42 Usage: command [options] [arguments] Options: --help (-h) Display this help message --quiet (-q) Do not output any message --verbose (-v|vv|vvv) Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug --version (-V) Display this application version --ansi Force ANSI output --no-ansi Disable ANSI output --no-interaction (-n) Do not ask any interactive question --profile Display timing and memory usage information --working-dir (-d) If specified, use the given directory as working directory. Available commands: about Short information about Composer archive Create an archive of this composer package browse Opens the package's repository URL or homepage in your browser. clear-cache Clears composer's internal package cache. clearcache Clears composer's internal package cache. config Set config options create-project Create new project from a package into given directory. depends Shows which packages depend on the given package diagnose Diagnoses the system to identify common errors. dump-autoload Dumps the autoloader dumpautoload Dumps the autoloader global Allows running commands in the global composer dir ($COMPOSER_HOME). help Displays help for a command home Opens the package's repository URL or homepage in your browser. info Show information about packages init Creates a basic composer.json file in current directory. install Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json. licenses Show information about licenses of dependencies list Lists commands remove Removes a package from the require or require-dev require Adds required packages to your composer.json and installs them run-script Run the scripts defined in composer.json. search Search for packages self-update Updates composer.phar to the latest version. selfupdate Updates composer.phar to the latest version. show Show information about packages status Show a list of locally modified packages update Updates your dependencies to the latest version according to composer.json, and updates the composer.lock file. validate Validates a composer.json