Skip to content

Commit

Permalink
feat: quick install script for macos & wsl & Raspberry Pi (#229)
Browse files Browse the repository at this point in the history
Co-authored-by: liuyu <>
  • Loading branch information
eball authored Jul 19, 2024
1 parent af3d705 commit 40f8f06
Show file tree
Hide file tree
Showing 10 changed files with 155 additions and 6 deletions.
40 changes: 38 additions & 2 deletions .github/workflows/release-daily.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
run: |
v=1.6.0-$(date +"%Y%m%d")
echo "tag_version=$v" >> $GITHUB_OUTPUT
echo "latest_version=1.4.4" >> $GITHUB_OUTPUT
echo "latest_version=1.6.0-alpha" >> $GITHUB_OUTPUT
- name: 'Checkout source code'
uses: actions/checkout@v3
Expand All @@ -45,8 +45,44 @@ jobs:
run: |
aws s3 cp install-wizard-v${{ steps.vars.outputs.tag_version }}.tar.gz s3://terminus-os-install/install-wizard-v${{ steps.vars.outputs.tag_version }}.tar.gz --acl=public-read
upload-full-arm64:
runs-on: self-hosted

steps:
- name: Maximize build space
uses: easimon/maximize-build-space@master
with:
root-reserve-mb: 21200
swap-size-mb: 1024
remove-dotnet: 'true'
remove-android: 'true'
remove-haskell: 'true'
remove-codeql: 'true'

- name: 'Daily tag version'
id: vars
run: |
v=1.7.0-$(date +"%Y%m%d")
echo "tag_version=$v" >> $GITHUB_OUTPUT
echo "latest_version=1.6.0-alpha" >> $GITHUB_OUTPUT
- name: 'Checkout source code'
uses: actions/checkout@v3

- name: Package installer
run: |
bash scripts/build-full.sh ${{ steps.vars.outputs.tag_version }} linux/arm64
- name: Upload to S3
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: 'us-east-1'
run: |
aws s3 cp install-wizard-v${{ steps.vars.outputs.tag_version }}.tar.gz s3://terminus-os-install/install-wizard-v${{ steps.vars.outputs.tag_version }}-arm64.tar.gz --acl=public-read
release:
needs: upload-full
needs: [upload-full, upload-full-arm64]
runs-on: ubuntu-latest

steps:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ jobs:
build/installer/publicAddnode.sh
build/installer/version.hint
build/installer/publicRestoreInstaller.sh
build/installer/install.sh
# prerelease: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30 changes: 30 additions & 0 deletions .github/workflows/upload-full.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,33 @@ jobs:
run: |
aws s3 cp install-wizard-v${{ github.event.inputs.tags }}.tar.gz s3://terminus-os-install/install-wizard-v${{ github.event.inputs.tags }}.tar.gz --acl=public-read
release-arm64:
runs-on: self-hosted

steps:
# - name: Maximize build space
# uses: easimon/maximize-build-space@master
# with:
# root-reserve-mb: 21200
# swap-size-mb: 1024
# remove-dotnet: 'true'
# remove-android: 'true'
# remove-haskell: 'true'
# remove-codeql: 'true'
- name: 'Checkout source code'
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.tags }}

- name: Package installer
run: |
bash scripts/build-full.sh ${{ github.event.inputs.tags }} linux/arm64
- name: Upload to S3
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: 'us-east-1'
run: |
aws s3 cp install-wizard-v${{ github.event.inputs.tags }}.tar.gz s3://terminus-os-install/install-wizard-v${{ github.event.inputs.tags }}-arm64.tar.gz --acl=public-read
32 changes: 31 additions & 1 deletion build/installer/change_ip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,22 @@ is_k3s(){
}

precheck_os() {
# check os type and arch and os vesion
os_type=$(uname -s)
os_arch=$(uname -m)
os_verion=$(lsb_release -d 2>&1 | awk -F'\t' '{print $2}')

case "$os_arch" in
arm64) ARCH=arm64; ;;
x86_64) ARCH=amd64; ;;
armv7l) ARCH=arm; ;;
aarch64) ARCH=arm64; ;;
ppc64le) ARCH=ppc64le; ;;
s390x) ARCH=s390x; ;;
*) echo "unsupported arch, exit ...";
exit -1; ;;
esac

# try to resolv hostname
ensure_success $sh_c "hostname -i >/dev/null"

Expand All @@ -98,6 +114,17 @@ precheck_os() {
local_ip="$ip"
}

is_wsl(){
wsl=$(uname -a 2>&1)
if [[ ${wsl} == *WSL* ]]; then
echo 1
return
fi

echo 0
}


