Skip to content

Commit

Permalink
docker: simplify fluence build to use fluxion-go
Browse files Browse the repository at this point in the history
Signed-off-by: vsoch <[email protected]>
  • Loading branch information
vsoch committed Feb 17, 2024
1 parent 673e34d commit 41b2ad2
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 126 deletions.
8 changes: 4 additions & 4 deletions src/Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@

FLUX_SCHED_ROOT ?= /home/flux-sched
FLUX_SCHED_ROOT ?= /opt/flux-sched
INSTALL_PREFIX ?= /usr
LIB_PREFIX ?= /usr/lib
LOCALBIN ?= $(shell pwd)/bin
COMMONENVVAR=GOOS=$(shell uname -s | tr A-Z a-z)
#BUILDENVVAR=CGO_CFLAGS="-I${FLUX_SCHED_ROOT}/resource/reapi/bindings/c" CGO_LDFLAGS="-L${INSTALL_PREFIX}/lib -L${FLUX_SCHED_ROOT}/resource -lresource -L${FLUX_SCHED_ROOT}/resource/libjobspec -ljobspec_conv -L/${FLUX_SCHED_ROOT}/resource/reapi/bindings -lreapi_cli -lflux-idset -lstdc++ -lczmq -ljansson -lhwloc -lboost_system -lflux-hostlist -lboost_graph -lyaml-cpp"
BUILDENVVAR=CGO_CFLAGS="-I${FLUX_SCHED_ROOT} -I${FLUX_SCHED_ROOT}/resource/reapi/bindings/c" CGO_LDFLAGS="-L${LIB_PREFIX} -L${LIB_PREFIX}/flux -L${FLUX_SCHED_ROOT}/resource/reapi/bindings -lreapi_cli -lflux-idset -lstdc++ -lczmq -ljansson -lhwloc -lboost_system -lflux-hostlist -lboost_graph -lyaml-cpp"

# This is what worked
# GOOS=linux CGO_CFLAGS="-I/home/flux-sched/resource/reapi/bindings/c" CGO_LDFLAGS="-L/usr/lib -L/home/flux-sched/resource -lresource -L/home/flux-sched/resource/libjobspec -ljobspec_conv -L/home/flux-sched/resource/reapi/bindings -lreapi_cli -lflux-idset -lstdc++ -lczmq -ljansson -lhwloc -lboost_system -lflux-hostlist -lboost_graph -lyaml-cpp" go build -ldflags '-w' -o bin/server cmd/main.go
BUILDENVVAR=CGO_CFLAGS="-I${FLUX_SCHED_ROOT}/resource/reapi/bindings/c" CGO_LDFLAGS="-L${INSTALL_PREFIX}/lib -L${FLUX_SCHED_ROOT}/resource -lresource -L${FLUX_SCHED_ROOT}/resource/libjobspec -ljobspec_conv -L/${FLUX_SCHED_ROOT}/resource/reapi/bindings -lreapi_cli -lflux-idset -lstdc++ -lczmq -ljansson -lhwloc -lboost_system -lflux-hostlist -lboost_graph -lyaml-cpp"

LOCAL_REGISTRY=localhost:5000
LOCAL_IMAGE=fluence-sidecar:latest
Expand Down
129 changes: 12 additions & 117 deletions src/build/scheduler/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,138 +1,33 @@
FROM ubuntu:latest as base
FROM fluxrm/flux-sched:jammy

RUN apt -y update && apt -y upgrade && apt -y clean && apt -y autoremove
USER root
ENV DEBIAN_FRONTEND=noninteractive
ENV GO_VERSION=1.19.10
ENV INSTALL_PREFIX=/usr

