install.sh
Passes direct-IP URL to a callReferences curl flags and HTTP URL
SHA-2563785f6e0d2cf37b953256806cb64272f405395c6d6f8f2fd77d28e0240dd296c
MaleculeH₅(Cm₁₀F₇OsPo₄U₂)
Evidence
1#!/usr/bin/env bash
2#
3# FreeLLMAPI one-line installer (#250, idea by @StealthTensor).
4#
5# curl -fsSL https://tashfeenahmed.github.io/freellmapi/install.sh | bash
6#
7# What it does:
8# 1. Checks for Docker or Podman (+ a Compose front-end).
9# 2. Creates an install dir (default ~/freellmapi, override FREELLMAPI_DIR).
10# 3. Writes a docker-compose.yml pinned to ghcr.io/tashfeenahmed/freellmapi:latest
11# and a .env with a freshly generated ENCRYPTION_KEY (kept on re-runs).
12# 4. Pulls the image, starts the container, waits for the health endpoint.
13#
14# Options (env vars):
15# FREELLM …
22:60… ed to :latest.
23
24set -euo pipefail
25
26INSTALL_DIR="${FREELLMAPI_DIR:-$HOME/freellmapi}"
27PORT="${PORT:-3001}"
28HOST_BIND="${HOST_BIND:-127.0.0.1}"
29IMAGE="ghcr.io/tashfeenahmed/freellmapi:latest"
30
31say() { printf '\033[1;32m==>\033[0m %s\n' "$*"; }
32warn() { printf '\033[1;33mWARN\033[0m %s\n' "$*" >&2; }
33die() { printf '\033[1;31mERROR\033[0m %s\n' "$*" >&2; exit 1; }
34
35# ── 1. prerequisites ���────────────────────────────────────────────────────────
36# Docker and Podman are interchangeable here (#1497): the compose file this
37# script writes uses no Docker-only features, and Podman ships a drop-in
38# `podman compose` (pl …
39:23… �� it's what the image was tested against.
40if command -v docker >/dev/null 2>&1; then
41 ENGINE=(docker)
42elif command -v podman >/dev/null 2>&1; then
43 ENGINE=(podman)
44else
45 die "Docker or Podman is required. Install one (https://docs.docker.com/get-docker/ or https://podman.io) and re-run."
46fi
47
48if "${ENGINE[@]}" compose version >/dev/null 2>&1; then
49 COMPOSE=("${ENGINE[@]}" compos …
58:37… || die "${ENGINE[*]} isn't running (or you lack permission). Start it and re-run."
59
60# ── 2. install dir ���──────────────────────────────────────────────────────────
61mkdir -p "$INSTALL_DIR"
62cd "$INSTALL_DIR"
63say "Installing into $INSTALL_DIR"
64
65# ── 3. .env (generated once — your at-rest encryption key lives here) ���───────
66if [ -f .env ]; then
67 say "Keeping existing .env (encryption key preserved)"
68else
69 if command -v openssl >/dev/null 2>&1; then
70 KEY="$(openssl rand -hex 32)"
71 else
72 # /dev/urandom fallback when openssl isn't installed
73 KEY="$(od -vN 32 -An -tx1 /dev/urandom | tr -d ' \n')"
74 fi
75 umask 077
76 cat > .env <<EOF
77# Generated by install.sh on $(date -u +%Y-%m-%dT%H:%M:%SZ)
78# At-rest encryption key for your stored provider keys. Losing it means
79# re-entering your provider keys, so back this file up. …
88:15… mpose file (image-only; refreshed on every run) ─────────────────────
89cat > docker-compose.yml <<EOF
90# Written by install.sh — safe to edit; re-running the installer rewrites it.
91services:
92 freellmapi:
93 image: $IMAGE
94 env_file:
95 - .env
96 environment:
97 NODE_ENV: production
98 PORT: 3001
99 # Bound to localhost by default — FreeLLMAPI is single-user and must not
100 # be exposed to the internet. Set HOS …