Skip to content

Commit d5d460e

Browse files
committed
Update the Docker documentation
1 parent 3d1a787 commit d5d460e

File tree

5 files changed

+34
-9
lines changed

5 files changed

+34
-9
lines changed

deployment/docker.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,26 @@ API Platform projects can be run through [Docker](https://www.docker.com/).
44
A [Docker compose](https://docs.docker.com/compose/) configuration including a fully working [LAMP](https://en.wikipedia.org/wiki/LAMP_(software_bundle))
55
stack is shipped with the API Platform distribution.
66

7+
## Services
8+
9+
The Docker Compose configuration comes with several ready-use services by default:
10+
11+
| Name | Description | Port(s)
12+
| ------- | ------------------------------------------------------------- | -------
13+
| app | The application with PHP and PHP-FPM 7.1, the latest Composer | N/A
14+
| db | A database provided by MySQL 5.7 | N/A
15+
| nginx | An HTTP server provided by Nginx 1.11 | 8080
16+
| varnish | An HTTP cache provided by Varnish 4.1 | 80
17+
18+
## Installation
19+
720
To install it, run the following commands (Docker must be installed on your system):
821

922
$ docker-compose up -d # Download, build and run Docker images
1023
$ docker-compose exec app bin/console doctrine:schema:create # Create the MySQL schema
1124

12-
Your project will be accessible at the URL `http://127.0.0.1`.
25+
Your project will be accessible in two different ways:
26+
* Through the HTTP cache (Varnish): `http://localhost`
27+
* Through the HTTP server directly (Nginx) to facilitate debugging: `http://localhost:8080`
1328

1429
Previous chapter: [Deploying an API Platform App on Heroku](heroku.md)

distribution/index.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,27 @@ asynchronous jobs to your APIs is very straightforward.
3535

3636
## Installing the framework
3737

38-
### In Docker container
38+
### In Docker containers
3939

4040
API Platform is shipped with a [Docker](https://docker.com) setup that makes it easy to get a containerized development
41-
environment up and running. This setup contains an image pre-configured with PHP 7, Apache and everything needed to run API
42-
Platform and a MySQL image to host the database.
41+
environment up and running. This setup contains a [Docker Compose](https://docs.docker.com/compose/) configuration with
42+
several pre-configured and ready-use services with everything needed to run API Platform:
43+
44+
| Name | Description | Port(s)
45+
| ------- | ------------------------------------------------------------- | -------
46+
| app | The application with PHP and PHP-FPM 7.1, the latest Composer | N/A
47+
| db | A database provided by MySQL 5.7 | N/A
48+
| nginx | An HTTP server provided by Nginx 1.11 | 8080
49+
| varnish | An HTTP cache provided by Varnish 4.1 | 80
50+
4351

4452
Start by [downloading the API Platform Standard Edition archive](https://api.github.com/repos/api-platform/api-platform/zipball) and extract its content.
4553
The resulting directory contains an empty API Platform project structure. You will add your own code and configuration inside
4654
it.
4755
Then, if you do not already have Docker on your computer, [it's the right time to install it](https://www.docker.com/products/overview#/install_the_platform).
4856

4957
Open a terminal, and navigate to the directory containing your project skeleton. Then, run the following command to start
50-
Apache and MySQL using [Docker Compose](https://docs.docker.com/compose/):
58+
all services using [Docker Compose](https://docs.docker.com/compose/):
5159

5260
$ docker-compose up -d # Running in detached mode
5361

distribution/testing.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,11 @@ The API Platform flavor of Behat also comes with a temporary SQLite database ded
160160

161161
Clear the cache of the `test` environment:
162162

163-
$ docker-compose app bin/console cache:clear --env=test
163+
$ docker-compose exec app bin/console cache:clear --env=test
164164

165165
Then run:
166166

167-
$ docker-compose run --rm app vendor/bin/behat
167+
$ docker-compose exec app vendor/bin/behat
168168

169169
Everything should be green now. Your Linked Data API is now specified and tested thanks to Behat!
170170

index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@
102102
1. [Introduction](deployment/index.md)
103103
2. [Deploying an API Platform App on Heroku](deployment/heroku.md)
104104
3. [Using API Platform with Docker](deployment/docker.md)
105+
1. [Services](deployment/docker.md#services)
106+
2. [Installation](deployment/docker.md#installation)
105107

106108
## Extra
107109

schema-generator/getting-started.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ types:
5353
5454
Run the generator with this config file as parameter:
5555
56-
$ docker-compose exec app vendor/bin/schema generate-types src/ app/config/schema.yml
56+
$ vendor/bin/schema generate-types src/ app/config/schema.yml
5757
5858
The following classes will be generated:
5959
@@ -745,7 +745,7 @@ When cardinality cannot be automatically extracted, it's value is set to `unknow
745745

746746
Usage:
747747

748-
$ docker-compose exec app vendor/bin/schema extract-cardinalities
748+
$ vendor/bin/schema extract-cardinalities
749749

750750
Previous chapter: [Introduction](index.md)
751751

0 commit comments

Comments
 (0)