Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

[WIP] MCLOUD-6557: Re-invent Cloud Docker documentation #7732

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions src/_data/main-nav.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,11 @@

- label: Cloud development
children:
- label: Local development
- label: Docker development
url: /cloud/docker/docker-development.html
versionless: true

- label: Configure and launch Docker
url: /cloud/docker/docker-config.html
versionless: true

- label: Docker quick reference
- label: Quick reference
url: /cloud/docker/docker-quick-reference.html
versionless: true

Expand Down
76 changes: 51 additions & 25 deletions src/_data/toc/cloud-guide.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,31 +158,51 @@ pages:
url: /cloud/howtos/sample-data.html
versionless: true

- label: Docker development
- label: Cloud Docker development
url: /cloud/docker/docker-development.html
versionless: true
children:
- label: Docker container architecture
url: /cloud/docker/docker-containers.html
- label: Requirements
url: /cloud/docker/docker-requirements.html
versionless: true

- label: Installation
url: /cloud/docker/docker-installation.html
versionless: true
children:
- label: Service containers
url: /cloud/docker/docker-containers-service.html
- label: Additional tools for file synronization
url: /cloud/docker/docker-installation-developer.html
versionless: true

- label: CLI containers
url: /cloud/docker/docker-containers-cli.html

- label: Upgrading
url: /cloud/docker/docker-upgrade.html
versionless: true

- label: Usage
url: /cloud/docker/docker-usage.html
versionless: true
children:
- label: Production mode
url: /cloud/docker/docker-mode-production.html
versionless: true
- label: Synchronizing data
url: /cloud/docker/docker-syncing-data.html

- label: Developer mode
url: /cloud/docker/docker-mode-developer.html
versionless: true
- label: Configure Docker

- label: Configuration
url: /cloud/docker/docker-config.html
versionless: true
children:
- label: Xdebug for Docker
- label: Config sources
url: /cloud/docker/docker-config-sources.html
versionless: true

- label: Manage cron jobs
url: /cloud/docker/docker-manage-cron-jobs.html
versionless: true

- label: Configure Xdebug
url: /cloud/docker/docker-development-debug.html
versionless: true

Expand All @@ -198,10 +218,6 @@ pages:
url: /cloud/docker/docker-split-db.html
versionless: true

- label: Manage cron jobs
url: /cloud/docker/docker-manage-cron-jobs.html
versionless: true

- label: Extend Docker
url: /cloud/docker/docker-extend.html
versionless: true
Expand All @@ -210,14 +226,20 @@ pages:
url: /cloud/docker/docker-config-blackfire-io.html
versionless: true

- label: Launch Docker
children:
- label: Developer mode
url: /cloud/docker/docker-mode-developer.html
- label: Container architecture
url: /cloud/docker/docker-containers.html
versionless: true
children:
- label: Service containers
url: /cloud/docker/docker-containers-service.html
versionless: true

- label: CLI containers
url: /cloud/docker/docker-containers-cli.html
versionless: true

- label: Production mode
url: /cloud/docker/docker-mode-production.html
- label: Synchronizing data
url: /cloud/docker/docker-syncing-data.html
versionless: true

- label: Functional Testing
Expand All @@ -230,9 +252,13 @@ pages:
url: /cloud/docker/docker-test-magecloud-pkg-code.html
versionless: true

- label: Docker quick reference
- label: Quick reference
url: /cloud/docker/docker-quick-reference.html
versionless: true

- label: Troubleshooting
url: /cloud/docker/docker-troubleshooting.html
versionless: true

- label: Integrations
url: /cloud/integrations/cloud-integrations.html
Expand Down
32 changes: 32 additions & 0 deletions src/cloud/docker/docker-config-sources.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
group: cloud-guide
title: Configure Docker environment
functional_areas:
- Cloud
- Setup
- Configuration
redirect_from:
- /cloud/reference/docker-config.html
---

Magento Cloud Docker supports both Magento Cloud installation and standalone installation.
This results in different configuration sources set.

TBD: CONFIG PREFERENCE LEFT TO RIGHT

CLI -> Universal config -> Magento Cloud

## Magento Cloud configuration

If you have Magento Cloud and would like to emulate the environment - make sure you have next files:

- `.magento.app.yaml`
- `.magento/services.yaml`

## Unified configuration

If you do not have Magento Cloud confgiuration files or don't want to use them - Magento Cloud Docker supports unified configuration file.

## CLI configuration

The CLI configuration is the quickest way to change some settings of desired enviroenmnt.
64 changes: 1 addition & 63 deletions src/cloud/docker/docker-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,64 +9,6 @@ redirect_from:
- /cloud/reference/docker-config.html
---

`{{site.data.var.mcd-prod}}` deploys Magento to a read-only file system by default in the Docker environment, which mirrors the read-only file system deployed in the Production environment. You have the option to deploy a Docker environment in developer mode, which provides an active development environment with full, writable filesystem permissions.

