Skip to content

Commit

Permalink
add devbox offline install scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
lingdie committed Oct 17, 2024
1 parent 1306895 commit bb00114
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 1 deletion.
11 changes: 11 additions & 0 deletions deploy/devbox/Kubefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM scratch
COPY tars tars
COPY etc etc
COPY scripts scripts
COPY manifests manifests
COPY registry registry

ENV cloudDomain=${cloudDomain:-"127.0.0.1.nip.io"}
ENV cloudPort=""

CMD ["bash scripts/init.sh"]
51 changes: 51 additions & 0 deletions deploy/devbox/init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash
readonly ARCH=${1:-amd64}
set -e

mkdir -p tars

RetryPullImageInterval=3
RetryPullFileInterval=3
RetrySleepSeconds=3

retryPullFile() {
local file=$1
local retry=0
local retryMax=3
set +e
while [ $retry -lt $RetryPullFileInterval ]; do
curl $file --create-dirs -o ./etc/minio-binaries/mc >/dev/null && break
retry=$(($retry + 1))
echo "retry pull file $file, retry times: $retry"
sleep $RetrySleepSeconds
done
set -e
if [ $retry -eq $retryMax ]; then
echo "pull file $file failed"
exit 1
fi
}

retryPullImage() {
local image=$1
local retry=0
local retryMax=3
set +e
while [ $retry -lt $RetryPullImageInterval ]; do
sealos pull --policy=always --platform=linux/"${ARCH}" $image >/dev/null && break
retry=$(($retry + 1))
echo "retry pull image $image, retry times: $retry"
sleep $RetrySleepSeconds
done
set -e
if [ $retry -eq $retryMax ]; then
echo "pull image $image failed"
exit 1
fi
}

retryPullImage ghcr.io/labring/sealos-cloud-devbox-controller:latest
retryPullImage ghcr.io/labring/sealos-cloud-devbox-frontend:latest

sealos save -o tars/devbox-controller.tar ghcr.io/labring/sealos-cloud-devbox-controller:latest
sealos save -o tars/devbox-frontend.tar ghcr.io/labring/sealos-cloud-devbox-frontend:latest
3 changes: 3 additions & 0 deletions deploy/devbox/scripts/init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

set -e
2 changes: 1 addition & 1 deletion deploy/objectstorage/init.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
set -e
export readonly ARCH=${1:-amd64}
readonly ARCH=${1:-amd64}
mkdir -p tars

RetryPullImageInterval=3
Expand Down

0 comments on commit bb00114

Please sign in to comment.