feat: Add DevContainer configuration for local development - #484
feat: Add DevContainer configuration for local development#484Ramjivan wants to merge 3 commits into
Conversation
🧪 How to Test This PRIf you want to help test this DevContainer setup, here is how you can do it quickly: Prerequisites:
Steps to test:
What to look out for:
|
- Add .devcontainer configuration for VS Code and Codespaces - Add xdebug to bewelcome_php_dev stage for local debugging
Neophytis
left a comment
There was a problem hiding this comment.
Good work on this — devcontainer support has been wanted for a while (closes #69) and the overall setup is clean. Two things before merging:
1. Target branch / base stack
This PR targets develop which uses FrankenPHP. Our actual beta and production Docker deployment runs on feature/docker-master (php-fpm + nginx). A devcontainer built against develop means contributors work against a runtime that doesn't match what gets deployed — which is the main thing a devcontainer should prevent.
I'd suggest rebasing against feature/docker-master and pointing dockerComposeFile at that branch's docker-compose.yml. The Codespaces support carries over unchanged and contributors get an environment that actually mirrors production.
2. Xdebug in the Dockerfile
Baking xdebug into the Dockerfile (disabled by default via xdebug.mode=off) is the right approach. It avoids recompiling the extension on every fresh container and keeps it opt-in with XDEBUG_MODE=debug. The postCreateCommand alternative would hit a compile penalty on every rebuild. Current approach is correct.
6b98962 to
1bbdcbe
Compare
|
Thanks Peter! Makes total sense. I've updated this PR:
This is now ready for review against the production-mirroring stack! |
|
I also just added a small |
|
@Ramjivan Seems the checks fail as they now use yarn again but develop moved to bun. Regarding FrankenPHP or nginx/PHP-FPM: FrankenPHP is likely faster and therefore the better choice in the future. Any way to set this up that it can be tested in parallel? Mailcatcher (even sj26/mailcatcher) doesn't get updates anymore (last push 2 years ago). MailPit had the last update 8 days ago and has an API which could be used for testing. |
|
@thisismeonmounteverest @Neophytis Yeah, the CI failures are just coming from the base To let us test both setups, I opened #486 pointing at Totally agree on swapping to MailPit. Want me to add that change into these PRs, or keep it in a separate PR? |
|
@Ramjivan I think we can switch to mailpit here. As it is not used for anything else than development. |
This PR introduces a
devcontainersetup for BeWelcome Rox to standardise and simplify the developer onboarding experience, solving Issue #69.🎯 What this does:
docker-compose.ymlanddocker-compose.override.yml.dist. No new Docker networks or redundant configurations are introduced.docker/db/word.sqltodocker/db/words.sqlindocker-entrypoint.sh.💡 Discussion Points for the Team:
I would love to get your thoughts on a couple of implementation details so we can ensure this is the right approach for everyone:
xdebugto thebewelcome_php_devstage in theDockerfiledirectly. This ensures the Docker layer caches the compilation and it is immediately available (set tooffby default for performance). Question: Are we comfortable adding this to the Dockerfile, or would you prefer it to be installed dynamically (e.g. via apostCreateCommandscript) to keep the Dockerfile completely untouched?devcontainer.jsonconfiguration also natively supports GitHub Codespaces! Since the repo is public, contributors can use it for free. Perhaps we should document this as an alternative inINSTALL.mdin the future?develop. Does this align with our usual branching strategy for infrastructure enhancements?Closes #69