Add the bare metal simple install script as example

This commit is contained in:
Klaas Freitag
2025-03-04 17:11:14 +01:00
committed by Klaas Freitag
parent 9c85f9e02f
commit 11fe6bb9f4
2 changed files with 153 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
# Simple Bare Metal Install
This install script downloads and installs the OpenCloud binary and
configures it in a sandbox directory in the folder where you called
the install script. It also adds a start script called `runopencloud.sh`
to start OpenCloud later.
The installation only consists of the bare minimum functionality
without web office and other optional components. Also, it is bound
to localhost and has no valid certificates. ** It is only
useful for simple test- and demo cases and not for production.**
To use OpenCloud, start it with the start script and head your
browser to https://localhost:9200. The invalid certificate must
be acknowledged in the browser.
The demo users (eg. alan / demo) are enabled, the admin password
is surprisingly `admin`.
This script should **NOT** be run as user root.
# Options
## Version
Set the environment variable `OC_VERSION` to the version you want
to download. If not set, there is a reasonable default.
# Example
Call
```
OC_VERSION="1.0.0" ./install.sh
```
to install the OpenCloud version 1.0.0
There is also a hosted version of this script that makes it even
easier:
```
curl -L https://opencloud.eu/oc-install.sh | bash -x
```

View File

@@ -0,0 +1,109 @@
#!/bin/bash
set -euo pipefail
#
# Quick and dirty quickstart script to fire up a local OpenCloud instance.
# Klaas Freitag <k.freitag@opencloud.eu>
#
# This script supports the following environment variables:
# OC_VERSION: Version to download, e.g. OC_VERSION="1.2.0"
# Call this script directly from opencloud:
# curl -L https://opencloud.eu/quickinstall.sh | /bin/bash
# This function is borrowed from openSUSEs /usr/bin/old, thanks.
function backup_file () {
local DATESTRING=`date +"%Y%m%d"`
i=${1%%/}
if [ -e "$i" ] ; then
local NEWNAME=$i-$DATESTRING
local NUMBER=0
while [ -e "$NEWNAME" ] ; do
NEWNAME=$i-$DATESTRING-$NUMBER
let NUMBER=$NUMBER+1
done
echo moving "$i" to "$NEWNAME"
if [ "${i:0:1}" = "-" ] ; then
i="./$i"
NEWNAME="./$NEWNAME"
fi
mv "$i" "$NEWNAME"
fi
}
# URL pattern of the download file
# https://github.com/opencloud-eu/opencloud/releases/download/v1.0.0/opencloud-1.0.0-linux-amd64
dlversion="${OC_VERSION:-1.0.0}"
dlurl="https://github.com/opencloud-eu/opencloud/releases/download/v${dlversion}/"
sandbox="opencloud-sandbox-${dlversion}"
# Create a sandbox
[ -d "./${sandbox}" ] && backup_file ${sandbox}
mkdir ${sandbox} && cd ${sandbox}
# The operating system
os="linux"
if [[ $OSTYPE == 'darwin'* ]]; then
os="darwin"
fi
# The platform
dlarch="amd64"
if [[ $(uname -s) == "Darwin" && $(uname -m) == "arm64" ]]; then
dlarch="arm64"
fi
# ...results in the download file
dlfile="opencloud-${dlversion}-${os}-${dlarch}"
# download
echo "Downloading ${dlurl}/${dlfile}"
curl -L -o "${dlfile}" --progress-bar "${dlurl}/${dlfile}"
chmod 755 ${dlfile}
mkdir data config
export OC_CONFIG_DIR="$(pwd)/config"
export OC_BASE_DATA_PATH="$(pwd)/data"
# It is bound to localhost for now to deal with non existing routes
# to certain host names for example in WSL
host="localhost"
./${dlfile} init --insecure yes --ap admin
echo '#!/bin/bash
SCRIPT_DIR="$(dirname "$(readlink -f "${0}")")"
cd "${SCRIPT_DIR}"' > runopencloud.sh
echo "export OC_CONFIG_DIR=${OC_CONFIG_DIR}
export OC_BASE_DATA_PATH=${OC_BASE_DATA_PATH}
export OC_INSECURE=true
export OC_URL=https://${host}:9200
export IDM_CREATE_DEMO_USERS=true
export PROXY_ENABLE_BASIC_AUTH=true
export OC_LOG_LEVEL=warning
./"${dlfile}" server
" >> runopencloud.sh
chmod 755 runopencloud.sh
echo "Connect to OpenCloud via https://${host}:9200"
echo ""
echo "*** This is a fragile test setup, not suitable for production! ***"
echo " If you stop this script now, you can run your test OpenCloud again"
echo " using the script ${sandbox}/runopencloud.sh"
echo ""
./runopencloud.sh