RUN apt install -y --no-install-recommends tzdata && \
apt -y --no-install-recommends install \
aspell \
aspell-en \
autoconf \
automake \
curl \
git \
libc6-dev \
libczmq-dev \
libmpich-dev \
libncurses5-dev \
libelf-dev \
libssl-dev \
libtool \
libsodium-dev \
libzmq3-dev \
libjansson-dev \
liblz4-dev \
libhwloc-dev \
libsqlite3-dev \
lua5.1 \
liblua5.1-dev \
lua-posix \
make \
openssh-client \
python3-dev \
python3-cffi \
python3-six \
python3-yaml \
python3-jsonschema \
python3-sphinx \
python3-pip \
python3-setuptools \
systemd \
wget \
uuid-dev && \
apt -y clean && apt -y autoremove

RUN echo 'alias python="/usr/bin/python3.8"' >> /root/.bashrc && \
echo 'alias pip="/usr/bin/pip3"' >> /root/.bashrc && \
. /root/.bashrc

RUN echo 'set number' >> /root/.vimrc

# Install cmake for new build system
RUN curl -s -L https://github.com/Kitware/CMake/releases/download/v3.26.4/cmake-3.26.4-linux-$(uname -m).sh > cmake.sh ;\
bash cmake.sh --prefix=/usr/local --skip-license ;\
rm cmake.sh

# Remove Python 2
RUN apt purge -y python2.7-minimal

# Python 3 should be linked to python
RUN ln -s /usr/bin/python3 /usr/bin/python
RUN apt install -y python3-pip \
&& apt -y --no-install-recommends install \
libhwloc-dev \
libboost-dev \
libboost-system-dev \
libboost-filesystem-dev \
libboost-graph-dev \
libboost-regex-dev \
libxml2-dev \
libyaml-cpp-dev \
python3-yaml \
libedit-dev \
libarchive-dev \
pkg-config && apt -y clean && apt -y autoremove

RUN git clone https://github.com/flux-framework/flux-core.git /home/flux-core && \
cd /home/flux-core/ && \
./autogen.sh && \
PYTHON_VERSION=3 ./configure --prefix=${INSTALL_PREFIX} && \
make && make install && \
cd ../ && \
rm -rf flux-core
RUN apt-get update && apt-get clean -y && apt -y autoremove

# Install go 19.10
RUN wget https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz && tar -xvf go${GO_VERSION}.linux-amd64.tar.gz && \
mv go /usr/local && rm go${GO_VERSION}.linux-amd64.tar.gz

ENV GOROOT=/usr/local/go
ENV GOPATH=/go
ENV PATH="$GOROOT/bin:$PATH"
RUN mkdir -p /go/src
# ENV GOROOT=/usr/local/go
# ENV GOPATH=/go
ENV PATH=/usr/local/go/bin:$PATH
RUN flux keygen
RUN git clone https://github.com/flux-framework/flux-sched.git /opt/flux-sched

ENV WITH_GO=yes
RUN git clone https://github.com/flux-framework/flux-sched.git /home/flux-sched && \
cd /home/flux-sched/ && \
# Ensure we pin to variant that has STATIC - will update when fix is in
git fetch && git checkout v0.31.0 && \
# These need to be shared libraries
# https://github.com/flux-framework/flux-sched/pull/1094
sed -i 's/add_library(resource STATIC/add_library(resource SHARED/g' resource/CMakeLists.txt && \
sed -i 's/add_library ( reapi_module STATIC/add_library ( reapi_module SHARED/g' resource/reapi/bindings/CMakeLists.txt && \
sed -i 's/add_library ( reapi_cli STATIC/add_library ( reapi_cli SHARED/g' resource/reapi/bindings/CMakeLists.txt && \
sed -i 's/add_library ( jobspec_conv STATIC/add_library ( jobspec_conv SHARED/g' resource/libjobspec/CMakeLists.txt && \
PYTHON_VERSION=3 ./configure --prefix=${INSTALL_PREFIX} && \
make && make install

RUN apt purge -y \
python3-dev \
python3-cffi \
python3-six \
python3-yaml \
python3-jsonschema \
python3-sphinx \
python3-pip \
python3-setuptools \
&& apt -y clean && apt -y autoremove

ENV PATH=/usr/local/go/bin:$PATH
# Go dependencies for protobuf
RUN apt -y update && apt -y upgrade && apt install --no-install-recommends -y protobuf-compiler curl && \
go install google.golang.org/protobuf/cmd/[email protected] && \
go install google.golang.org/grpc/cmd/[email protected]

# These need to be on the LD_LIBRARY_PATH for the server to find at runtime
# This mimcs what we use to build server
ENV LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/usr/lib:/home/flux-sched/resource:/home/flux-sched/resource/libjobspec:/home/flux-sched/resource/reapi/bindings"
COPY fluence Makefile /go/src/fluence/
ENV LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/lib:/usr/lib/flux
WORKDIR /go/src/fluence/
COPY fluence Makefile /go/src/fluence/

# This is the 0.31.0 tag of flux-sched (same as we install above)
RUN go get -u github.com/flux-framework/flux-sched/resource/reapi/bindings/go/src/fluxcli@250eac78a6753253fc8353a3504d7e843d1b6b24 && \
go mod tidy && \
RUN go mod tidy && \
go mod vendor && \
make server FLUX_SCHED_ROOT=/home/flux-sched INSTALL_PREFIX=${INSTALL_PREFIX} && \
make server FLUX_SCHED_ROOT=/opt/flux-sched && \
mkdir -p /home/data/jobspecs /home/data/jgf && \
chmod -R ugo+rwx /home/data
2 changes: 1 addition & 1 deletion src/fluence/fluxion/fluxion.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
pb "github.com/flux-framework/flux-k8s/flux-plugin/fluence/fluxcli-grpc"
"github.com/flux-framework/flux-k8s/flux-plugin/fluence/jobspec"
"github.com/flux-framework/flux-k8s/flux-plugin/fluence/utils"
"github.com/flux-framework/flux-sched/resource/reapi/bindings/go/src/fluxcli"
"github.com/flux-framework/fluxion-go/pkg/fluxcli"
"k8s.io/klog/v2"

"context"
Expand Down
4 changes: 2 additions & 2 deletions src/fluence/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ module github.com/flux-framework/flux-k8s/flux-plugin/fluence
go 1.19

require (
github.com/flux-framework/flux-sched/resource/reapi/bindings/go v0.0.0-20231213021445-250eac78a675
github.com/flux-framework/fluxion-go v0.32.0
google.golang.org/grpc v1.38.0
google.golang.org/protobuf v1.26.0
gopkg.in/yaml.v2 v2.4.0
k8s.io/api v0.22.3
k8s.io/apimachinery v0.22.3
k8s.io/client-go v0.22.3
k8s.io/klog/v2 v2.9.0
k8s.io/kubectl v0.0.0
)

Expand All @@ -34,7 +35,6 @@ require (
google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
k8s.io/klog/v2 v2.9.0 // indirect
k8s.io/utils v0.0.0-20210819203725-bdf08cb9a70a // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.1.2 // indirect
sigs.k8s.io/yaml v1.2.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions src/fluence/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d/go.mod h1:ZZM
github.com/fatih/camelcase v1.0.0/go.mod h1:yN2Sb0lFhZJUdVvtELVWefmrXpuZESvPmqwoZc+/fpc=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/flux-framework/flux-sched/resource/reapi/bindings/go v0.0.0-20231213021445-250eac78a675 h1:FgEA3pnL/kDoLaVOUDa401yainApQJaow9jeBPg4dek=
github.com/flux-framework/flux-sched/resource/reapi/bindings/go v0.0.0-20231213021445-250eac78a675/go.mod h1:yhmzNyn45YhoxEohh1Sl3h3izLMqL7qpcvmYTRpv7eY=
github.com/flux-framework/fluxion-go v0.32.0 h1:NY6Y1mlTTTZhHD+CmAsDsdNTxUsAFDQoORpMZj8NFLI=
github.com/flux-framework/fluxion-go v0.32.0/go.mod h1:ZI3QxSvUfgJE2Snur/SntJmVfpMjr6D4ICVmdqJ9fkQ=
github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k=
github.com/form3tech-oss/jwt-go v3.2.3+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
Expand Down

0 comments on commit 41b2ad2

Please sign in to comment.