Open pwaring opened 1 year ago
Sure! Go ahead and do it.
Okay, I'm working on this now.
I'm also looking at this - I was going to take a look at #333 - and I didn't want to install a load of stuff - and though that the docker approach might be cool (I use it at work for this sort of thing).
So far I have :
A Database set up script - that (i think) sets up the database correctly - there seems to be some warnings when executing
A PHP / FPM based application that I think might work - currently getting composer vendor issues
An NGINX wrapper - which passes php calls to FPM - but serves static files.
@edent - One thing I'm not sure about : the code (and the CONTRIBUTING.md file) use composer to install dependancies - but there isn't a composer.json file included? unless the composer installation includes the version number, then won't there be the possibility that developers could have different version dependencies installed?
Thanks for the prompt @computamike - I've added the composer.json file
Just to add, I'm not working on this at the moment - I couldn't get the environment file to change the cache location and eventually I gave up in frustration (still not sure what the problem was).
@pwaring - what was the issue with the cache location? at the moment I have caching working - but I'm guessing you wanted to map it somewhere else on the container so that it wasn't mapped back to the host file system?
@computamike Yes, I wanted the cache to use /tmp
inside the container, that way it wouldn't create lots of files on the host (owned by root, one of the very annoying things about Docker). My understanding of Symfony is that setting APP_CACHE_DIR="/tmp"
in the .env
file should change the cache directory, but this didn't seem to work, and neither did manually setting $_ENV['APP_CACHE_DIR']
, and stepping through with Xdebug suggested Symfony wasn't using it.
@pwaring - I thought that might be it. Caching configuration is provided by bundle configuration - https://symfonycasts.com/screencast/symfony-fundamentals/bundle-config#play
Hi @pwaring - I'd be interested in getting your opinion on my branch for adding docker support for local development - I'm putting together a guide for developers so it's not 100% yet.
https://github.com/computamike/openbenches.org/tree/Feature/docker-setup
I currently have the code volume mapped from a Windows drive (as opposed to running the code in wsl) and the page performance is not great - but I have read that storing the code like that can have performance issues.
Just an update - I'm currently attempting to get Xdebug working - but from what I can see it's just a case of open the port, install Xdebug and set up some config and off you go...
@computamike If you want an example of how to get it working in VSCode, you can lift the config from a repository I work on:
https://github.com/phpdev-uk/slim-skeleton
Specifically the launch.json:
https://github.com/phpdev-uk/slim-skeleton/blob/main/.vscode/launch.json
Dockerfile:
https://github.com/phpdev-uk/slim-skeleton/blob/main/docker/Dockerfile
xdebug.ini:
https://github.com/phpdev-uk/slim-skeleton/blob/main/docker/php/xdebug.ini
It took me a long time to get this working as everything has to match - one minor difference and it won't work, plus you won't necessarily get a helpful error message as to why...
@computamike If you want an example of how to get it working in VSCode, you can lift the config from a repository I work on:
https://github.com/phpdev-uk/slim-skeleton
Specifically the launch.json:
https://github.com/phpdev-uk/slim-skeleton/blob/main/.vscode/launch.json
Dockerfile:
https://github.com/phpdev-uk/slim-skeleton/blob/main/docker/Dockerfile
xdebug.ini:
https://github.com/phpdev-uk/slim-skeleton/blob/main/docker/php/xdebug.ini
It took me a long time to get this working as everything has to match - one minor difference and it won't work, plus you won't necessarily get a helpful error message as to why...
Thanks - I got it working last night - then the cachinf stopped working... I open port 9003 on the defender firewall - but I'm not sure I needed to do that. I'll make sure what i have looks good compared to what you've done - probably tonight.
Would it be useful to have a Docker environment that could be used for local development, with everything pre-installed and with version numbers (e.g. for PHP) matching production? I've moved lots of existing bespoke projects into Docker so I think it would be doable.