You use the `ece-docker build:compose` command to generate the Docker Compose configuration to deploy {{site.data.var.ece}} to a local Docker environment.

{: .bs-callout-warning }
The `ece-docker build:compose` command overwrites the existing `docker-compose.yml` configuration file. You can save your customizations for the Docker Compose configuration in a `docker-compose.override.yml` file. See a detailed example in the [Docker quick reference][docker-reference].

## Prerequisites

To get started with local development you must have [Docker] installed on your workstation. In addition, macOS and Windows systems require either [docker-sync] or [Mutagen] for file synchronization between the host and Docker environments.

### Optional Steps

Magento Cloud Docker binds to port `80` on your host environment. If you have enabled the bundled web server on your workstation you must stop the service before launching the Docker environment.

```bash
sudo apachectl stop
```

## Set the launch mode

You can launch a Docker environment in production or developer mode by setting the `mode` option on the `ece-docker build:compose` command:

- **Production mode**—The `--mode="production"` setting supports an active production environment with read-only filesystem permissions. This is the default configuration setting for launching a Docker environment. Selecting this option builds the Docker environment in production mode and verifies configured service versions. See [Production mode launch instructions][prod-mode].
- **Developer mode**—The `--mode="developer"` setting supports an active development environment with full, writable filesystem permissions. Selecting this option builds the Docker environment in developer mode and verifies configured service versions. System performance is slower in developer mode because of additional file synchronization operations. See [Developer mode launch instructions][dev-mode].

For example, the following command starts the Docker configuration generator for the developer mode:

```bash
./vendor/bin/ece-docker build:compose --mode="developer"
```

To skip the interactive mode, use the `-n, --no-interaction` option.

{:.bs-callout-info}
The mode option for the `ece-docker build:compose` command does not affect the Magento mode. It determines the {{site.data.var.ece}} file system installation and read-only or read-write behavior.

## Stop and start containers

You can stop containers and restore them afterwards using the following methods.

Action | Command
------ | -------
Suspend containers to continue your work later | `docker-compose stop`
Stop and remove all containers, images, and volumes | `docker-compose down`
Start containers from a suspended state | `docker-compose start`
Stop the synchronization daemon | `docker-sync stop`
Start the synchronization daemon | `docker-sync start`

Use the following command to stop and remove the Docker configuration:

```bash
docker-compose down -v
```

{: .bs-callout-warning}
This command removes all components of your local Docker instance including containers, networks, volumes, and images except for the persistent database and the `magento-sync` volume. See [Rebuild a clean environment][refresh].

## Run Composer with Docker

You can run composer using the `docker` command before you create the container instance. This technique is useful to create an application instance during the CI/CD build process, or even during first time Magento set up.
Expand Down Expand Up @@ -105,18 +47,14 @@ echo "127.0.0.1 magento2.test" | sudo tee -a /etc/hosts

The default {{ site.data.var.mcd-prod }} configuration includes the [MailHog] service as a replacement for the Sendmail service. Sendmail can cause performance issues in the local Docker environment.

When the MailHog service is installed, go to the following URL to open the service and view outgoing emails: `http://magento2.docker:8025`
When the MailHog service installed, go to the following URL to open the service and view outgoing emails: `http://magento2.docker:8025`

[php]: https://www.php.net/manual/en/install.php
[Composer]: https://getcomposer.org
[Docker]: https://www.docker.com/get-started
[docker-reference]: {{site.baseurl}}/cloud/docker/docker-quick-reference.html
[docker-sync]: https://docker-sync.readthedocs.io/en/latest/getting-started/installation.html
[mutagen]: https://mutagen.io/documentation/introduction/installation
[prod-mode]: {{site.baseurl}}/cloud/docker/docker-mode-production.html
[dev-mode]: {{site.baseurl}}/cloud/docker/docker-mode-developer.html
[enable Xdebug]: {{site.baseurl}}/cloud/docker/docker-development-debug.html
[Database container]: {{site.baseurl}}/cloud/docker/docker-containers-service.html#database-container
[refresh]: {{site.baseurl}}/cloud/docker/docker-containers.html#rebuild-a-clean-environment
[Docker Hub PHP Image Tag]: https://hub.docker.com/r/magento/magento-cloud-docker-php/tags
[MailHog]: https://github.com/mailhog/MailHog
1 change: 0 additions & 1 deletion src/cloud/docker/docker-containers-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ group: cloud-guide
title: Docker CLI Containers
functional_areas:
- Cloud
- Docker
- Configuration
---

Expand Down
27 changes: 1 addition & 26 deletions src/cloud/docker/docker-containers-service.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ group: cloud-guide
title: Docker services containers
functional_areas:
- Cloud
- Docker
- Configuration
---

Expand Down Expand Up @@ -77,31 +76,7 @@ If your Cloud project uses Magento version 2.3.5 or earlier with MySQL search, a

### Troubleshooting

On some Linux systems, when you launch the Docker environment, the Elasticsearch service fails to start and the following error displays:

```terminal
ERROR: [1] bootstrap checks failed
[1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
```

To fix the error, run the following `sysctl` command to increase the memory map area allocation.

```bash
sysctl -w vm.max_map_count=262144
```

{:.procedure}
To permanently update the system setting for `vm.max_map_count`:

1. Edit the sysctl configuration file (`etc/sysctl.conf`) and set the required value for the `vm.max_map_count` option.

1. Reboot your system.

1. Run the following command to verify the change.

```bash
sysctl vm.max_map_count
```
[Troubleshooting section]({{site.baseurl}}/cloud/docker/docker-troubleshooting.html#elasticsearch)

## FPM container

Expand Down
2 changes: 1 addition & 1 deletion src/cloud/docker/docker-development-debug.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ functional_areas:
- Cloud
- Setup
- Configuration
- Debug
- Testing
---

Xdebug is an extension for debugging your PHP code. {{site.data.var.mcd-prod}} provides a separate container to handle Xdebug requests in the Docker environment. Use this container to enable Xdebug and debug PHP code in your Docker environment without affecting your {{site.data.var.ece}} project configuration.
Expand Down
38 changes: 8 additions & 30 deletions src/cloud/docker/docker-development.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,24 @@
---
group: cloud-guide
title: Docker development
title: Cloud Docker development
functional_areas:
- Cloud
- Docker
- Configuration
---

{{site.data.var.mcd-prod}} provides an option to deploy {{site.data.var.ee}} to a Docker environment for development, test, and automation tasks.

The {{site.data.var.ece}} Docker environment requires three, essential components: a {{site.data.var.ee}} v2 template, Docker Compose, and the {{site.data.var.ece}} `{{site.data.var.ct}}` package.
## Features

{%include cloud/note-docker-config-reference-link.md%}
- **Cross-platform support**—Supports Linux, macOS and Windows with WSL2
- **Magento Cloud emulation**-Provides a Cloud-like deployment pipeline and filesystem to test code locally before deploying your {{ site.data.var.ece }} project to Staging or Production servers
- **Multiple sync options**-Provides three file synchronization options (native, mutagen and docker-sync) for best performance in the Docker environment
- **Extensibility**-Use standard Docker configuration file to extend and customize your development environment

## Host Operating Systems

The Cloud Docker environment supports Linux, macOS, and Windows operating systems. The containers should run on any Docker host, but some of the set up scripts require you to install PHP and Composer.
The {{ site.data.var.mcd-prod }} environment supports Linux, macOS, and Windows operating systems. The containers can run on any Docker host, but some setup scripts require you to install PHP and Composer.

## Gather credentials

Prior to setting up a local workspace, gather the following credentials and accounts:

- **Magento authentication keys (Composer keys)**

Magento authentication keys are 32-character authentication tokens that provide secure access to the Magento 2 Composer repository (repo.magento.com), and any other Git services required for Magento development such as GitHub. Your account can have multiple Magento authentication keys. For the workspace setup, start with one specific key for your code repository. If you do not have any keys, contact the Account Owner to create them, or create the [Magento authentication keys] yourself.

- **Cloud Project account**

The License Owner or Technical Admin (Super User) should invite you to the {{site.data.var.ece}} project. When you receive the e-mail invitation, click the link and follow the prompts to create your account. See [Set up an account] for details.

- **Magento Encryption Key**

When importing an existing Magento system only, capture the Magento encryption key used to protect your access and data for the Magento database. For details on this key, see [Resolve issues with encryption key].

## Launch a Docker environment

You can use the Docker environment to emulate the {{site.data.var.ece}} Integration and production environments for local development and testing. You need three, essential components: a {{site.data.var.ee}} v2 template, Docker Compose, and {{site.data.var.ece}} `{{site.data.var.ct}}` package.

- [Docker architecture and common commands]({{site.baseurl}}/cloud/docker/docker-containers.html)
- [Launch Docker development environment]({{site.baseurl}}/cloud/docker/docker-config.html)
TBD

[config docker]: {{site.baseurl}}/cloud/docker/docker-config.html
[Magento authentication keys]: {{site.baseurl}}/guides/v2.3/install-gde/prereq/connect-auth.html
[Set up an account]: {{site.baseurl}}/cloud/before/before-workspace.html#newaccount
[Resolve issues with encryption key]: {{site.baseurl}}/cloud/trouble/trouble-crypt-key-variable.html
1 change: 0 additions & 1 deletion src/cloud/docker/docker-extend.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ group: cloud-guide
title: Extend the Docker configuration
functional_areas:
- Cloud
- Docker
- Configuration
---

Expand Down
Loading