Skip to content

Commit

Permalink
reduce image size
Browse files Browse the repository at this point in the history
Signed-off-by: Lei Wang <[email protected]>
  • Loading branch information
doudoubobo committed Oct 15, 2024
1 parent 4b00884 commit f67800b
Show file tree
Hide file tree
Showing 4 changed files with 112 additions and 58 deletions.
4 changes: 2 additions & 2 deletions charts/gart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@ coordinator:
tag: latest
pullPolicy: IfNotPresent
resources: {}
containerPort: 8080
port: 8080
containerPort: 18080
port: 18080

#gie frontend config
gie_frontend:
Expand Down
2 changes: 1 addition & 1 deletion coordinator/flex/server/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def main():
arguments={'title': 'GraphScope FLEX HTTP SERVICE API'},
pythonic_params=True)

app.run(port=8080)
app.run(port=18080)


if __name__ == '__main__':
Expand Down
100 changes: 45 additions & 55 deletions k8s/dockerfiles/interactive.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,15 @@ ENV PATH=$PATH:$GRAPHSCOPE_HOME/bin LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GRAPHSCOPE

USER root

RUN apt-get update -y && \
apt-get install -y sudo default-jdk tzdata python3-pip && \
apt-get clean -y && \
rm -rf /var/lib/apt/lists/*

RUN apt-get update -y && \
apt-get install -y git build-essential cmake curl maven libssl-dev libclang-dev openmpi-bin libopenmpi-dev libprotobuf-dev protobuf-compiler-grpc && \
apt-get clean -y && \
RUN apt-get update && \
apt-get install -y --no-install-recommends \
sudo default-jdk tzdata python3-pip \
git build-essential cmake curl maven \
libssl-dev libclang-dev openmpi-bin libopenmpi-dev libprotobuf-dev protobuf-compiler-grpc \
libgrpc-dev libgrpc++-dev libboost-all-dev && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
ENV PATH=/root/.cargo/bin:$PATH

RUN python3 -m pip install --no-cache-dir vineyard vineyard-io etcd3 --user
Expand All @@ -52,15 +50,6 @@ RUN mkdir -p /var/log/graphscope \
&& chown -R graphscope:graphscope /var/log/graphscope
RUN chmod a+wrx /tmp

# Install dependencies for etcd3
RUN apt-get update && apt-get install -y \
libgrpc-dev \
libgrpc++-dev \
libprotobuf-dev \
protobuf-compiler-grpc \
libboost-all-dev libssl-dev \
&& rm -rf /var/lib/apt/lists/*

RUN git clone https://github.com/microsoft/cpprestsdk.git \
&& cd cpprestsdk \
&& mkdir -p build \
Expand All @@ -69,19 +58,17 @@ RUN git clone https://github.com/microsoft/cpprestsdk.git \
&& make -j \
&& make install \
&& cd ../.. \
&& rm -rf cpprestsdk

RUN git clone https://github.com/etcd-cpp-apiv3/etcd-cpp-apiv3.git \
&& rm -rf cpprestsdk \
&& git clone https://github.com/etcd-cpp-apiv3/etcd-cpp-apiv3.git \
&& cd etcd-cpp-apiv3 \
&& mkdir -p build \
&& cd build \
&& cmake .. \
&& make -j \
&& make install \
&& cd ../.. \
&& rm -rf etcd-cpp-apiv3

RUN git clone https://github.com/GraphScope/GART.git \
&& rm -rf etcd-cpp-apiv3 \
&& git clone https://github.com/GraphScope/GART.git \
&& cd GART \
&& git submodule update --init \
&& cd interfaces/grin \
Expand All @@ -93,9 +80,19 @@ RUN git clone https://github.com/GraphScope/GART.git \
&& rm -rf /home/graphscope/GART

WORKDIR /home/graphscope
RUN git clone https://github.com/doudoubobo/GraphScope.git -b v0.1.4 /home/graphscope/GraphScope
RUN cd /home/graphscope/GraphScope/interactive_engine/compiler && \
make build
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \
&& git clone https://github.com/doudoubobo/GraphScope.git -b v0.1.4 /home/graphscope/GraphScope \
&& cd /home/graphscope/GraphScope/interactive_engine/compiler \
&& make build \
&& rm -rf /home/graphscope/GraphScope/.git \
&& rm -rf /home/graphscope/GraphScope/docs \
&& rustup self uninstall -y \
&& rm -rf /root/.rustup \
&& rm -rf /root/.cargo \
&& rm -rf /root/.m2 \
&& rm -rf /usr/local/cargo/registry /usr/local/cargo/git \
&& rm -rf /home/graphscope/GraphScope/interactive_engine/executor/assembly/v6d/ \
&& rm -rf /home/graphscope/GraphScope/interactive_engine/executor/ir/target/release/deps

WORKDIR /home/graphscope
RUN git clone https://github.com/GraphScope/GART.git
Expand All @@ -108,16 +105,11 @@ USER root
ENV RUST_BACKTRACE=1

RUN apt-get update -y && \
apt-get install -y python3-pip curl && \
apt-get clean -y && \
rm -rf /var/lib/apt/lists/*
apt-get install -y python3-pip curl git \
build-essential cmake libssl-dev libclang-dev openmpi-bin libopenmpi-dev \
libgrpc-dev libgrpc++-dev libprotobuf-dev protobuf-compiler-grpc libboost-all-dev && \
apt-get clean -y && rm -rf /var/lib/apt/lists/*

RUN apt-get update -y && \
apt-get install -y git build-essential cmake libssl-dev libclang-dev openmpi-bin libopenmpi-dev && \
apt-get clean -y && \
rm -rf /var/lib/apt/lists/*

RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
ENV PATH=/root/.cargo/bin:$PATH

RUN arch=$(arch | sed s/aarch64/arm64/ | sed s/x86_64/amd64/) && \
Expand All @@ -131,17 +123,7 @@ RUN chmod a+wrx /tmp /var/tmp

RUN python3 -m pip install --no-cache-dir vineyard vineyard-io flask --user



WORKDIR /home/graphscope
# Install dependencies for etcd3
RUN apt-get update && apt-get install -y \
libgrpc-dev \
libgrpc++-dev \
libprotobuf-dev \
protobuf-compiler-grpc \
libboost-all-dev libssl-dev \
&& rm -rf /var/lib/apt/lists/*

RUN git clone https://github.com/microsoft/cpprestsdk.git \
&& cd cpprestsdk \
Expand All @@ -151,19 +133,17 @@ RUN git clone https://github.com/microsoft/cpprestsdk.git \
&& make -j \
&& make install \
&& cd ../.. \
&& rm -rf cpprestsdk

RUN git clone https://github.com/etcd-cpp-apiv3/etcd-cpp-apiv3.git \
&& rm -rf cpprestsdk \
&& git clone https://github.com/etcd-cpp-apiv3/etcd-cpp-apiv3.git \
&& cd etcd-cpp-apiv3 \
&& mkdir -p build \
&& cd build \
&& cmake .. \
&& make -j \
&& make install \
&& cd ../.. \
&& rm -rf etcd-cpp-apiv3

RUN git clone https://github.com/GraphScope/GART.git \
&& rm -rf etcd-cpp-apiv3 \
&& git clone https://github.com/GraphScope/GART.git \
&& cd GART \
&& git submodule update --init \
&& cd interfaces/grin \
Expand All @@ -174,9 +154,19 @@ RUN git clone https://github.com/GraphScope/GART.git \
&& cp ./libgart_grin.so /usr/local/lib/ \
&& rm -rf /home/graphscope/GART

RUN git clone https://github.com/doudoubobo/GraphScope.git -b v0.1.4 /home/graphscope/GraphScope
RUN cd /home/graphscope/GraphScope/interactive_engine/executor/assembly/grin_gart && \
cargo build --release
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \
&& git clone https://github.com/doudoubobo/GraphScope.git -b v0.1.4 /home/graphscope/GraphScope \
&& cd /home/graphscope/GraphScope/interactive_engine/executor/assembly/grin_gart \
&& cargo build --release \
&& rm -rf /home/graphscope/GraphScope/.git \
&& rm -rf /home/graphscope/GraphScope/docs \
&& rm -rf /home/graphscope/GraphScope/interactive_engine/executor/assembly/grin_gart/target/release/deps \
&& rm -rf /home/graphscope/GraphScope/interactive_engine/executor/assembly/grin_gart/target/release/build \
&& rustup self uninstall -y \
&& rm -rf /root/.rustup \
&& rm -rf /root/.cargo \
&& rm -rf /root/.m2 \
&& rm -rf /usr/local/cargo/registry /usr/local/cargo/git

WORKDIR /home/graphscope
RUN git clone https://github.com/GraphScope/GART.git
Expand Down
64 changes: 64 additions & 0 deletions scripts/update_ip_tables.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/bin/bash

# Function to get the node port for a service
get_node_port() {
kubectl get service "$1" -o=jsonpath='{.spec.ports[0].nodePort}' -n "$2"
}

# Function to get the Kubernetes API server IP
get_kubernetes_api_ip() {
kubectl get endpoints kubernetes -o jsonpath='{.subsets[0].addresses[0].ip}'
}

# Function to clean up existing iptables rules
cleanup_iptables() {
echo "Killing existing socat processes..."
sudo pkill socat
}

# Function to update iptables rules for a service
update_iptables() {
SERVICE_NAME="$1"
SOURCE_IP="$2"
SOURCE_PORT="$3"
NAME_SPACE="$4"
K8S_API_IP="$5"

echo "Updating iptables rules for $SERVICE_NAME (Source IP: $SOURCE_IP, Port: $SOURCE_PORT)"

NODE_PORT=$(get_node_port "$SERVICE_NAME" "$NAME_SPACE")

if [ -z "$NODE_PORT" ]; then
echo "Error: Could not get node port for service $SERVICE_NAME"
return 1
fi

sudo socat TCP-LISTEN:${SOURCE_PORT},bind=${SOURCE_IP},fork TCP:${K8S_API_IP}:${NODE_PORT} &

echo "Updated iptables rules for $SERVICE_NAME (Node Port: $NODE_PORT)"
}

# Main execution
echo "Starting iptables update process..."

K8S_API_IP=$(get_kubernetes_api_ip)
if [ -z "$K8S_API_IP" ]; then
echo "Error: Could not determine Kubernetes API server IP"
exit 1
fi
echo "Kubernetes API server IP: $K8S_API_IP"

cleanup_iptables

# Update rules for each service
if ! update_iptables gart-release-coordinator-service 0.0.0.0 18080 gart "$K8S_API_IP"; then
echo "Failed to update iptables for gart-release-coordinator-service"
fi

if ! update_iptables gart-release-gie-frontend-service 0.0.0.0 8182 gart "$K8S_API_IP"; then
echo "Failed to update iptables for gart-release-gie-frontend-service"
fi

echo "iptables update process completed."

echo "Script execution completed."

0 comments on commit f67800b

Please sign in to comment.