Build system setup
You can have one build system that meets the following requirements:
-
All Commerce 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:
app/etc/config.php
generated
directory (and subdirectories)pub/media
directorypub/media/wysiwyg
directory (and subdirectories)pub/static
directory (and subdirectories)
-
Must have a compatible PHP version installed
-
Must have Composer installed
-
It has file system ownership and permissions set as discussed in Prerequisite for your development, build, and production systems.
-
The build system does not need Commerce to be installed, but the code must be available to it.
config.php
; see Export the configuration. Otherwise, the database connection is required.Configure the build machine
The following sections discuss how to configure the build machine.
Install Composer
First, check if Composer is already installed:
In a command prompt, enter any of the following commands:
composer --help
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 Commerce server.
-
Enter the following commands:
code language-bash curl -sS https://getcomposer.org/installer | php
code language-bash mv composer.phar /usr/local/bin/composer
For additional installation options, see the Composer installation documentation.
Install PHP
Install PHP on CentOS or Ubuntu.
Set up the build system
To set up the build system:
-
Log in to the build system as, or switch to, the file system owner.
-
Retrieve the Commerce code from source control.
If you use Git, use the following command:
code language-bash git clone [-b <branch name>] <repository URL>
-
Change to the Commerce root directory and enter:
code language-bash composer install
-
Wait for dependencies to update.
-
Set ownership:
code language-bash chown -R <Commerce file system owner name>:<web server username> .
For example,
code language-bash chown -R commerce-username:apache .
-
If you use Git, open
.gitignore
in a text editor. -
Start each of the following lines with a
#
character to comment them out:code language-conf # app/etc/config.php # pub/media/* # generated/* # pub/media/*.* # pub/media/wysiwyg/* # pub/static/*
-
Save your changes to
.gitignore
and exit the text editor. -
If you use Git, use the following commands to commit the change:
code language-bash git add .gitignore && git commit -m "Modify .gitignore for build and production"
See the
.gitignore
reference for more information. -
The build system should use default mode or developer mode:
code language-bash bin/magento deploy:mode:set <mode>
<mode>
is required. It can be eitherdefault
ordeveloper
.