regen_cert_conf(){
old_IFS=$IFS
for pem in $1 ; do
Expand Down Expand Up @@ -414,7 +441,10 @@ main() {
fi
fi

update_juicefs
if [[ $(is_wsl) -eq 0 ]]; then
update_juicefs
fi

update_etcd

if is_k3s ; then
Expand Down
27 changes: 26 additions & 1 deletion build/installer/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,29 @@ if [ "x${VERSION}" = "x" ]; then
exit
fi

# check os type and arch and os vesion
os_type=$(uname -s)
os_arch=$(uname -m)
os_verion=$(lsb_release -d 2>&1 | awk -F'\t' '{print $2}')

case "$os_arch" in
arm64) ARCH=arm64; ;;
x86_64) ARCH=amd64; ;;
armv7l) ARCH=arm; ;;
aarch64) ARCH=arm64; ;;
ppc64le) ARCH=ppc64le; ;;
s390x) ARCH=s390x; ;;
*) echo "unsupported arch, exit ...";
exit -1; ;;
esac


DOWNLOAD_URL="https://dc3p1870nn3cj.cloudfront.net/install-wizard-v${VERSION}.tar.gz"

if [ x"${ARCH}" == x"arm64" ]; then
DOWNLOAD_URL="https://dc3p1870nn3cj.cloudfront.net/install-wizard-v${VERSION}-arm64.tar.gz"
fi

echo ""
echo " Downloading Install-Wizard ${VERSION} from ${DOWNLOAD_URL} ... "
echo ""
Expand Down Expand Up @@ -45,4 +66,8 @@ echo "Install-Wizard ${VERSION} Download Complete!"
echo ""


bash ./install_cmd.sh
if [[ x"$os_type" == x"Darwin" ]]; then
bash ./install_macos.sh
else
bash ./install_cmd.sh
fi
1 change: 1 addition & 0 deletions build/installer/install_cmd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ precheck_os() {
os_verion=$(lsb_release -d 2>&1 | awk -F'\t' '{print $2}')

case "$os_arch" in
arm64) ARCH=arm64; ;;
x86_64) ARCH=amd64; ;;
armv7l) ARCH=arm; ;;
aarch64) ARCH=arm64; ;;
Expand Down
1 change: 1 addition & 0 deletions build/installer/publicAddnode.sh
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ precheck_os() {
os_verion=$(lsb_release -d 2>&1 | awk -F'\t' '{print $2}')

case "$os_arch" in
arm64) ARCH=arm64; ;;
x86_64) ARCH=amd64; ;;
armv7l) ARCH=arm; ;;
aarch64) ARCH=arm64; ;;
Expand Down
26 changes: 25 additions & 1 deletion build/installer/publicInstaller.latest
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,28 @@ if [ "x${VERSION}" = "x" ]; then
exit 1
fi

# check os type and arch and os vesion
os_type=$(uname -s)
os_arch=$(uname -m)
os_verion=$(lsb_release -d 2>&1 | awk -F'\t' '{print $2}')

case "$os_arch" in
arm64) ARCH=arm64; ;;
x86_64) ARCH=amd64; ;;
armv7l) ARCH=arm; ;;
aarch64) ARCH=arm64; ;;
ppc64le) ARCH=ppc64le; ;;
s390x) ARCH=s390x; ;;
*) echo "unsupported arch, exit ...";
exit -1; ;;
esac

DOWNLOAD_URL="https://dc3p1870nn3cj.cloudfront.net/install-wizard-v${VERSION}.tar.gz"

if [ x"${ARCH}" == x"arm64" ]; then
DOWNLOAD_URL="https://dc3p1870nn3cj.cloudfront.net/install-wizard-v${VERSION}-arm64.tar.gz"
fi

echo ""
echo " Downloading Install-Wizard ${VERSION} from ${DOWNLOAD_URL} ... "
echo ""
Expand Down Expand Up @@ -46,6 +66,10 @@ echo ""
echo "Install-Wizard ${VERSION} Download Complete!"
echo ""

bash ./install_cmd.sh
if [[ x"$os_type" == x"Darwin" ]]; then
bash ./install_macos.sh
else
bash ./install_cmd.sh
fi

exit
1 change: 1 addition & 0 deletions build/installer/uninstall_cmd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ precheck_os() {
os_verion=$(lsb_release -d 2>&1 | awk -F'\t' '{print $2}')

case "$os_arch" in
arm64) ARCH=arm64; ;;
x86_64) ARCH=amd64; ;;
armv7l) ARCH=arm; ;;
aarch64) ARCH=arm64; ;;
Expand Down
2 changes: 1 addition & 1 deletion build/manifest/images
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ calico/pod2daemon-flexvol:v3.23.2
beclab/citus:12.0
coredns/coredns:1.8.0
csiplugin/snapshot-controller:v4.0.0
beclab/ks-installer-ext:v0.1.8-ext
beclab/ks-installer-ext:v0.1.9-ext
kubesphere/k8s-dns-node-cache:1.15.12
kubesphere/ks-console:v3.3.0
kubesphere/ks-controller-manager:v3.3.0
Expand Down

0 comments on commit 40f8f06

Please sign in to comment.