-
-
Notifications
You must be signed in to change notification settings - Fork 0
Docker Local Environment For A New Project
The docker local environment containers in the basic configuration have 1 file and 2 directories:
- docker-compose.yml - Docker compose stack
- dev - The directory used to keep stored data for rabbitmq and redis
- src - The directory with a Magento 2 source code
Example of the directory structure:
- Install, run and verify that Docker Local Services working properly.
For the predefined configurations you need to:
- Create a project directory. Create an empty directory with the name:
dev
. Create an empty directory with the name:src
. - Copy Magento 2 source code to the
src
directory. - Copy a YML file with to the project directory. (List Of Exmaple YML Files)
- Rename the YML file to
docker-compose.yml
and update project code and domain in the file. The example file has project codemag22
and project domainmag22.test
. - Run containers from the project directory using the command
docker-compose up -d
Don't forget to add your project domain to the your OS hosts file. For example: mag22.test
127.0.0.1 mag22.test
NOTE: The hosts file location may be unique to a OS. The common hosts file path is C:\Windows\System32\drivers\etc for Windows or /etc/hosts for Linux
- Magento 2 + Redis + Elasticsearch + RabbitMQ View
- Magento 2 + Redis + Elasticsearch + RabbitMQ + Varnish View
When you install PWA Venia Concept you will use the same docker-compose stack and frontend project will be installed locally.
- create a pwa folder for the frontend project. Magento: Setup a storefront project
- Install PWA package for your Magento 2 store:
docker-compose exec -u www cli composer require magento/pwa
docker-compose exec -u www cli bin/magento setup:upgrade
- (Optional) Install [Sample Data] (https://developer.adobe.com/commerce/pwa-studio/guides/packages/venia/sample-data/) for the sample data
- Make sure that your local environment has Node >= 16 Minimum requirements
node -v
- Setup a storefront project locally Magento Instructions
npm init @magento/pwa
- Edit pwa/.env At the PWA project’s root directory edit the .env file:
- Modify the variable MAGENTO_BACKEND_URL to be same as your Magento URL and MAGENTO_BACKEND_EDITION is a correct Magento edition.
- Run development server
npm run watch
After this you will see information on how to access the Development instance.
For Example:
NOTE: The website domain can be changed at the docker-compose.yml file
The following example where website domain is mag22.test`
Service | Host |
---|---|
Magento 2 Website | mag22.test |
Elasticsearch | elasticsearch.mag22.test |
RabbitMQ | rabbitmq.mag22.test |
Redis | redis.mag22.test |
Varnish | varnish.mag22.test |
PWA | TBD |