#!/bin/sh # Amfora installer. # # curl -fsSL https://amfora.solutionmax.net/get | sh published image (default) # curl -fsSL https://amfora.solutionmax.net/get | sh -s -- --source build the release tag yourself # # Keep execution inside main so a partial download cannot run a partial body. main() { set -eu # Bumped by infra/update-versions.sh on every release, so a new install always # starts on the version the website announces. AMFORA_VERSION="2.2.0" IMAGE="ghcr.io/solutionmax/amfora:$AMFORA_VERSION" mode=image case "${1:-}" in ""|--docker|--image) ;; --source) mode=source ;; --help|-h) printf '%s\n' \ "Amfora $AMFORA_VERSION installer" \ '' \ ' sh get pull the published image and start it in ./amfora (Docker with Compose v2)' \ ' sh get --source clone the release tag and build it (also needs Git, Bash and Buildx 0.30+)' \ '' \ 'Updating later: https://amfora.solutionmax.net/docs/#updating' return 0 ;; *) printf '%s\n' 'Unknown option. Use --help to see the choices.' >&2; return 2 ;; esac if [ "$#" -gt 1 ]; then printf '%s\n' 'Unexpected arguments. Use --help.' >&2 return 2 fi fail() { printf 'Amfora: %s\n' "$1" >&2; exit 1; } command -v docker >/dev/null 2>&1 || fail 'Install Docker first, then run this command again: https://docs.docker.com/engine/install/' docker info >/dev/null 2>&1 || fail 'Docker is not running or your account cannot access it.' docker compose version >/dev/null 2>&1 || fail 'Docker Compose v2 is required.' [ ! -e amfora ] && [ ! -L amfora ] || fail './amfora already exists. No files were changed. To update an existing installation see https://amfora.solutionmax.net/docs/#updating' if docker inspect amfora >/dev/null 2>&1 || docker volume inspect amfora_amfora_data >/dev/null 2>&1; then fail 'An Amfora container or data volume already exists. This installer only handles fresh installations.' fi if [ "$mode" = source ]; then for tool in git bash; do command -v "$tool" >/dev/null 2>&1 || fail "Install $tool first, then run this command again." done prune_help=$(docker buildx prune --help 2>/dev/null) || fail 'Docker Buildx 0.30 or later is required for --source.' for option in --max-used-space --reserved-space --min-free-space; do case "$prune_help" in *"$option"*) ;; *) fail 'Upgrade Docker Buildx to 0.30 or later.' ;; esac done export GIT_TERMINAL_PROMPT=0 repo=https://github.com/Solutionmax/amfora.git printf 'Downloading Amfora %s into ./amfora...\n' "$AMFORA_VERSION" git clone --branch "v$AMFORA_VERSION" --depth 1 "$repo" amfora docker-compose.yaml <