You can have one build system that meets the following requirements:
- All Magento code is under source control in the same repository as the development and production systems
Make sure all of the following are included in source control:
generateddirectory (and subdirectories)
pub/media/wysiwygdirectory (and subdirectories)
pub/staticdirectory (and subdirectories)
- Must have a compatible PHP version installed
- Must have Composer installed
- It has Magento file system ownership and permissions set as discussed in Prerequisite for your development, build, and production systems.
- The build system does not need Magento to be installed, but the code must be available to it.
The database connection not required if it is already contained in
config.php (see Export the configuration). Otherwise, the database connection is required.
The build machine can be on its own host or on the same host as an installed Magento system.
Configure the build machine
The following sections discuss how to configure the build machine.
First, check if Composer is already installed:
In a command prompt, enter any of the following commands:
composer list --help
If command help displays, Composer is already installed.
If an error displays, use the following steps to install Composer.
To install Composer:
Change to or create an empty directory on your Magento server.
Enter the following commands:
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
For additional installation options, see the Composer installation documentation.
Set up the build system
To set up the build system:
- Log in to the build system as, or switch to, the Magento file system owner.
Retrieve the Magento code from source control.
If you use Git, use the following command:
git clone [-b <branch name>] <repository URL>
Change to the Magento root directory and enter:
- Wait for Magento dependencies to update.
chown -R <magento file system owner name>:<web server username> .
chown -R magento_user:apache .
- If you use Git, open
.gitignorein a text editor.
Start each of the following lines with a
#character to comment them out:
1 2 3 4 5 6
# app/etc/config.php # pub/media/* # generated/* # pub/media/*.* # pub/media/wysiwyg/* # pub/static/*
- Save your changes to
.gitignoreand exit the text editor.
If you use Git, use the following commands to commit the change:
git add .gitignore && git commit -m "Modify .gitignore for build and production"
.gitignorereference for more information.