AkurAI Build
Menu

Public repository / 68352ecfad2afd0e0444a481d1b5d4fbd277f920

AkurAI-Platform / scripts/deploy-ec2.sh

Latest change 0183a48e4f75fa9dcea1bf01af89c93ddb3fe5be - Refactor platform into a polished SaaS product-suite front door by Olafur Bui

#!/usr/bin/env bash
set -euo pipefail

ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
FRAMEWORK="${AKURAI_FRAMEWORK:-/home/olafurbui/Projects/AkurAI-Framework}"
BIN="${AKURAI_BIN:-$FRAMEWORK/target/x86_64-unknown-linux-musl/release/akurai}"
NAME="akurai-platform"
PORT="8098"
DOMAIN="${AKURAI_PLATFORM_DOMAIN:-platform.olibuijr.com}"

if [[ ! -x "$BIN" ]]; then
  (cd "$FRAMEWORK" && cargo build --release --target x86_64-unknown-linux-musl -p akurai)
fi

akurai-ec2 deploy-binary "$NAME" "$BIN" "$PORT" "$ROOT"
akurai-ec2 nginx-proxy "$DOMAIN" "$PORT"
# nginx-proxy only scaffolds the HTTP vhost; (re)attach the TLS cert so the
# public 443 block keeps pointing at this app. Idempotent — reuses the existing
# Let's Encrypt cert when one is present, otherwise obtains it via certbot.
akurai-ec2 tls "$DOMAIN"
akurai-ec2 ssh "curl -fsS http://127.0.0.1:$PORT/api/health >/dev/null && systemctl is-active $NAME.service"