dunglas / frankenphp

🧟 The modern PHP app server
https://frankenphp.dev
MIT License
6.88k stars 235 forks source link

[QUESTION] Running multiple laravel in production #814

Closed ezekel closed 5 months ago

ezekel commented 5 months ago

Hi,

I have 2 Laravel apps each app has its docker file, and I have this in my dockerfile

ENTRYPOINT ["php", "artisan", "octane:frankenphp"]

after building each image I push this to my docker hub and pull it to my server

theaungmyatmoe commented 5 months ago

Yes, the error is correct because you just exposed the same port twice.

    php:
    container_name: frankenphp1
    ports:
        - "80:80" # HTTP <= 80
        - "443:443" # HTTPS
        - "443:443/udp" # HTTP/3

 php2:
    container_name: frankenphp2
    image: myusername/mycustomimage2:latest  

    ports:
        - "80:80" # HTTP <= this
        - "443:443" # HTTPS
        - "443:443/udp" # HTTP/3
ezekel commented 5 months ago

HI @aungmyatmoethegreat

I tried like this but had no luck, the error is still the same pointing to 443

Error response from daemon: driver failed programming external connectivity on endpoint frankenphp2 (85613b7fe9c08f8aa00d9f07e52463e7b4e50a06735a57144b7e77ed5a5e1b4d): Bind for 0.0.0.0:443 failed: port is already allocated

 php2:
    container_name: frankenphp2
    image: myusername/mycustomimage2:latest  

    ports:
        - "80:8081" # HTTP <= this
        - "443:443" # HTTPS
        - "443:443/udp" # HTTP/3

also, I tried this

        ports:
        - "8081:8081" # HTTP <= this
        - "443:443" # HTTPS
        - "443:443/udp" # HTTP/3
withinboredom commented 5 months ago

This has nothing to do with FrankenPHP, so I'm going to close this.

You cannot expose the same port more than once. In your second service, since you already bound 80 and 443, you must choose different ports.

theaungmyatmoe commented 5 months ago

Please refer to the exposing port in the docker and docker compose file @ezekel

ezekel commented 5 months ago

@withinboredom

after I change the port

8081:80 444:443 444:443/udp

then I spin up the container

the main site cannot be accessed. maybe the https certificate? https://xyz.online:8081