citusdata / docker

:ship: Docker images and configuration for Citus
Apache License 2.0
241 stars 100 forks source link

Provide arm64 docker image for running on Apple M1/M2 #309

Open zsvoboda opened 2 years ago

zsvoboda commented 2 years ago

Please provide arm64 docker image for Apple M1/M2.

Thanks

ZD

xin-hedera commented 1 year ago

upvote this

j-white commented 1 year ago

I've run into this as well while trying to use Citus locally for development.

It looks like the Docker files pull packages from the Debian repository which doesn't have any arm64 artifacts published: packagecloud. I guess we would need to start there, by publish arm64 .debs.

j-white commented 1 year ago

I spent some time deciphering the builds and I managed to get an arm64 version of the image up here: https://hub.docker.com/layers/jwhiteatdocker/citus/12.0.0-pg14/images/sha256-caa0ba563dc700428d8c01bd4962cfb5feda61b7958a13a73d8542dba4a90fcd?context=repo

First, I fixed the build_packages command so I could rebuild existing x64 packages: https://github.com/j-white/citus-packaging/commit/45d0a56e594162e1db1301546b8a442d28a15a39

I got them to build on an M1 (arm64): https://github.com/j-white/citus-packaging/commit/d3df9659959c9f47062430cd65983b1eef7feca1

I uploaded the packages to packagecloud: https://packagecloud.io/j-white/citusdata-community-arm64

And then I rebuilt the Docker images: https://github.com/j-white/citus-docker/commit/b040f72d28a554e32618be2444e7819ad6fa1ffc

The result is a multi-arch container for Citus 12.0.0 and PG14:

% docker pull jwhiteatdocker/citus:12.0.0-pg14
...
% docker inspect jwhiteatdocker/citus:12.0.0-pg14 | jq -r '.[] | .Architecture'
arm64
% docker run -d --name "citusdev" -e "POSTGRES_HOST_AUTH_METHOD=trust" -p 5432:5432 jwhiteatdocker/citus:12.0.0-pg14 -c fsync=off
...
% docker exec -it citusdev psql -U postgres
psql (14.8 (Debian 14.8-1.pgdg120+1))
Type "help" for help.

postgres=# CREATE TABLE daily_page_views (
    tenant_id int,
    day date,
    page_id int,
    view_count bigint,
    primary key (tenant_id, day, page_id)
);

SELECT create_distributed_table('daily_page_views', 'tenant_id');
CREATE TABLE
 create_distributed_table 
--------------------------

(1 row)

postgres=# 
9mm commented 7 months ago

+1

That's an awesome solution but ideally this is part of official image

aorticweb commented 2 months ago

+1 on this

jremen commented 2 months ago

+1 Please add this to official repo