-
Notifications
You must be signed in to change notification settings - Fork 912
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
build: Fix libpq
for Docker multi-arch builds and Bookworm upgrade
#7921
build: Fix libpq
for Docker multi-arch builds and Bookworm upgrade
#7921
Conversation
da58237
to
39f5b1a
Compare
Sooo... after some more rigorous testing, the first iteration actually broke
This has been tested by running a cross-platform build on an
This error indicates The learning from testing this has prompted considerations on trying to add static linking support for |
Managed to test the cross-compiled images on an M2 Mac and Raspberry Pi 4, both Don't have an |
39f5b1a
to
abd6276
Compare
Rebased against |
Thanks for the review! So the only TODO is to look into installing the |
Yes, that should be good enough. |
abd6276
to
3dabe66
Compare
|
@s373nZ I am unable to build images for In preliminary testing, I suggest adding Is there a specific reason for explicitly running make install in separate directories (e.g., src/include, src/interfaces/libpq) instead of performing a single
|
3dabe66
to
399cec8
Compare
For local testing, I'm just running
this is a legitimate testing scenario, right? My
After adding an additional commit to update for Poetry
Not sure what's going on with this approach. The cross-compiled builds take a long time for me, but not five hours -- maybe one? Given they timeout compiling the Python wheels, maybe it has something to do with using
Is this contributing to the error you're seeing locally? My understanding is that this doesn't need to be done given my testing approach, but maybe I'm misunderstanding.
This was part of @arowser's initial implementation. My understanding is that there are a lot of other components to build in the Postgres source code and this just builds |
Could you please test using the For local testing, I used a command like:
With QEMU emulation set up for cross-platform builds. Optionally, I prefer using the Change
In some cases, the GitHub workflow may not fail or exit as expected. The purpose of testing these changes on GitHub Actions was to confirm that the failures observed locally also occur in the workflow. Once the issue is resolved locally, the GitHub Actions workflow should also pass successfully.
I had to add
Since we are only copying |
399cec8
to
81452e4
Compare
@ShahanaFarooqui I just tested the build again locally using Before we debug too much further, can you share which version of Docker you're using? Mine is:
|
Hi @s373nZ, My local Issues Encountered and Resolutions:1: Initially, the Python installation failed with the error:
To address this, I updated 2: Then I encountered the error 3: Finally I was able to successfully build the image but both python plugins (clnrest & wss-proxy) were not working due to missing libraries. I discovered that the libraries were being copied from the global Python location instead of the virtual environment. To fix this, I updated the Dockerfile to copy libraries from the virtual environment ( Current Status:
|
81452e4
to
35ae98a
Compare
Hi @ShahanaFarooqui, this work has been really sensitive to develop and even more time consuming to test due to the long build process, cross-compilation variants and their performance multiplier. I thank you for your help and patience with the review and testing -- and the ideas you're contributing toward fixing the discrepancies 🙏
I managed to reproduce this by running my testing build locally with the
A good reminder for me to always test a clean build before submission to avoid being tricked by the layer caching. After cherry-picking b3c97 with your updates to the
After making the above change and running with
Taking a look at your commit, it makes complete sense to me that copying the packages from the
It looks like it completed successfully 🎉 this is encouraging! Lastly, I have a question about the errors you reported earlier:
Are these prior issues with the cross-compilation still present, or did they get resolved? I sort of remember encountering challenges like this when I first began the work, but I think a Docker upgrade helped to fix it. Did the same work for you, or was it something else? The changes referenced in this comment have been edited into their corresponding commits in this branch. Please let me know if the venvs still break for you, or you encounter other errors. I think we're close! 🤞 P.S. Do you think setting the |
2485147
to
1d2620b
Compare
- Add Postgres dependencies: bison, flex and libiu-dev. - Fix missing `&&` in chained wget commands. - Add `POSTGRES_CONFIG` and `PG_CONFIG` for all architectures. - Remove existing `libpq` Ubuntu packages. - Copy libpq libraries from builder directly to final image. Changelog-Fixed: Fixes Postgres driver availability for arm64 and arm32 Docker images.
Undertaken to upgrade QEMU to 7.2. Also upgrades Python to 3.11 implicitly and migrates Python dependency management to virtual environments. Changelog-Changed: Released Docker images are now based on Debian Bookworm
- Align indentation. - Use multi-line `ENV` where values don't depend on each other. Changelog-None
- Install `poetry-plugin-export` as a separate step. - Remove `--no-update` option from `poetry lock` as it's now default behavior. - Add `poetry lock` to the command chain after removing cln-rest and wss-proxy. https://github.com/python-poetry/poetry/releases/tag/2.0.0
Main application poetry.lock file as well as clnrest and wss-proxy.
To ensure the workflow uses updated files, including the Dockerfile, from the same branch for testing.
1d2620b
to
3286bab
Compare
I have made a few changes to your PR related to this update (hope it is okay). Here is a summary:
Everything is working as expected in my local build. I am just running the final test on GitHub Actions here. Once it passes, the PR should be ready to merge.
It is a team effort, and I appreciate your contributions too. While testing Docker updates can be time-intensive, adding postgres support to the image will be well worth the effort :).
Let us keep the
That makes sense. I might have tested it in an inconsistent environment, as I recall accidentally changing the $PATH from
Great.
I usually test Docker images as described in the Core Lightning documentation. However, I think the missing piece in your setup is configuring these plugins in your CLN config using
should produce the following logs in CLN:
No, those issues no longer persist, and I did not upgrade Docker either. However, I guess you can still reproduce them by building the image up to the builder stage and then running the
Currently project-wide GitHub workflows run on ubuntu-22.04 to maintain consistency. We can revisit and consider upgrading to a newer version in the next 4-6 months if needed.
I also attempted to modify the
Given these issues, we can leave it as is for now and revisit it later when we have more time to focus on making it cleaner. |
I originally changed this due to some build errors indicating the .lock files were out of date. Also noticed the CHANGELOG for the Poetry
I agree with the original approach of building just
There might be a way to prettify the command, though. One thought is to download the Postgres tarball and start reading through the various Makefiles and doing some experiments to see if there is a magic combination of targets for the
🎉 Local build for |
This PR adds upon the excellent initial work done by @arowser in #7827 on cross-compiling
libpq
through the multi-architecture Docker release builds. Exhaustive testing exposed some local Docker build errors which have been addressed in additional commits.Upon running into some local QEMU segmentation faults while cross compiling, we noticed that
qemu-user-static
was on a rather old version of5.2
under Debian Bullseye. Therefore, we also update the Docker release base images to Bookworm, pushing QEMU to7.2
. Bullseye is "old stable" and Bookworm is now "stable", so there is a case to be made for upgrading.Additionally, Python is upgraded to 3.11 as a corollary. Currently setting
pip
flags to break system packages, mainly in the interest of time, but this could be addressed to use virtual environments if required.wget
.libicu-dev
,bison
andflex
.libpq
Debian package installs.POSTGRES_CONFIG
declaration for each cross compile target.PG_CONFIG
for all targets.pg_config
to runldconfig
, making compiled libraries available to the system.libpq
libraries from thebuild
stage to thefinal
stage using a bind mountRUN
command.3.11
.Dockerfile
formatting and standardize the use ofENV
directives when the values are not interdependent.The full multi-arch build has been tested locally by building on
amd64
.Still need to figure out a way to get thearm
target image onto a Mac to testlibpq
from inside a container.Fixes #7649
Relates to and duplicates #7827
Respectfully, these changes have also been submitted in a PR against @arowser's branch here. As there is a bounty posted for #7649, I yield to the CLN core teams determination on who should win the payout or on whether / how to divide it. 🙏
Checklist
Before submitting the PR, ensure the following tasks are completed. If an item is not applicable to your PR, please mark it as checked: