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

Updates and Revisions to the Cloud Docker Documentation #6363

Merged
merged 22 commits into from
Jan 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
66b630b
Merge pull request #1 from magento/master
aepod Dec 23, 2019
61d45d2
Started restructuring, rewrote main page and added a few more pages u…
Dec 26, 2019
506aa71
Refactoring docker containers page.
Dec 26, 2019
68efedd
More writting on the docker containers page.
Dec 31, 2019
32f366d
More details on containers being added.
Jan 1, 2020
f8f5f74
Merged origin/Cloud-Docker-1.0.0 changes manually into the changes I …
Jan 8, 2020
5f44d35
revisions to the cloud docker documetation
Jan 8, 2020
1f1f45d
Revisions to the docker documentation.
Jan 8, 2020
a8e5cee
Removed extra spaces, and fixed a few typos pointed out by Oleg.
Jan 9, 2020
e47c86c
Fixed one more typo
Jan 9, 2020
f3371e6
Fixed cloud docker md files with dos2unix
Jan 10, 2020
d1cf347
Fixed all linting required in Cloud Docker documentation
Jan 10, 2020
aee4db8
Changed verbage on the docker image labels for bullet points
Jan 10, 2020
9dccee6
Merge remote-tracking branch 'upstream/Cloud-2002.1.0'
meker12 Jan 11, 2020
c01edb7
Merge remote-tracking branch 'upstream/Cloud-2002.1.0'
meker12 Jan 11, 2020
577616b
Fixed docker topic references in release notes
meker12 Jan 11, 2020
23d8482
Merge pull request #3 from aepod/mae-fix-merge-conflicts-sync-with-in…
aepod Jan 11, 2020
6ea1550
Merge branch 'master' of https://github.com/aepod/devdocs into aepod-…
meker12 Jan 13, 2020
80bc806
Merge pull request #4 from aepod/aepod-master
aepod Jan 13, 2020
231c992
Apply suggestions from code review
aepod Jan 13, 2020
468a701
Update src/cloud/docker/docker-containers-service.md
aepod Jan 13, 2020
b6b509f
Apply suggestions from code review
aepod Jan 13, 2020
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
26 changes: 15 additions & 11 deletions src/_data/toc/cloud-guide.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,34 +117,38 @@ pages:
url: /cloud/docker/docker-containers.html
versionless: true
children:
- label: Database container
url: /cloud/docker/docker-database.html
- label: Service containers
url: /cloud/docker/docker-containers-service.html
versionless: true

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

- label: PHP container
url: /cloud/docker/docker-php.html
- label: Syncing Data
url: /cloud/docker/docker-syncing-data.html
versionless: true


- label: Connect to the database
url: /cloud/docker/docker-database.html
versionless: true

- label: Configure Docker
url: /cloud/docker/docker-config.html
versionless: true
children:
- label: Xdebug for Docker
url: /cloud/docker/docker-development-debug.html
versionless: true

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

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

- label: Extend Docker
url: /cloud/docker/docker-extend.html
versionless: true
Expand All @@ -156,7 +160,7 @@ pages:
- label: Docker quick reference
url: /cloud/docker/docker-quick-reference.html
versionless: true

- label: Integrations
url: /cloud/integrations/cloud-integrations.html
versionless: true
Expand Down
133 changes: 133 additions & 0 deletions src/cloud/docker/docker-containers-cli.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
---
group: cloud-guide
title: Docker CLI Containers
functional_areas:
- Cloud
- Docker
- Configuration
---

## CLI Containers

The CLI containers provide `magento-cloud` and `{{site.data.var.ct}}` commands to perform file system operations and to interact with the application.

The following CLI containers, most of which are based on a [PHP-CLI version 7 image](https://hub.docker.com/r/magento/magento-cloud-docker-php), provide `magento-cloud` and `{{site.data.var.ct}}` commands to perform file system operations:

- `build`—extends the CLI container to perform operations with writable filesystem, similar to the build phase
- `deploy`—extends the CLI container to use read-only file system, similar to the deploy phase
- `cron`—extends the CLI container to run cron
- `node`—based on node image, used for NPM activities

For example, you can check the state of the your project using the _ideal-state_ wizard:

Run the `{{site.data.var.ct}}` ideal-state command.

```bash
docker-compose run deploy ece-command wizard:ideal-state
```

Sample response:

```terminal
- Your application does not have the "post_deploy" hook enabled.
The configured state is not ideal
```
{:.no-copy}

All build and deploy processes are defined and configured using {{site.data.var.ct}} and the Magento Cloud template.

### CLI Container Commands

These commands are available in any of the containers.

| Command | Target Containers | Notes
| ------------- | ------------------ |------------------
| cloud-build | build | Used to build the application in production mode, configured via build hook in .magento.app.yml
| cloud-deploy | deploy | Used to deploy the application, configured via deploy hook in .magento.app.yml
| cloud-post-deploy | deploy | Used to deploy the application, configured via deploy hook in .magento.app.yml
| ece-command | deploy | Used to run other commands from ece-tools CLI Tool
| magento-command | deploy | Used to run bin/magento commands
| magento-installer | deploy | Just runs build and then deploy hooks
| mftf-command | deploy | Used to run MFTF command for testing
| run-cron | cron | Used to run cron jobs

To explore what any of the commands are doing, take a look at the scripts in the github [Cloud Docker Repository](https://github.com/magento/magento-cloud-docker/tree/develop/images/php/cli/bin)

### Build Container

#### Container Information

- Name: build
- Docker Base Image: [magento/magento-cloud-docker-php](https://hub.docker.com/r/magento/magento-cloud-docker-php)
- Docker Image Based On: [php](https://hub.docker.com/_/php)

This container is used for the build process. This mimics Magento Cloud behaviour so testing of the build and deploy process is as close to production as possible.

#### Container Usage

This container can be used to run commands manually recreating steps from the build process.
```
docker-compose run build magento-command setup:static-content:deploy
```

### Cron Container

#### Container Information

- Name: cron
- Docker Base Image: [magento/magento-cloud-docker-php](https://hub.docker.com/r/magento/magento-cloud-docker-php)
- Docker Image Based On: [php](https://hub.docker.com/_/php)

This container is used for the cronjob, it runs the scheduled cronjobs and can also be used to do one off cron runs.

#### Container Usage

The Cron container is based on PHP-CLI images, and executes operations in the background immediately after the Docker environment start. It uses the cron configuration defined in the [`crons` property of the `.magento.app.yaml` file]({{ site.baseurl }}/cloud/project/project-conf-files_magento-app.html#crons). To view the cron log:

```bash
docker-compose run deploy bash -c "cat /app/var/cron.log"
```

- The `setup:cron:run` and `cron:update` commands are not available on Cloud and Docker for Cloud environment
- Cron only works with the CLI container to run the `./bin/magento cron:run` command

This container has no extra configuration, however if performance problems from cron runs are present you can use the following snippet in your docker-compose.override.yml

```yaml
cron:
entrypoint: "bash -c"
```
This disables the cron container from running automatically.

You can then run the cron manually using the following command.

```bash
docker-compose run cron /usr/local/bin/php bin/magento cron:run
```

### Deploy Container

#### Container Information

- Name: deploy
- Docker Base Image: [magento/magento-cloud-docker-php](https://hub.docker.com/r/magento/magento-cloud-docker-php)
- Docker Image Based On: [php](https://hub.docker.com/_/php)

This container is used for the deploy process. This mimics Magento Cloud behaviour so testing of the build and deploy process is as close to production as possible.

#### Container Usage

This container can be used to interact with the application.
```
docker-compose run build magento-command index:reindex
```

### Node Container

#### Container Information

- Name: node
- Docker Base Image: [node](https://hub.docker.com/_/node)

#### Container Usage
The Node container is based on the [official Node Docker image](https://hub.docker.com/_/node/). It can be used to install NPM dependencies, such as Gulp, or run any Node-based command line tools.
175 changes: 175 additions & 0 deletions src/cloud/docker/docker-containers-service.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
---
group: cloud-guide
title: Docker services containers
functional_areas:
- Cloud
- Docker
- Configuration
---


The following containers provide the services required to build, deploy and run {{site.data.var.ee}} sites.

{:.bs-callout-info}
See the [service version values available]({{ site.baseurl }}/cloud/docker/docker-containers.html#service-versions) for use when launching Docker.

### Database Container

#### Container Information

- Name: db
- Docker Base Image: [mariadb](https://hub.docker.com/_/mariadb)
- Ports Exposed 3306

#### Container Usage

To import a database dump, place the SQL file into the `.docker/mysql/docker-entrypoint-initdb.d` directory.

When a database container is started for the first time, a new database with the specified name is created and initialized using the configuration variables specified in the docker-compose configuration. The initial start up process also executes all files with extensions .sh, .sql and .sql.gz that are found in the `/docker-entrypoint-initdb.d` directory. Files are executed in alphabetical order.

From: [mariadb docker documentation](https://hub.docker.com/_/mariadb)

Although it is a more complex approach, you can use GZIP by _sharing_ the `.sql.gz` file using the `.docker/mnt` directory and importing it inside the Docker container.

MySQL configuration can be injected into the container at creation. The following two examples show how this is done, either using an included `my.cnf` file, or setting the variables correctly.

Add a custom `my.cnf` via the `docker-compose.override.yml` file:
```yaml
db:
volumes:
- path/to/custom.my.cnf:/etc/mysql/conf.d/custom.my.cnf
```

Alternatively, you can set configuration values in the environment section of the` docker-compose.override.yml` file:
```yaml
db:
environment:
- innodb-buffer-pool-size=134217728
```

### Elasticsearch Container

#### Container Information

- Name: elasticsearch
- Docker Base Image: [magento/magento-cloud-docker-elasticsearch](https://hub.docker.com/r/magento/magento-cloud-docker-elasticsearch)
- Docker Image Based On: [elasticsearch](https://hub.docker.com/_/elasticsearch)
- Ports Exposed: 9200,9300

#### Container Usage

Standard Elasticsearch container with required plugins and configurations for {{site.data.var.ee}}.

### FPM Container

#### Container Information

- Name: fpm
- Docker Base Image: [magento/magento-cloud-docker-php](https://hub.docker.com/r/magento/magento-cloud-docker-php)
- Docker Image Based On: [php](https://hub.docker.com/_/php)
- Ports Exposed: 9000,9001

#### Container Usage

You can load custom extensions in the FPM configuration by adding the configuration to the `docker-compose.override.yml` file. This configuration is applied when you build and deploy.
```bash
generic:
environment:
- 'PHP_EXTENSIONS=bcmath bz2 calendar exif gd gettext intl mysqli pcntl pdo_mysql soap sockets sysvmsg sysvsem sysvshm opcache zip redis xsl xdebug'
```

For additional information about configuring the php environment, see the [XDebug for Docker]({{site.baseurl}}/cloud/docker/docker-development-debug.html) documentation.

### Rabbitmq Container

#### Container Information

- Name: rabbitmq
- Docker Base Image: [rabbitmq](https://hub.docker.com/_/rabbitmq)
- Ports Exposed: 4369,5671,5672,25672

#### Container Usage

Standard RabbitMQ Container, with no configuration or changes from Magento Cloud Docker.

### Redis Container

#### Container Information

- Name: redis
- Docker Base Image: [redis](https://hub.docker.com/_/redis)
- Ports Exposed: 6379

#### Container Usage
A standard Redis container with no customizations, no persistence or configuration is used.

Connect to and run redis commands via the redis-cli inside the container:
```bash
docker-compose run redis redis-cli -h redis
```

### TLS Container

#### Container Information

- Name: tls
- Docker Base Image: [magento/magento-cloud-docker-tls](https://hub.docker.com/r/magento/magento-cloud-docker-tls)
- Docker Image Based On: [debian:jessie](https://hub.docker.com/_/debian)
- Ports Exposed: 443

#### Container Usage

The TLS termination proxy container, based on the [magento/magento-cloud-docker-tls](https://hub.docker.com/r/magento/magento-cloud-docker-tls) image, facilitates the Varnish SSL termination over HTTPS.

To increase the timeout on this container use the following in docker-compose.override.yml:
```yaml
tls:
environment:
- TIMEOUT=600
```

### Varnish Container

#### Container Information

- Name: varnish
- Docker Base Image: [magento/magento-cloud-docker-varnish](https://hub.docker.com/r/magento/magento-cloud-docker-varnish)
- Docker Image Based On: [centos](https://hub.docker.com/_/centos)
- Ports Exposed: 80

#### Container Usage
The Varnish container is based on the [magento/magento-cloud-docker-varnish](https://hub.docker.com/r/magento/magento-cloud-docker-varnish) image. Varnish works on port 80.

`VARNISHD_PARAMS` and other environment variables can be specified using ENV, changing required parameters. This is typically done in the docker-compose.override.yml.

```yaml
varnish:
environment:
- VARNISHD_PARAMS="-p default_ttl=3600 -p default_grace=3600 -p feature=+esi_ignore_https -p feature=+esi_disable_xml_check"
```

You can clear/invalidate the Varnish cache using the following command

```bash
docker-compose exec varnish varnishadm ban req.url '~' '.'
```

### Web Container

#### Container Information

- Name: web
- Docker Base Image: [magento/magento-cloud-docker-nginx](https://hub.docker.com/r/magento/magento-cloud-docker-nginx)
- Docker Image Based On: [centos](https://hub.docker.com/_/centos)
- Ports Exposed: none

#### Container Usage
The Web container uses nginx to handle web requests after TLS and Varnish. It passes all requests to the fpm container.

The nginx config for this container is the standard Magento [nginx config](https://github.com/magento-dockerhub/magento-cloud-docker/blob/master/images/nginx/1.9/etc/vhost.conf). This can be changed by mounting a new config using a volume.

```yaml
web:
volumes:
- path/to/custom.nginx.conf:/etc/nginx/conf.d/default.conf
```
Loading