#!/usr/bin/env bash # Drevalis Creator Studio installer. # # curl -fsSL https://drevalis.com/install.sh | bash # # What this script does: # 1. Checks Docker + Docker Compose are installed # 2. Creates /srv/drevalis (or $INSTALL_DIR if set) and enters it # 3. Writes docker-compose.yml pulling official images from GHCR # 4. Generates an ENCRYPTION_KEY (Fernet) and writes .env # 5. Pulls images and brings up the stack # 6. Prints the URL to open + next steps # # Re-running the script on an existing install is safe: it won't overwrite # the .env (your secrets stay) and compose will just pull + restart. # # Env vars you can override: # INSTALL_DIR (default: /srv/drevalis) # IMAGE_REGISTRY (default: ghcr.io/drevalis) # IMAGE_TAG (default: stable) # LICENSE_SERVER_URL (default: https://license.drevalis.com) set -euo pipefail INSTALL_DIR="${INSTALL_DIR:-/srv/drevalis}" IMAGE_REGISTRY="${IMAGE_REGISTRY:-ghcr.io/drevaliscs}" IMAGE_TAG="${IMAGE_TAG:-stable}" LICENSE_SERVER_URL="${LICENSE_SERVER_URL:-https://license.drevalis.com}" BOLD=$'\033[1m'; DIM=$'\033[2m'; GREEN=$'\033[32m'; YELLOW=$'\033[33m'; RED=$'\033[31m'; RESET=$'\033[0m' log() { printf '%s▶%s %s\n' "$GREEN" "$RESET" "$*"; } warn() { printf '%s!%s %s\n' "$YELLOW" "$RESET" "$*"; } die() { printf '%s✕%s %s\n' "$RED" "$RESET" "$*" >&2; exit 1; } # ─── 1. Prerequisites ───────────────────────────────────────────────────── command -v docker >/dev/null 2>&1 \ || die "Docker is not installed. See https://docs.docker.com/engine/install/" if ! docker compose version >/dev/null 2>&1; then die "Docker Compose plugin not installed. On Ubuntu/Debian: apt install docker-compose-plugin" fi if ! docker info >/dev/null 2>&1; then die "Docker daemon is not running (or your user can't reach the socket). Try: sudo systemctl start docker && sudo usermod -aG docker \$USER (then log out and back in)" fi log "Docker ${BOLD}$(docker version --format '{{.Server.Version}}')${RESET} detected" # ─── 2. Install directory ──────────────────────────────────────────────── if [[ ! -d "$INSTALL_DIR" ]]; then log "Creating $INSTALL_DIR" if ! mkdir -p "$INSTALL_DIR" 2>/dev/null; then log "Needs sudo to create $INSTALL_DIR" sudo mkdir -p "$INSTALL_DIR" sudo chown -R "$(id -u):$(id -g)" "$INSTALL_DIR" fi fi cd "$INSTALL_DIR" log "Working directory: ${BOLD}$(pwd)${RESET}" # ─── 3. docker-compose.yml ─────────────────────────────────────────────── COMPOSE_FILE="$INSTALL_DIR/docker-compose.yml" log "Writing $COMPOSE_FILE" cat > "$COMPOSE_FILE" </dev/null \ || docker run --rm python:3.11-slim bash -c "pip install -q cryptography && python -c 'from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())'") cat > "$ENV_FILE" </dev/null 2>&1; then log "App is healthy" break fi sleep 2 if [[ $i -eq 60 ]]; then warn "App didn't answer /health within 2 minutes — check 'docker compose logs app'" fi done # ─── 6. Done ──────────────────────────────────────────────────────────── echo printf '%s══════════════════════════════════════════════════════════════%s\n' "$GREEN" "$RESET" printf ' %sDrevalis Creator Studio is installed%s\n' "$BOLD" "$RESET" printf '%s══════════════════════════════════════════════════════════════%s\n' "$GREEN" "$RESET" echo echo " Open: http://localhost:3000" echo " Backend API: http://localhost:8000/docs" echo " Compose dir: $INSTALL_DIR" echo echo " Next steps:" echo " 1. Open http://localhost:3000 in your browser" echo " 2. Paste your license key from the welcome email into the activation screen" echo " 3. Settings → ComfyUI Servers → add your local ComfyUI URL" echo " 4. Settings → LLM Configs → add your LLM endpoint" echo echo " Updates: inside the app, Settings → Updates → 'Update now'" echo " Support: https://drevalis.com/download · support@drevalis.com" echo