Running ReactPHP in DDEV #5973
BernhardBaumrock
started this conversation in
General
Replies: 1 comment 6 replies
-
Probably you want to use Remember that you'll have to configure react-php to listen on 0.0.0.0, not 127.0.0.1, which is available only from inside the container. |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi DDEVs!
TL;DR
How can I expose 127.0.0.1:1234 from inside docker to myservice.myapp.ddev.site on the host?
Long Story:
I'm evaluating https://reactphp.org/ for my next project and I'd like to properly run it with DDEV right from the start :) I know that DDEV can run additional services, but I got stuck on the docs early in the process...
What works so far:
I created a new ddev project, logged into the container via
ddev ssh
and there I rancomposer require react/react:^1.4
Then I created
server.php
Now I ran
php server.php
and it showedServer running at http://127.0.0.1:8080
- great!But the problem is: How can I expose that server/service from my DDEV to the host?
I tried to run
php server.php
on my host and then I can go to http://127.0.0.1:8080 in the browser and I seeHello World!
- great :)What I'd like to achieve is that this server is started with the project and I can reach it from my web app from a custom url, something like myservice.reactphp.ddev.site; I read that there is support for supervisord so that should be possible I guess, but first I need to get it running manually...
I tried to follow https://ddev.readthedocs.io/en/stable/users/extend/custom-compose-files/ and created the file
.ddev/docker-compose.ports.yaml
with the following content:But I got this error:
Failed to restart reactphp: composeCmd failed to run 'COMPOSE_PROJECT_NAME=ddev-reactphp docker-compose -f /Users/bernhard/baumrock/reactphp/.ddev/.ddev-docker-compose-base.yaml -f /Users/bernhard/baumrock/reactphp/.ddev/docker-compose.ports.yaml config', action='[]', err='exit status 15', stdout='', stderr='service "someservice" has neither an image nor a build context specified: invalid compose project'
I'm a little lost as I'm a little blank when it comes to docker or networking in general.
Thx in advance for your help!
Beta Was this translation helpful? Give feedback.
All reactions