-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add debugging section to the core manual #560
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
Conversation
core/debugging.md
Outdated
# the different stages of this Dockerfile are meant to be built into separate images | ||
# https://docs.docker.com/compose/compose-file/#target | ||
|
||
+ARG BUILD_ENV=prod |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's used in line 43, to distinguish between the prod
and dev
image. The alternative would be to override the build target
for the php service.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea was to add a stage before doing all the composer stuff and before the entrypoints are set. Otherwise it would probably also require to re-set the entrypoints as they are set in api_platform_php, for the dev stage too. And that leads to duplicate code. But I'm usually not a docker user, so please correct me if I'm wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The alternative would be to override the build target for the php service.
Yes, that is what should be done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This dev stage cannot be here. It'll get in the way of other stages. 😄
It has to be at the end, as I've mentioned in #560 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You only need to re-set the ENTRYPOINT
if you're setting CMD
. If you don't change that, it'll simply use what's already set in the base image.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right. It makes sense said like that and keeps things simpler
core/debugging.md
Outdated
ARG VARNISH_VERSION=6.0 | ||
|
||
-FROM php:${PHP_VERSION}-fpm-alpine AS api_platform_php | ||
+FROM php:${PHP_VERSION}-fpm-alpine AS api_platform_php_prod |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please keep this stage untouched, but instead put the api_platform_php_dev
stage at the very end of the Dockerfile
(after Varnish).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, with this change we don't have to use diff format, but just say to append to the end of the Dockerfile
.
core/debugging.md
Outdated
@@ -0,0 +1,83 @@ | |||
# Debugging | |||
|
|||
The default docker stack is shipped without a xdebug/dev stage. It is easy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docker => Docker
xdebug => Xdebug.
Remove /dev
?
It is => It's
develoment => development
api => API
core/debugging.md
Outdated
|
||
## Add a development stage to the Dockerfile | ||
|
||
To avoid deploying api-platform to production with an active xdebug extension, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
api-platform => API Platform
xdebug => Xdebug
is is => it's
8ebc0b7
to
8edd55a
Compare
core/debugging.md
Outdated
|
||
The default Docker stack is shipped without a Xdebug stage. It's easy | ||
though to add [Xdebug](https://xdebug.org/) to your project, for development | ||
purposes such as debugging tests or api requests remotely. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
api -> API
core/debugging.md
Outdated
ARG XDEBUG_VERSION=2.6.0 | ||
RUN apk add --no-cache $PHPIZE_DEPS; \ | ||
pecl install xdebug-$XDEBUG_VERSION; \ | ||
docker-php-ext-enable xdebug |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ARG XDEBUG_VERSION=2.6.0
RUN set -eux; \
apk add --no-cache --virtual .build-deps $PHPIZE_DEPS; \
pecl install xdebug-$XDEBUG_VERSION; \
docker-php-ext-enable xdebug; \
apk del .build-deps
core/debugging.md
Outdated
|
||
## Configure Xdebug with docker-compose override | ||
|
||
Using a [override](https://docs.docker.com/compose/reference/overview/#specifying-multiple-compose-files) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a -> an
core/debugging.md
Outdated
docker-php-ext-enable xdebug | ||
``` | ||
|
||
## Configure Xdebug with docker-compose override |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Configure Xdebug with Docker Compose Override
(since we use title case)
core/debugging.md
Outdated
though to add [Xdebug](https://xdebug.org/) to your project, for development | ||
purposes such as debugging tests or api requests remotely. | ||
|
||
## Add a development stage to the Dockerfile |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a Development Stage to the Dockerfile
(since we use title case)
core/debugging.md
Outdated
# | ||
# Choose some other port than `9000`, as this one is already occupied by FPM | ||
# Make sure to also change your listening port in the IDE to this value | ||
XDEBUG_CONFIG: remote_enable=1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
XDEBUG_CONFIG: >-
remote_enable=1
...
(folded scalar, with "strip" block chomping)
core/debugging.md
Outdated
|
||
```yml | ||
version: '3.4' | ||
services: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wrong indentation (remove leading space)
core/debugging.md
Outdated
|
||
## Troubleshooting | ||
|
||
Inspect the installation with the following command, the requested Xdebug |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inspect the installation with the following command. The requested Xdebug version should be displayed in the output.
Thanks for this in-depth review. I will fix the rest soon. |
Thanks @hschaeidt. Very useful PR! |
resolves #551