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

Issue Report: pgautoupgrade/pgautoupgrade:latest Not Supported on Windows/amd64 10.0.20348 #49

Closed
lecaoquochung opened this issue Sep 29, 2024 · 8 comments

Comments

@lecaoquochung
Copy link

Summary:

The pgautoupgrade/pgautoupgrade:latest container image fails to run on a Windows platform with the version 10.0.20348 on an amd64 architecture. The issue seems to be due to platform compatibility or lack of support for Windows-based environments in the current container image.

Environment:

Operating System: Windows Server 2022 (build 10.0.20348)
Architecture: AMD64 (x64-based processor)
Container Image: pgautoupgrade/pgautoupgrade:latest
Platform: Docker (or relevant container runtime)

Logs

https://github.com/lecaoquochung/docker-images/actions/runs/11089181949/job/30810009459#step:6:29
Screen Shot 2024-09-29 at 13 30 34

@justinclift
Copy link
Member

justinclift commented Sep 30, 2024

That's weird. Any idea why it's trying to use a Linux based image as a windows based thing?

Oh, maybe you need a platform line so it knows how to use the image?

platform: linux/amd64

Try adding that to the same level as the other lines here:

https://github.com/lehungio/docker-redash/blob/ea389bd411ce4e4319964f48b71f6af710811b32/docker-compose.yml#L46-L54

So that bit looks like this:

    hostname: docker-redash-postgres
    container_name: docker-redash-postgres
    image: pgautoupgrade/pgautoupgrade:latest
    platform: linux/amd64
    # command: --port 55432
    ports:
     - "55432:5432"
    env_file: .env
    volumes:
     - ./docker/postgres/data:/var/lib/postgresql/data

In theory that should make it work. Though I don't (yet) know why that image would need it and the others don't. 🤔

@spwoodcock
Copy link

spwoodcock commented Sep 30, 2024

I think the issue is that the images built on dockerhub do not support windows/amd64.

See the workflow here

platforms: linux/amd64,linux/arm64

where they built for linux/amd64 and linux/arm64.

There are two options:

  1. Add extra platforms to the image build workflow (windows/and64, darwin/arm64 (Mac) etc)
    • Note this would increase the build time a fair bit, but if new releases are done infrequently then it may not be a big deal.
  2. @lecaoquochung could build their own pgautoupgrade image on their windows machine, which would build it using the required architecture to run.

Note

If Redash relies on this image for deploy, then that might mean that Redash does not support Windows (or Mac) machines out of the box?

@justinclift
Copy link
Member

justinclift commented Sep 30, 2024

If Redash relies on this image for deploy, then that might mean that Redash does not support Windows (or Mac) machines out of the box?

That's confusing for me, as Redash runs on macOS (in my dev environment) when I use platform: linux/amd64 for the images.

I mean, we could potentially add new "windows" builds to the platforms list but does that mean we'd need to change a bunch of bash scripting to be powershell or similar?

Actually, do the official Docker PostgreSQL images work properly as is in this scenario? Our images are mostly just a modification of those to add some extra scripting. 😄

@spwoodcock
Copy link

spwoodcock commented Sep 30, 2024

Slight correction to my previous comment!

While darwin/arm64 is possible to build, there are no good ways to run a pure MacOS container, so it's a bit pointless.

Most container runtimes on Mac actually just emulate linux/arm64 or linux/amd64 I believe, so pgaugoupgrade would work on Mac (and Redash too).

You are completely right though, that while we could add windows support by adding windows/amd64 to the platforms in the github workflow, it would be pointless as we can't easily run the entrypoint bash script (needing a powershell script instead).

The official images for postgres do support all platforms, but as soon as you make a build that extends another image, the platform support is removed unless you specify the --platforms flag for your build.

Important

Correction! The official postgres image doesn't even support windows, so I wonder if running the postgres container would have failed too, but pgautoupgrade was just the first to fail?
Screenshot_20240930-230111

In summary, I don't think this issue is solvable without a considerable amount of effort. Unless many users require pgautoupgrade to work on Windows Server, I would say it's not worth the effort.

@wuast94
Copy link
Member

wuast94 commented Sep 30, 2024

i would agree on that, its not woth the effort to add test and maintain overall. maybe a quick solution is to run a hyper-v or WSL instance on that windows VM.

@justinclift
Copy link
Member

As a data point, looking at the official GitHub repo for the Docker PostgreSQL images, they only have shell scripts in there.

Doesn't look like any windows stuff.

So yeah, I guess running the standard postgres container would fail in the same place too. 😄

@andyundso
Copy link
Member

not sure what the current consensus is here, but I am with @justinclift that platform: linux/amd64 fixes the issue. the downside is that you are unable to test that setup on GitHub, as Linux containers on Windows require WSL 2, which is not supported by Microsoft-hosted runners.

Building a Windows container would be possible, but we would essentially have to re-engineer the entire container.

  • I personally have no clue on how to build Postgres on Windows using a Windows toolchain. But this is maybe not required: we just install the different versions of Postgres within the container. For example, for the pgautoupgrade v12 container, we install v9.5 to v12, and only start the v12 version.
  • The bash entrypoint script would have to be rewritten in PowerShell.
  • The test script would have to be rewritten in PowerShell.
  • .... ?

I have couple of friends who work with Windows Server regulary and Docker containers are not really a topic for them. Windows Docker Container are sparse (I only know of caddy who provides one). Running Linux Containers on Windows requires WSLv2 activated, so you have essentially a Linux in your Windows server, so you are better to just run it on a Linux server directly.

@spwoodcock
Copy link

I'm in agreement that building a windows container is not desirable 👍

pgautoupgrade is already built for linux/amd64 and I have tested on WSL - it works nicely!

The issue can probably be closed as not planned

@wuast94 wuast94 closed this as not planned Won't fix, can't repro, duplicate, stale Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants