pygmystack / pygmy

the pygmy stack is a container stack for local development
MIT License
25 stars 13 forks source link

Does pymgy support custom ports? #484

Closed simesy closed 1 year ago

simesy commented 1 year ago

Is your feature request related to a problem? Please describe. I'd like to put all my pygmy stuff on their own ports and not have them interfere with other work.

Describe the solution you'd like Please provide details how to have a set up which does not lock ports 80/443 as I'm unable to find this in the documentation. I see this comment suggests it is possible. I don't see these instructions in the docs.

By the way i found this in the documentation, and it's not true that Drupal doesn't like other ports, and it should be easy to idenify the port by running a status command.

If multiple Docker containers are exposing the same port it assigned a random port to the exposed port. In our case, this would mean, that each Drupal Container which would like to listen on Port 80 would get a random port like 34564 assigned. As they are random assigned it would be a lot of hassle of figuring out which port that the Drupal is found, additionally, Drupal doesn't like to run on another Port then 80 or 443 so much.

tobybellwood commented 1 year ago

ah - sorry, the docs are much in need of a makeover

Add the replacement ports to your ~/.pygmy.yml

$ cat ~/.pygmy.yml
services:
  amazeeio-haproxy:
    HostConfig:
      PortBindings:
        80/tcp:
          - HostPort: 8080
        443/tcp:
          - HostPort: 443
simesy commented 1 year ago

Oh great thank you, was very confused.

simesy commented 1 year ago

Thanks this worked for me. I note that it's up to me to remember this, as pygmy doesn't mention it in pygmy status - except to note that I'm running a custom config.

uandco commented 8 months ago

Does that work in WSL? No matter what port I set, it still tries to bind to 443:

cat ~/.pygmy.yml
services:
  amazeeio-haproxy:
    HostConfig:
      PortBindings:
        80/tcp:
          - HostPort: 8080
        443/tcp:
          - HostPort: 4343
pygmy start
Using config file: /home/thibaut/.pygmy.yml
Successfully started amazeeio-ssh-agent
Successfully started amazeeio-dnsmasq
Failed to start amazeeio-haproxy: Error response from daemon: Ports are not available: exposing port TCP 0.0.0.0:443 -> 0.0.0.0:0: listen tcp 0.0.0.0:443: bind: An attempt was made to access a socket in a way forbidden by its access permissions.

The weird part is, status reports it can use these ports so the config is taken into account:

 pygmy status
Using config file: /home/thibaut/.pygmy.yml
[*] amazeeio-haproxy is able to start on port 4343
[*] amazeeio-haproxy is able to start on port 8080
uandco commented 8 months ago

Ignore this, it needed a pygmy clean before starting again. Leaving it there in case other users have the same issue ;-)

fubarhouse commented 8 months ago

Noted, thanks for following up! 🙂