Initial QSfera import

This commit is contained in:
Курнат Андрей
2026-06-07 10:20:04 +03:00
commit 2315f25754
16485 changed files with 4826827 additions and 0 deletions
@@ -0,0 +1,79 @@
# Simple Bare Metal Install
This install script downloads and installs the КуСфера binary and
configures it in a sandbox directory in the folder where you called
the install script. It also adds a start script called `runqsfera.sh`
to start КуСфера later.
The installation only consists of the bare minimum functionality
without web office and other optional components. Also, it is bound
to localhost by default. **It is only useful for simple test- and
demo cases and not for production.**
To use КуСфера, start it with the start script and head your
browser to http://localhost:9200.
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.
## Data Location
Set the environment variable `OC_BASE_DIR` to a directory where the
`data` and `config` subdirectories shall be located. Per default,
both configuration and storage data are within a sandbox subdirectory
in the current working directory.
## Server Address
Set the environment variable `OC_HOST` to the fully qualified hostname
of this server to allow remote access. Default: `localhost`.
## HTTPS
The demo setup uses plain HTTP by default so browsers can open it
without a certificate warning. If HTTPS is required, set `OC_TLS=true`
before running the install script:
```
OC_TLS=true ./install.sh
```
In HTTPS mode the proxy creates a self-signed certificate unless
`PROXY_TRANSPORT_TLS_CERT` and `PROXY_TRANSPORT_TLS_KEY` point to a
certificate trusted by the browser. A self-signed certificate is useful
for tests, but Chrome will show `ERR_CERT_AUTHORITY_INVALID` for it.
For an existing demo install that should be reachable on a LAN address
without a browser certificate warning, edit `runqsfera.sh` so the public
URL and proxy TLS settings match the address:
```
export OC_URL=http://192.168.0.185:9200
export PROXY_TLS=false
```
# Example
Call
```
OC_VERSION="2.0.0" ./install.sh
```
to install the КуСфера version 2.0.0
There is also a hosted version of this script that makes it even
easier:
```
curl -L https://qsfera.eu/install.sh | bash -x
```
@@ -0,0 +1,128 @@
#!/bin/bash
set -euo pipefail
#
# Quick and dirty quickstart script to fire up a local КуСфера instance.
# Klaas Freitag <k.freitag@qsfera.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 qsfera:
# curl -L https://qsfera.eu/install | /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
}
function get_latest_version() {
latest_version=$(curl -s https://api.github.com/repos/qsfera-eu/qsfera/releases/latest \
| grep '"tag_name":' \
| awk -F: '{print $2}' \
| tr -d ' ",v')
}
# URL pattern of the download file
# https://github.com/qsfera/server/releases/download/v1.0.0/qsfera-1.0.0-linux-amd64
get_latest_version
dlversion="${OC_VERSION:-$latest_version}"
dlurl="https://github.com/qsfera/server/releases/download/v${dlversion}/"
sandbox="qsfera-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" ) ||
( "$(uname -s)" == "Linux" && "$(uname -m)" == "aarch64" ) ]]; then
dlarch="arm64"
fi
# ...results in the download file
dlfile="qsfera-${dlversion}-${os}-${dlarch}"
# download
echo "Downloading ${dlurl}/${dlfile}"
curl -L -o "${dlfile}" --progress-bar "${dlurl}/${dlfile}"
chmod 755 ${dlfile}
basedir="${OC_BASE_DIR:-$(pwd)}"
export OC_CONFIG_DIR="$basedir/config"
export OC_BASE_DATA_PATH="$basedir/data"
mkdir -p "$OC_CONFIG_DIR" "$OC_BASE_DATA_PATH"
# 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}"
tls="${OC_TLS:-false}"
protocol="http"
if [ "${tls}" = "true" ] || [ "${tls}" = "yes" ] || [ "${tls}" = "1" ]; then
protocol="https"
tls="true"
else
tls="false"
fi
./${dlfile} init --insecure yes --admin-password admin
echo '#!/bin/bash
SCRIPT_DIR="$(dirname "$(readlink -f "${0}")")"
cd "${SCRIPT_DIR}"' > runqsfera.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=${protocol}://${host}:9200
export PROXY_TLS=${tls}
export IDM_CREATE_DEMO_USERS=true
export PROXY_ENABLE_BASIC_AUTH=true
export OC_LOG_LEVEL=warning
./"${dlfile}" server
" >> runqsfera.sh
chmod 755 runqsfera.sh
echo "Connect to КуСфера via ${protocol}://${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 КуСфера again"
echo " using the script ${sandbox}/runqsfera.sh"
echo ""
./runqsfera.sh