Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions deployments/examples/bare-metal-simple/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ get_latest_version

dlversion="${OC_VERSION:-$latest_version}"
dlurl="https://github.com/opencloud-eu/opencloud/releases/download/v${dlversion}/"
dlurl2="https://github.com/opencloud-eu/opencloud/releases/download/${dlversion}/"

sandbox="opencloud-sandbox-${dlversion}"

Expand All @@ -74,6 +75,17 @@ fi
dlfile="opencloud-${dlversion}-${os}-${dlarch}"

# download
status=$(curl -I -L -o /dev/null -s -w "%{http_code}\n" "$dlurl/$dlfile")
if [ "$status" -ne 200 ]; then
echo "HTTP code: $status ($dlurl/$dlfile)"
dlurl=$dlurl2
status=$(curl -I -L -o /dev/null -s -w "%{http_code}\n" "$dlurl2/$dlfile")
if [ "$status" -ne 200 ]; then
echo "HTTP code: $status ($dlurl/$dlfile)"
# exit -1 # or try nevertheless?
fi
fi

echo "Downloading ${dlurl}/${dlfile}"

curl -L -o "${dlfile}" --progress-bar "${dlurl}/${dlfile}"
Expand All @@ -84,12 +96,12 @@ export OC_CONFIG_DIR="$basedir/config"
export OC_BASE_DATA_PATH="$basedir/data"
mkdir -p "$OC_CONFIG_DIR" "$OC_BASE_DATA_PATH"

maincfg="$OC_CONFIG_DIR/opencloud.yaml"

# It is bound to localhost for now to deal with non existing routes
# to certain host names for example in WSL
host="${OC_HOST:-localhost}"

./${dlfile} init --insecure yes --ap admin

echo '#!/bin/bash
SCRIPT_DIR="$(dirname "$(readlink -f "${0}")")"
cd "${SCRIPT_DIR}"' > runopencloud.sh
Expand All @@ -108,6 +120,14 @@ export OC_LOG_LEVEL=warning

chmod 755 runopencloud.sh

if [ -f "$maincfg" ]; then
echo "Main config file $maincfg exists."
echo "Skipping initialization. This might be an update from a previous version."
echo "To restart the server, refer to the script in $basedir or $basedir/$sandbox"
exit 0
fi
./${dlfile} init --insecure yes --ap admin

echo "Connect to OpenCloud via https://${host}:9200"
echo ""
echo "*** This is a fragile test setup, not suitable for production! ***"
Expand Down
Loading