Skip to content

Commit

Permalink
Devbox offline deploy. (#5159)
Browse files Browse the repository at this point in the history
* add devbox offline install scripts

* devbox-offline

* fix kubefile
  • Loading branch information
lingdie authored Oct 17, 2024
1 parent 3c67bd1 commit 4c7d6a9
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 72 deletions.
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 scripts scripts

ENV cloudDomain=${cloudDomain:-"127.0.0.1.nip.io"}
ENV cloudPort=""
ENV registryAddr=${registryAddr:-"sealos.hub:5000"}
ENV registryUser=${registryUser:-"admin"}
ENV registryPassword=${registryPassword:-"passw0rd"}

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

mkdir -p tars

RetryPullImageInterval=3
RetrySleepSeconds=3


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
6 changes: 6 additions & 0 deletions deploy/devbox/scripts/init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

set -e

sealos run tars/devbox-controller.tar -e cloudDomain=${cloudDomain} -e cloudPort=${cloudPort} -e registryAddr=${registryAddr} -e registryUser=${registryUser} -e registryPassword=${registryPassword}
sealos run tars/devbox-frontend.tar -e cloudDomain=${cloudDomain} -e cloudPort=${cloudPort}
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
8 changes: 1 addition & 7 deletions frontend/providers/devbox/deploy/Kubefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ COPY manifests manifests
ENV cloudDomain="127.0.0.1.nip.io"
ENV cloudPort=""
ENV certSecretName="wildcard-cert"
ENV monitorUrl="http://database-monitor.sealos.svc.cluster.local:9090"
ENV minioUrl=""
ENV minioAccessKey=""
ENV minioSecretKey=""
ENV minioPort=""
ENV migrateFileImage=""
ENV minioBucketName=""
ENV registryAddr="sealos.hub:5000"

CMD ["kubectl apply -f manifests"]
8 changes: 4 additions & 4 deletions frontend/providers/devbox/deploy/manifests/deploy.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,17 @@ spec:
- name: devbox-frontend
env:
- name: SEALOS_DOMAIN
value: { { .cloudDomain } }
value: {{ .cloudDomain }}
- name: INGRESS_SECRET
value: wildcard-cert
- name: REGISTRY_ADDR
value: hub.{{ .cloudDomain }}{{ if .cloudPort }}:{{ .cloudPort }}{{ end }}
value: {{ .registryAddr }}
- name: DEVBOX_AFFINITY_ENABLE
value: 'true'
- name: MONITOR_URL
value: http://launchpad-monitor.sealos.svc.cluster.local:8428
- name: SQUASH_ENABLE
value: 'true'
value: 'false'
- name: ACCOUNT_URL
value: http://account-service.account-system.svc.cluster.local:2333
securityContext:
Expand All @@ -63,7 +63,7 @@ spec:
cpu: 2000m
memory: 2048Mi
requests:
cpu: 10m
cpu: 100m
memory: 128Mi
# do not modify this image, it is used for CI/CD
image: ghcr.io/labring/sealos-devbox-frontend:latest
Expand Down
30 changes: 0 additions & 30 deletions frontend/providers/devbox/deploy/manifests/rbac.yaml

This file was deleted.

30 changes: 0 additions & 30 deletions frontend/providers/devbox/deploy/scripts/update-backup-label.sh

This file was deleted.

0 comments on commit 4c7d6a9

Please sign in to comment.