#!/bin/sh # Set up the ShockAI model host template on a fresh box: a Fly Sprite, or any # Linux or macOS host with Node 24 (or Python 3.11 and pip for the Python one). # # curl -fsSL https://app.shockai.co/developers/templates/v0/bootstrap.sh | sh -s -- node # curl -fsSL https://app.shockai.co/developers/templates/v0/bootstrap.sh | sh -s -- python # # It downloads the template into ./shockai-model and says how to start it. # It changes nothing else on the box. Guide: # https://app.shockai.co/developers/guides/host-your-model set -eu LANGUAGE="${1:-node}" BASE="${SHOCKAI_TEMPLATES_URL:-https://app.shockai.co/developers/templates/v0}" DIR="${SHOCKAI_MODEL_DIR:-shockai-model}" case "$LANGUAGE" in node) FILES="server.mts model.mts manifest.json" ;; python) FILES="server.py model.py requirements.txt manifest.json" ;; *) echo "Usage: bootstrap.sh node|python" >&2; exit 2 ;; esac mkdir -p "$DIR/data" for FILE in $FILES; do curl -fsSL "$BASE/$FILE" -o "$DIR/$FILE" done chmod 700 "$DIR/data" echo "The template is in $DIR. Next:" echo " 1. Put your model in $DIR/model.* and describe it in $DIR/manifest.json:" echo " its id must start with your team's namespace." if [ "$LANGUAGE" = python ]; then echo " 2. pip install -r $DIR/requirements.txt" echo " 3. PUBLIC_ORIGIN=https:// BUILD_HASH= python3 $DIR/server.py" else echo " 2. PUBLIC_ORIGIN=https:// BUILD_HASH= node $DIR/server.mts" fi echo "On first start it makes your key, $DIR/data/host-key.pem, and prints a signing block:" echo "add it to manifest.json to pin the key, and keep the key file, which the host then needs." echo "On a Sprite, make its URL reachable without a Fly login: sprite url update --auth public" echo "Then connect it from your team's Models page with https:///shockai/v0."