Debugging PHP in ISLE: a Kludge
In an earlier post I chronicle the exhaustive steps taken to create a “debuggable” local/development instance of Digital.Grinnell that behaves exactly like the real thing, except with a much smaller, portable FEDORA repository under it. I’m claiming success on that front, but there is one glaring kludge in the process that I have yet to work out.
The Kludge
So, my debugging of an ISLE stack involves the coordinated configuration and engagement of XDebug inside the Apache container, and PHPStorm, along with persistence of the stack’s PHP codebase… and therein lies the rub.
The purpose of my local instance was to verify that all of the latest stack improvements work properly in the Digital.Grinnell environment, so naturally I built a stack using all of the latest code; not at all difficult in ISLE. However, since the codebase is assembled, it can’t easily be mapped or mounted for persistence, at least not initially since mounting it from the host suggests that it must exist BEFORE the stack is assembled. Just to be clear, a persistent mount of the code is critical for PHPStorm, since the code on the host is used to edit, set breakpoints, and a slew of other typical “debug” activities.
For reference, the code I’m interested in debugging lies in the Apache container on the /var/www/html/sites/all/modules
path. The “override” technique I’m using here is essentially what’s suggested/documented in https://docs.docker.com/compose/extends/.
My approach to this so far is to:
- Build and launch the stack without mapping anything to
/var/www/html/...
. This allows ISLE to assemble the latest copy of each component. - After verifying that the stack works, use
docker cp
on the host to copy the new code from the Apache container back to the host, like so:
- `cd ~/Projects/ISLE; docker cp isle-apache-ld:/var/www/html ./persistent/html`
- Now, alter the
docker-compose.override.yml
file to include all of the necessary debug configuration bits (see this post for additional details). - Build and launch ISLE again using
docker-compose up -d
, just like before. The difference is that with./persistent/html
now mapped into the container, PHPStorm debugging will work as it should.
In my opinion, Step 2 + Step 3 = kludge
. The question is…
How can I get around this and still build a pristine ISLE for both evaluation AND debugging?
And that’s a wrap. Until next time…