Installation Using Docker Desktop on macOS

This guide covers building new projects based on Shopsys Platform. If you want to contribute to Shopsys Platform itself, you need to install the whole shopsys/shopsys monorepo. Take a look at the article about Monorepo for more information.

This solution uses Mutagen (for relatively fast two-way synchronization of the application files between the host machine and Docker volume).

Requirements

Steps

1. Create new project from Shopsys Platform sources

composer create-project shopsys/project-base --no-install --keep-vcs --ignore-platform-reqs
cd project-base

Notes

  • The --no-install option disables installation of the vendors - this will be done later in the Docker container
  • The --keep-vcs option initializes GIT repository in your project folder that is needed for diff commands of the application build and keeps the GIT history of shopsys/project-base
  • The --ignore-platform-reqs option ensures your local PHP setup is not verified (it is not needed, everything is installed in Docker later)

2. Installation

Now, you have two options:

Option 1

In the case you want to start demo of the application as fast as possible, you can simply execute the installation script and that is all:

./scripts/install.sh

Note

--skip-aliasing may be used in case you have already enabled second domain, or you do not want to enable it for some reason. When using this option you will not be asked for sudo password.

After the script is finished with installing the application, you can skip all the other steps and see the last chapter of Application Setup Guide to get all the important information you might need right after the installation.

Option 2

If you want to know more about what is happening during installation, continue with the steps #2.1 - #2.5.

2.1 Enable second domain (optional)

There are two domains each for different language in default installation. First one is available via IP adress 127.0.O.1 and second one via 127.0.0.2. 127.0.0.2 is not alias of 127.0.0.1 on Mac by default. To create this alias in network interface run:

sudo ifconfig lo0 alias 127.0.0.2 up

2.2. Create docker-compose.yml and mutagen.yml

Create docker-compose.yml from template docker-compose-mac.yml.dist and mutagen.yml from template mutagen.yml.dist.

cp docker/conf/docker-compose-mac.yml.dist docker-compose.yml
cp docker/conf/mutagen.yml.dist mutagen.yml

2.3 Set the UID and GID to allow file access in mounted volumes

Because we want both the user in host machine (you) and the user running php-fpm in the container to access shared files, we need to make sure that they both have the same UID and GID. This can be achieved by build arguments www_data_uid and www_data_gid that should be set to the same UID and GID as your own user in your docker-compose.yml. You can find out your UID by running id -u and your GID by running id -g. Once you get these values, set these values into your docker-compose.yml into php-fpm container definition by replacing values in args section. Update also defaultOwner and defaultGroup in mutagen.yml to match your UID and GID.

2.4 Build and start containers using Mutagen

On macOS, you want to synchronize folders using Mutagen as it enables faster performance than current implementation in Docker Desktop.

Option A: Use the helper script (recommended)

./scripts/mutagen-up.sh

Option B: Manual steps

# 1. Start sidecar containers for Mutagen (with the 'mutagen' profile)
docker compose --profile mutagen up -d --build

# 2. Start Mutagen file synchronization
mutagen project start

# 3. Wait for initial sync to complete (check status with: mutagen sync list)
#    Look for "Watching for changes" status

# 4. Start all remaining containers
docker compose up -d

Tip

Once Mutagen is running and containers are up, you use standard docker and docker compose commands like you are used to. ```

Note

The mutagen project start command reads the mutagen.yml configuration file and creates synchronization sessions between your local filesystem and the Docker volumes via sidecar containers.

Note

To stop the environment (keeps containers): sh ./scripts/mutagen-stop.sh To remove containers completely: sh ./scripts/mutagen-down.sh

Note

During the build of the Docker containers there will be installed 3-rd party software as dependencies of Shopsys Platform by Dockerfile with licenses that are described in document Open Source License Acknowledgements and Third-Party Copyrights

2.5 Set up the application

Application setup guide