Skip to content

Commit

Permalink
[feat][build] Adapt to Python client to be compatible with ARM arch
Browse files Browse the repository at this point in the history
Signed-off-by: Zixuan Liu <[email protected]>
  • Loading branch information
nodece committed Apr 28, 2024
1 parent 1afc667 commit 71889c5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
9 changes: 7 additions & 2 deletions docker/pulsar/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,21 @@ FROM ubuntu:20.04

ARG DEBIAN_FRONTEND=noninteractive
ARG UBUNTU_MIRROR=mirror://mirrors.ubuntu.com/mirrors.txt
ARG UBUNTU_PORTS_MIRROR=http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/

# Install some utilities
RUN sed -i "s|http://archive\.ubuntu\.com/ubuntu/|${UBUNTU_MIRROR:-mirror://mirrors.ubuntu.com/mirrors.txt}|g" /etc/apt/sources.list \
&& echo 'Acquire::http::Timeout "30";\nAcquire::ftp::Timeout "30";\nAcquire::Retries "3";' > /etc/apt/apt.conf.d/99timeout_and_retries \
RUN sed -i -e "s|http://archive\.ubuntu\.com/ubuntu/|${UBUNTU_MIRROR:-http://archive.ubuntu.com/ubuntu/}|g" \
-e "s|http://ports\.ubuntu\.com/ubuntu-ports/|${UBUNTU_PORTS_MIRROR:-http://ports\.ubuntu\.com/ubuntu-ports/}|g" /etc/apt/sources.list \
&& echo 'Acquire::http::Timeout "30";\nAcquire::http::ConnectionAttemptDelayMsec "2000";\nAcquire::https::Timeout "30";\nAcquire::https::ConnectionAttemptDelayMsec "2000";\nAcquire::ftp::Timeout "30";\nAcquire::ftp::ConnectionAttemptDelayMsec "2000";\nAcquire::Retries "15";' > /etc/apt/apt.conf.d/99timeout_and_retries \
&& apt-get update \
&& apt-get -y dist-upgrade \
&& apt-get -y install --no-install-recommends netcat dnsutils less procps iputils-ping \
python3 python3-kazoo python3-pip \
curl ca-certificates wget apt-transport-https

#If not upgraded, it will affect the installation of grpcio.
RUN python3 -m pip install --upgrade pip

# Install Eclipse Temurin Package
RUN mkdir -p /etc/apt/keyrings \
&& wget -O - https://packages.adoptium.net/artifactory/api/gpg/key/public | tee /etc/apt/keyrings/adoptium.asc \
Expand Down
11 changes: 3 additions & 8 deletions docker/pulsar/scripts/install-pulsar-client.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@

set -x

# TODO: remove these lines once grpcio doesn't need to compile from source on ARM64 platform
ARCH=$(uname -m | sed -r 's/aarch64/arm64/g' | awk '!/arm64/{$0="amd64"}1')
if [ "${ARCH}" == "arm64" ]; then
apt update
apt -y install build-essential python3-dev
fi

pip3 install pulsar-client[all]==${PULSAR_CLIENT_PYTHON_VERSION}
# Recommend using the "--only-binary :all:" option, but the ratelimit package doesn't have the whl file.
# When there is no corresponding whl file, pip will automatically compile the package.
pip3 install pulsar-client[all]==${PULSAR_CLIENT_PYTHON_VERSION} --prefer-binary
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ flexible messaging model and an intuitive client API.</description>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>

<pulsar.client.python.version>2.10.1</pulsar.client.python.version>
<pulsar.client.python.version>3.5.0</pulsar.client.python.version>

<!--config keys to configure test selection -->
<include>**/Test*.java,**/*Test.java,**/*Tests.java,**/*TestCase.java</include>
Expand Down Expand Up @@ -135,7 +135,7 @@ flexible messaging model and an intuitive client API.</description>
<reflections.version>0.9.11</reflections.version>
<swagger.version>1.6.10</swagger.version>
<puppycrawl.checkstyle.version>8.37</puppycrawl.checkstyle.version>
<docker-maven.version>0.42.1</docker-maven.version>
<docker-maven.version>0.44.0</docker-maven.version>
<docker.verbose>true</docker.verbose>
<typetools.version>0.5.0</typetools.version>
<byte-buddy.version>1.14.12</byte-buddy.version>
Expand Down

0 comments on commit 71889c5

Please sign in to comment.