Skip to content
This repository has been archived by the owner on Feb 9, 2023. It is now read-only.

Latest commit

 

History

History
127 lines (87 loc) · 4.52 KB

File metadata and controls

127 lines (87 loc) · 4.52 KB

Project Setup: Magento2 (WSL 2)

Documentation > Project setup > Magento2

Table of Contents

  1. Configuring magento2 project
  2. Start project
  3. Important Locations

==============================================================================

==============================================================================

Stack Requirement

Install and configure the following services

1. Configuring magento2 project

Step 1. Build a structure

  1. At the root of your project, add a config directory (e.g. config/pleaz). This will be used to store all important files for the services.

  2. Add the docker config files

touch config/pleaz/linux/{.env,docker-compose.yml,services/php-fpm/php-fpm.conf}

The structure should look like this:

config/
└── pleaz/
    └── linux/
        ├── .env
        ├── docker-compose.yml
        └── services
            └── php-fpm
                └── php-fpm.conf

Step 2. Configure Docker environment file

1. Configure the environment

Edit the file config/pleaz/linux/.env and replace all content by: .env.magento-sample

The following Variables must be completed. Other variables are optional.

  • COMPOSE_PROJECT_NAME= "Name of your project"
  • DOMAIN_URL= "Your domain URL without http(s)"
  • ELASTICSEARCH_IMAGE= "Docker image used"
  • DATABASE_IMAGE= "Docker image used"
  • REDIS_IMAGE= "Docker image used"
  • NGINX_IMAGE= "NGINX image used"
  • PHP_FPM_IMAGE= "PHP-FPM image used"
  • PHP_CLI_IMAGE= "PHP-CLI image used"

To find existing official version of the service images

2. Configure services container

docker-compose

Edit the file config/pleaz/linux/docker-compose.yml and replace all content by: docker-compose.magento.yml

php-fpm

Edit the file config/pleaz/linux/services/php-fpm/php-fpm.conf and replace all content by: php-fpm.conf


Step 3. Create locally trusted SSL Certificates

Please see instruction here: SSL certificates

For Magento2, you must create a wildcard SSL Certificate with the name magento.crt and magento.key

Open WSL 2 terminal and execute:

~/mkcert-linux -cert-file ~/.local/share/certs/ssl/magento.crt -key-file ~/.local/share/certs/ssl/magento.key "*.local.test"

For multiple-Domain Wildcard SSL, just add domain at the end of the command:

ie: *.local.test and *.dev.test

~/mkcert-linux -cert-file ~/.local/share/certs/ssl/magento.crt -key-file ~/.local/share/certs/ssl/magento.key "*.local.test" "*.dev.test"

2. Start project

cd config/pleaz/linux

## Start docker services
docker-compose up -d

## Stop docker services
docker-compose down

## Execute magento commands
docker exec -it --user=www <project-name>-deploy <your-command>
#e.g.
docker exec -it --user=www myproject-deploy magento-command cache:flush

3. Important locations

  • pleaz Configuration directory -> <PROJET_ROOT>/config/pleaz