π₯π₯π₯ Open-source Jira, Linear, Monday, and ClickUp alternative. Plane is a modern project management platform to manage tasks, sprints, docs, and triage.
TypeScript boardsbug-trackerdjangodockerganttissue-trackerjirajira-alternativekanbanlinearpostgresqlproduct-managementproject-managementproject-planningpythonreactredistypesciptvitework-management
chore: Check github releases for upgrades (#6162)
Manish Guptaa0f03d07f306
diff --git a/deploy/selfhost/README.md b/deploy/selfhost/README.mdindex d93d85ca14..ccd8bf328c 100644--- a/deploy/selfhost/README.md+++ b/deploy/selfhost/README.md@@ -62,7 +62,7 @@ mkdir plane-selfhostcd plane-selfhost-curl -fsSL -o setup.sh https://raw.githubusercontent.com/makeplane/plane/master/deploy/selfhost/install.sh+curl -fsSL -o setup.sh https://github.com/makeplane/plane/releases/latest/download/setup.shchmod +x setup.sh```diff --git a/deploy/selfhost/install.sh b/deploy/selfhost/install.shindex 08cd4d9169..1c2208cab7 100755--- a/deploy/selfhost/install.sh+++ b/deploy/selfhost/install.sh@@ -4,9 +4,12 @@ BRANCH=${BRANCH:-master}SCRIPT_DIR=$PWDSERVICE_FOLDER=plane-appPLANE_INSTALL_DIR=$PWD/$SERVICE_FOLDER-export APP_RELEASE="stable"+export APP_RELEASE=stableexport DOCKERHUB_USER=makeplaneexport PULL_POLICY=${PULL_POLICY:-if_not_present}+export GH_REPO=makeplane/plane+export RELEASE_DOWNLOAD_URL="https://github.com/$GH_REPO/releases/download"+export FALLBACK_DOWNLOAD_URL="https://raw.githubusercontent.com/$GH_REPO/$BRANCH/deploy/selfhost"CPU_ARCH=$(uname -m)OS_NAME=$(uname)@@ -16,13 +19,6 @@ mkdir -p $PLANE_INSTALL_DIR/archiveDOCKER_FILE_PATH=$PLANE_INSTALL_DIR/docker-compose.yamlDOCKER_ENV_PATH=$PLANE_INSTALL_DIR/plane.env-SED_PREFIX=()-if [ "$OS_NAME" == "Darwin" ]; then- SED_PREFIX=("-i" "")-else- SED_PREFIX=("-i")-fi-function print_header() {clear@@ -59,6 +55,17 @@ function spinner() {printf " \b\b\b\b" >&2}+function checkLatestRelease(){+ echo "Checking for the latest release..." >&2+ local latest_release=$(curl -s https://api.github.com/repos/$GH_REPO/releases/latest | grep -o '"tag_name": "[^"]*"' | sed 's/"tag_name": "//;s/"//g')+ if [ -z "$latest_release" ]; then+ echo "Failed to check for the latest release. Exiting..." >&2+ exit 1+ fi++ echo $latest_release+}+function initialize(){printf "Please wait while we check the availability of Docker images for the selected release ($APP_RELEASE) with ${UPPER_CPU_ARCH} support." >&2@@ -130,8 +137,12 @@ function updateEnvFile() {echo "$key=$value" >> "$file"returnelse- # if key exists, update the value- sed "${SED_PREFIX[@]}" "s/^$key=.*/$key=$value/g" "$file"+ if [ "$OS_NAME" == "Darwin" ]; then+ value=$(echo "$value" | sed 's/|/\\|/g')+ sed -i '' "s|^$key=.*|$key=$value|g" "$file"+ else+ sed -i "s/^$key=.*/$key=$value/g" "$file"+ fifielseecho "File not found: $file"@@ -182,7 +193,7 @@ function buildYourOwnImage(){local PLANE_TEMP_CODE_DIR=~/tmp/planerm -rf $PLANE_TEMP_CODE_DIRmkdir -p $PLANE_TEMP_CODE_DIR- REPO=https://github.com/makeplane/plane.git+ REPO=https://github.com/$GH_REPO.gitgit clone "$REPO" "$PLANE_TEMP_CODE_DIR" --branch "$BRANCH" --single-branch --depth 1cp "$PLANE_TEMP_CODE_DIR/deploy/selfhost/build.yml" "$PLANE_TEMP_CODE_DIR/build.yml"@@ -204,6 +215,10 @@ function install() {echo "Begin Installing Plane"echo ""+ if [ "$APP_RELEASE" == "stable" ]; then+ export APP_RELEASE=$(checkLatestRelease)+ fi+local build_image=$(initialize)if [ "$build_image" == "build" ]; then@@ -232,8 +247,49 @@ function download() {mv $PLANE_INSTALL_DIR/docker-compose.yaml $PLANE_INSTALL_DIR/archive/$TS.docker-compose.yamlfi- curl -H 'Cache-Control: no-cache, no-store' -s -o $PLANE_INSTALL_DIR/docker-compose.yaml https://raw.githubusercontent.com/makeplane/plane/$BRANCH/deploy/selfhost/docker-compose.yml?$(date +%s)- curl -H 'Cache-Control: no-cache, no-store' -s -o $PLANE_INSTALL_DIR/variables-upgrade.env https://raw.githubusercontent.com/makeplane/plane/$BRANCH/deploy/selfhost/variables.env?$(date +%s)+ RESPONSE=$(curl -H 'Cache-Control: no-cache, no-store' -s -w "HTTPSTATUS:%{http_code}" "$RELEASE_DOWNLOAD_URL/$APP_RELEASE/docker-compose.yml?$(date +%s)")+ BODY=$(echo "$RESPONSE" | sed -e 's/HTTPSTATUS\:.*//g')+ STATUS=$(echo "$RESPONSE" | tr -d '\n' | sed -e 's/.*HTTPSTATUS://')++ if [ "$STATUS" -eq 200 ]; then+ echo "$BODY" > $PLANE_INSTALL_DIR/docker-compose.yaml+ else+ # Fallback to download from the raw github url+ RESPONSE=$(curl -H 'Cache-Control: no-cache, no-store' -s -w "HTTPSTATUS:%{http_code}" "$FALLBACK_DOWNLOAD_URL/docker-compose.yml?$(date +%s)")+ BODY=$(echo "$RESPONSE" | sed -e 's/HTTPSTATUS\:.*//g')+ STATUS=$(echo "$RESPONSE" | tr -d '\n' | sed -e 's/.*HTTPSTATUS://')++ if [ "$STATUS" -eq 200 ]; then+ echo "$BODY" > $PLANE_INSTALL_DIR/docker-compose.yaml+ else+ echo "Failed to download docker-compose.yml. HTTP Status: $STATUS"+ echo "URL: $RELEASE_DOWNLOAD_URL/$APP_RELEASE/docker-compose.yml"+ mv $PLANE_INSTALL_DIR/archive/$TS.docker-compose.yaml $PLANE_INSTALL_DIR/docker-compose.yaml+ exit 1+ fi+ fi++ RESPONSE=$(curl -H 'Cache-Control: no-cache, no-store' -s -w "HTTPSTATUS:%{http_code}" "$RELEASE_DOWNLOAD_URL/$APP_RELEASE/variables.env?$(date +%s)")+ BODY=$(echo "$RESPONSE" | sed -e 's/HTTPSTATUS\:.*//g')+ STATUS=$(echo "$RESPONSE" | tr -d '\n' | sed -e 's/.*HTTPSTATUS://')++ if [ "$STATUS" -eq 200 ]; then+ echo "$BODY" > $PLANE_INSTALL_DIR/variables-upgrade.env+ else+ # Fallback to download from the raw github url+ RESPONSE=$(curl -H 'Cache-Control: no-cache, no-store' -s -w "HTTPSTATUS:%{http_code}" "$FALLBACK_DOWNLOAD_URL/variables.env?$(date +%s)")+ BODY=$(echo "$RESPONSE" | sed -e 's/HTTPSTATUS\:.*//g')+ STATUS=$(echo "$RESPONSE" | tr -d '\n' | sed -e 's/.*HTTPSTATUS://')++ if [ "$STATUS" -eq 200 ]; then+ echo "$BODY" > $PLANE_INSTALL_DIR/variables-upgrade.env+ else+ echo "Failed to download variables.env. HTTP Status: $STATUS"+ echo "URL: $RELEASE_DOWNLOAD_URL/$APP_RELEASE/variables.env"+ mv $PLANE_INSTALL_DIR/archive/$TS.docker-compose.yaml $PLANE_INSTALL_DIR/docker-compose.yaml+ exit 1+ fi+ fiif [ -f "$DOCKER_ENV_PATH" ];then@@ -335,6 +391,34 @@ function restartServices() {startServices}function upgrade() {+ local latest_release=$(checkLatestRelease)++ echo ""+ echo "Current release: $APP_RELEASE"++ if [ "$latest_release" == "$APP_RELEASE" ]; then+ echo ""+ echo "You are already using the latest release"+ exit 0+ fi++ echo "Latest release: $latest_release"+ echo ""++ # Check for confirmation to upgrade+ echo "Do you want to upgrade to the latest release ($latest_release)?"+ read -p "Continue? [y/N]: " confirm++ if [[ ! "$confirm" =~ ^[Yy]$ ]]; then+ echo "Exiting..."+ exit 0+ fi++ export APP_RELEASE=$latest_release++ echo "Upgrading Plane to the latest release..."+ echo ""+echo "***** STOPPING SERVICES ****"stopServices