Files

43 lines
1.6 KiB
Bash

#!/usr/bin/env bash
set -euo pipefail
project_dir="$(cd "$(dirname "$0")/.." && pwd)"
bundle_dir="$(dirname "$project_dir")"
cd "$project_dir"
case "$(uname -m)" in
aarch64|arm64) ;;
*) echo 'This bundle is only for Linux ARM64.'; exit 1 ;;
esac
docker info >/dev/null
docker compose version
test -d "$bundle_dir/images" || { echo 'Use the complete offline bundle, including images/.'; exit 1; }
test -d wheelhouse || { echo 'Missing ARM64 wheelhouse.'; exit 1; }
if [ ! -f .env ] && [ "$#" -ne 1 ]; then
echo 'Usage: bash install.sh relay.your-company-domain'
exit 1
fi
if [ -f "$bundle_dir/SHA256SUMS" ]; then
(cd "$bundle_dir" && sha256sum -c SHA256SUMS)
fi
for image_file in "$bundle_dir"/images/*.tar; do
docker load -i "$image_file"
done
# Loaded Python base + local ARM64 wheels only. No apt/pip download or remote build frontend.
docker build --network none --pull=false -f Dockerfile.offline -t hainuo-relay:0.1.0 .
if [ ! -f .env ]; then
docker run --rm --user "$(id -u):$(id -g)" -v "$project_dir:/work" -w /work \
hainuo-relay:0.1.0 init --hostname "$1"
fi
if [ "$(id -u)" -eq 0 ]; then
chown -R 10001:10001 runtime/connector
chmod 700 runtime/connector
chmod 600 runtime/connector/connector.key
else
sudo chown -R 10001:10001 runtime/connector
sudo chmod 700 runtime/connector
sudo chmod 600 runtime/connector/connector.key
fi
docker compose -f compose.yaml -f compose.offline.yaml up -d --no-build --pull never
bash scripts/verify_deployment.sh
echo 'Offline service installation finished. Configure real TLS/platform settings for acceptance.'
echo 'Keep operator/ca.key on the offline signing workstation; do not share .env or private keys.'