#!/bin/sh # Installs, upgrades and goes back with Lunex on one Linux server, on k3s (deploy/helm/README.md). # # curl -sfL https://get.lunex.etzel.com.tr | LUNEX_TOKEN= sh - # curl -sfL https://get.lunex.etzel.com.tr | LUNEX_TOKEN= sh -s -- --host lunex.example.com \ # --environment prod --tls-cert lunex.crt --tls-key lunex.key # curl -sfL https://get.lunex.etzel.com.tr | sh -s -- --support-bundle # # The options are in usage() below. The token comes from the environment, as k3s's installer takes K3S_TOKEN, so it # stays out of the process list. An ordinary user's run elevates itself with sudo (elevate). # # POSIX sh, because `curl ... | sh` runs it with the system's sh (dash on Debian and Ubuntu). Nothing is # written before the server's checks pass. The script writes the configuration file, k3s's registry # configuration and one auto-deploy manifest; k3s's Helm Controller installs the releases it names. set -eu # The k3s release this Lunex release runs: the newest stable patch of the newest minor that the chart's # kubeVersion (deploy/helm/lunex/Chart.yaml) admits. LUNEX_K3S_VERSION=v1.36.6+k3s1 # Etzel's product registry: the chart's global.productRegistry (scripts/check-installer-constants.sh refuses a difference). PRODUCT_REGISTRY=etzeldigital.azurecr.io/lunex # Gitea's HTTP node port, which the node's registry mirror points at; the installer passes it to the chart as # gitea.service.http.nodePort (derived_values). GITEA_NODE_PORT=30500 CONFIG=/etc/lunex/lunex.yaml MANIFEST=/var/lib/rancher/k3s/server/manifests/lunex.yaml REGISTRIES=/etc/rancher/k3s/registries.yaml SAP_SDK_PATH=/opt/lunex-sap-sdk LOG=/var/log/lunex-install.log K3S=/usr/local/bin/k3s NAMESPACE=lunex # The reference server (deploy/helm/README.md, "Server"): 4 vCPU, 8 GB memory, 40 GB disk. A smaller server gets # a warning and the installation, slower (the owner's decision of 2026-11-07: the release acceptance runs on a # 2 vCPU, 7 GB hosted runner); too little disk stops it, because the images would not fit. An 8 GB server reports # a little less memory after the kernel's reservation, and the disk holds the operating system. REFERENCE_CPUS=4 REFERENCE_MEMORY_KB=7000000 MIN_FREE_DISK_GB=25 # Free disk a later run needs for the images of a new release. MIN_FREE_DISK_GB_UPGRADE=5 WAIT_SECONDS=1200 # The installer-level keys of the configuration file, in their order. KEYS='host environment version token tlsCert tlsKey trustCa sapSdk' say() { printf '%s\n' "$*"; } # Refuses in one sentence. die() { printf '%s\n' "$*" >&2; exit 1; } # Says in one sentence what is below the reference server, and goes on. warn() { printf 'Warning: %s\n' "$*" >&2; } # Every privileged command runs through $SUDO, as in k3s's installer: sudo when an ordinary user runs the installer, # nothing when root does, and nothing when a script sources it as a library. The installer's standard input is the # pipe that carries the script from curl, so a privileged command never reads it: each gets /dev/null || ! sudo true sh - Run it as root or as a user who may use sudo; it runs its privileged commands through sudo. Options; each, like the token, is recorded in /etc/lunex/lunex.yaml, so a later run needs none: --host NAME the address browsers use, a name or an IPv4 address (default: this server's address) --environment ENV dev or prod (default: dev) --version VERSION the Lunex release to install, or latest (default: latest) --tls-cert FILE a certificate of your own for the host (PEM, with its chain), with --tls-key --tls-key FILE its private key (PEM) --trust-ca FILE private CAs (PEM) of your certificate, Git or registries, trusted by the server and Lunex --sap-sdk DIR your SAP JCo SDK (sapjco3.jar and libsapjco3.so), installed at /opt/lunex-sap-sdk An empty value removes a setting, such as --trust-ca ''. --support-bundle on its own: writes lunex-support--