Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: docker-compose published port must be integer #459

Conversation

remaininlight
Copy link

Description

Problem

When I run nhost up on macOS 12.3.1 I get this error:

$ nhost up


> Failed to start services
> [exit status 15
services.traefik.ports.0.published must be a integer
] Failed to start services

This seems to be caused by docker-compose changing their config (from >= 2.3) to require integers for the published port:
docker/compose#9306

Solution

All published ports generated for the docker-compose file are now generated as integers rather than strings

Because HostPort (https://github.com/nhost/cli/compare/main...remaininlight:nhost-cli:fixed-docker-compose-published-port?expand=1#diff-02a255cf4e10d7bb679548ea0ba12fdd9e0babd0211db7561105e10d24ebe9d4L671) is a string which can be a range it is converted to an integer, taking the starting port from a range. I don't write Go very often, I'm sure there's room for improvement in that conversion function!

Notes

Other notes that you want to share but do not fit into Problem or Solution.

@github-actions github-actions bot added the fix label Nov 25, 2022
Copy link
Contributor

@elephant3 elephant3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please tell which version of docker, docker for mac, compose are you using?

@@ -661,14 +662,23 @@ func ParsePortConfig(value string) ([]ServicePortConfig, error) {
return portConfigs, nil
}

func convertPortRangeToPort(portRange string) uint32 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it your manual change or result of go mod tidy && go mod vendor?

@benorudolf
Copy link

Adding some additional info (and solution) if it helps:

This same issue started showing up when I upgraded my Nhost CLI from ~v0.6 to the latest v0.8.11.
When I ran the nhost up command I got a warning to upgrade my docker engine from v20.10.12 to v20.10.17 before it failed with the above error.
My Docker Desktop (Mac) was out of date and needed 2 updates to get to the latest v4.14.1. Now it's using v20.10.21 of the docker engine and docker-compose is at v2.12.2. The Nhost CLI now works without issues.

Mac BigSur, version: 11.6 (20G165)

🟢 Current stable state

Nhost CLI v0.8.11
Docker desktop v4.14.1 
docker engine 20.10.21
docker-compose 2.12.2

🔴 Previous unstable state

Nhost CLI v0.8.11 
Docker desktop ??? 
docker engine 20.10.12
docker-compose ???

🟢 Previous Stable state (outdated)

Nhost CLI ~v0.6 
Docker desktop ??? 
docker engine 20.10.12
docker-compose ???

@elephant3 elephant3 mentioned this pull request Dec 5, 2022
@elephant3
Copy link
Contributor

@benorudolf it will be included in the next release. I'll let you know once it's out

@elephant3
Copy link
Contributor

@remaininlight @benorudolf the new release is out. Please check if the issue is still there

@benorudolf
Copy link

@elephant3 Thank you 🙏
I merely commented with the hope it would provide more information if needed.
I was able to resolve the issue by updating my Docker Desktop 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants