Skip to content

Commit

Permalink
Add postgresql installation if the backend requires it
Browse files Browse the repository at this point in the history
Signed-off-by: Oz N Tiram <[email protected]>
  • Loading branch information
oz123 committed Dec 20, 2023
1 parent f979835 commit 443d564
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ ARG no_proxy=${NO_PROXY}
ARG PROXY_CERT_PATH
ARG UPDATE_KERNEL=false
ARG TWO_NODE=false
# You can use either sqlite or postgres as backend
ARG TWO_NODE_BACKEND=sqlite
ARG MARMOT_VERSION=0.8.7-beta.1

ARG ETCD_VERSION="v3.5.5"
Expand Down Expand Up @@ -241,7 +243,7 @@ base-image:
curl -sL https://github.com/maxpert/marmot/releases/download/v"${MARMOT_VERSION}"/marmot-v"${MARMOT_VERSION}"-linux-amd64-static.tar.gz | tar -zxv marmot && \
install marmot -o root -g root -m 755 /opt/spectrocloud/bin/ && \
rm -f marmot \
curl -sL https://github.com/k3s-io/kine/releases/download/v${KINE_VERSION}/kine-amd64 | install -m 755 /dev/stdin /opt/spectrocloud/bin/kine
curl -sL https://github.com/k3s-io/kine/releases/download/v${KINE_VERSION}/kine-amd64 | install -m 755 /dev/stdin /opt/spectrocloud/bin/kine
END

IF [ "$OS_DISTRIBUTION" = "ubuntu" ] && [ "$ARCH" = "amd64" ]
Expand Down Expand Up @@ -272,7 +274,18 @@ base-image:
apt clean

IF $TWO_NODE
RUN apt install -y sqlite3 iputils-ping
IF [ $TWO_NODE_BACKEND = "sqlite" ]
RUN apt install -y sqlite3 iputils-ping
ELSE
RUN apt install -y apt-transport-https ca-certificates curl && \
echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' && \
curl -fsSL -o postgresql.asc https://www.postgresql.org/media/keys/ACCC4CF8.asc
gpg --batch --yes --dearmor -o /etc/apt/trusted.gpg.d/postgresql.gpg postgresql.asc && \
rm postgresql.asc && \
apt update && \
apt install -y postgresql-16 postgresql-contrib-16 iputils-ping && \
systemctl enable postgresql
END
END
# IF OS Type is Opensuse
Expand All @@ -298,7 +311,14 @@ base-image:
# zypper purge-kernels && \
IF $TWO_NODE
RUN zypper install -y sqlite3 iputils
IF [ $TWO_NODE_BACKEND = "sqlite" ]
RUN zypper install -y sqlite3 iputils
ELSE
RUN zypper --non-interactive --quiet addrepo --refresh -p 90 http://download.opensuse.org/repositories/server:database:postgresql/openSUSE_Tumbleweed/ PostgreSQL && \
zypper --gpg-auto-import-keys ref && \
zypper install -y postgresql-16 postgresql-server-16 postgresql-contrib iputils && \
systemctl enable postresql
END
END
RUN zypper install -y zstd vim
RUN zypper cc && \
Expand Down

0 comments on commit 443d564

Please sign in to comment.