Skip to content

Update the Docker documentation #248

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 7, 2017
Merged
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
17 changes: 16 additions & 1 deletion deployment/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,26 @@ API Platform projects can be run through [Docker](https://www.docker.com/).
A [Docker compose](https://docs.docker.com/compose/) configuration including a fully working [LAMP](https://en.wikipedia.org/wiki/LAMP_(software_bundle))
stack is shipped with the API Platform distribution.

## Services
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a link to this section or even copy it in the getting started guid? It must be known from the very beginning .

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR updated @dunglas


The Docker Compose configuration comes with several ready-use services by default:

| Name | Description | Port(s)
| ------- | ------------------------------------------------------------- | -------
| app | The application with PHP and PHP-FPM 7.1, the latest Composer | N/A
| db | A database provided by MySQL 5.7 | N/A
| nginx | An HTTP server provided by Nginx 1.11 | 8080
| varnish | An HTTP cache provided by Varnish 4.1 | 80

## Installation

To install it, run the following commands (Docker must be installed on your system):

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

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

Previous chapter: [Deploying an API Platform App on Heroku](heroku.md)
15 changes: 11 additions & 4 deletions distribution/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,26 @@ asynchronous jobs to your APIs is very straightforward.

## Installing the framework

### In Docker container
### In Docker containers

API Platform is shipped with a [Docker](https://docker.com) setup that makes it easy to get a containerized development
environment up and running. This setup contains an image pre-configured with PHP 7, Apache and everything needed to run API
Platform and a MySQL image to host the database.
environment up and running. This setup contains a [Docker Compose](https://docs.docker.com/compose/) configuration with
several pre-configured and ready-use services with everything needed to run API Platform:

| Name | Description | Port(s)
| ------- | ------------------------------------------------------------- | -------
| app | The application with PHP and PHP-FPM 7.1, the latest Composer | N/A
| db | A database provided by MySQL 5.7 | N/A
| nginx | An HTTP server provided by Nginx 1.11 | 8080
| varnish | An HTTP cache provided by Varnish 4.1 | 80

Start by [downloading the API Platform Standard Edition archive](https://api.github.com/repos/api-platform/api-platform/zipball) and extract its content.
The resulting directory contains an empty API Platform project structure. You will add your own code and configuration inside
it.
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).

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

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

Expand Down
4 changes: 2 additions & 2 deletions distribution/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,11 @@ The API Platform flavor of Behat also comes with a temporary SQLite database ded

Clear the cache of the `test` environment:

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

Then run:

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

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

Expand Down
2 changes: 2 additions & 0 deletions index.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@
1. [Introduction](deployment/index.md)
2. [Deploying an API Platform App on Heroku](deployment/heroku.md)
3. [Using API Platform with Docker](deployment/docker.md)
1. [Services](deployment/docker.md#services)
2. [Installation](deployment/docker.md#installation)

## Extra

Expand Down
4 changes: 2 additions & 2 deletions schema-generator/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ types:

Run the generator with this config file as parameter:

$ docker-compose exec app vendor/bin/schema generate-types src/ app/config/schema.yml
$ vendor/bin/schema generate-types src/ app/config/schema.yml

The following classes will be generated:

Expand Down Expand Up @@ -745,7 +745,7 @@ When cardinality cannot be automatically extracted, it's value is set to `unknow

Usage:

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

Previous chapter: [Introduction](index.md)

Expand Down