pkp / docker-ojs

Open Journal Systems (OJS) is a journal management and publishing system.
GNU General Public License v3.0
60 stars 45 forks source link

Add compose configuration for development environment #17

Open nuest opened 4 years ago

nuest commented 4 years ago

It would be interesting to have a specific compose configuration for plug-in development.

I've made a first attempt at this during the sprint in Heidelberg earlier this year, but did not get it to work fully: https://github.com/pkp/docker-ojs/compare/master...nuest:dev_image

So this issue is mostly to make sure others thinking along the same lines may profit from the first steps taken there. IMO the following bits are important:

Alternative things to try out:

marcbria commented 3 years ago

Sorry for the silence Daniel and thanks a lot for the initiative.

As far as "master" is now "main" the link is broken but you work is still reachable here: https://github.com/pkp/docker-ojs/compare/pkp:main...nuest:dev_image

I feel like will need to move to multi-stage before we start a dev image, but you list of ideas is definitively a very good starting point.

Two additional tools that I think would be nice to add to this dev image (or stack) are:

Keep talking about this in this thread.

marcbria commented 3 years ago

Additional tooling extracted from PKP dev team channel.

About xdebug, to install it in a Dockerfile (over the php:7.4-apache) we only need two lines:

RUN yes | pecl install xdebug-2.8.1 \
    && echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini

Jonas details the client side configuration in the dev's channel as follows:

As ::1 will try to contact the image itself, I configured the router to assign a static IP to my machine and I've got such settings:

xdebug.remote_enable=on
xdebug.profiler_enable_trigger=on
xdebug.remote_host 192.168.0.100

There must be a better way to do it (without passing environment arguments), but I didn't mind about researching :slightly_smiling_face:

Then in vscode I just added a setting to map the root folder in docker with my local working folder, this is my config (see the /var/www/html):

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Listen for XDebug",
            "type": "php",
            "request": "launch",
            "port": 9000,
            "pathMappings": {
                "/var/www/html": "${workspaceRoot}"
            }
        },
        {
            "name": "Launch currently open script",
            "type": "php",
            "request": "launch",
            "program": "${file}",
            "cwd": "${fileDirname}",
            "port": 9000
        }
    ]
}
luisfelipe3d commented 2 years ago

any update?

marcbria commented 2 years ago

Not sorrry Luís. We are overwhelmed and this is not a priority now. But PRs are more than welcome... so feel free to create a docker-compose-dev.yml in the way you like.

Cheers, m.