From c389f73c14a7cb12b86168c4db0e9c258ccd8088 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 17 Mar 2026 00:38:00 -0700 Subject: setup script --- README.md | 6 ++++++ compose.yml.sample | 13 +++++++++++++ setup.sh | 50 ++++++++++++++++++++++++++++++++++++++++++-------- 3 files changed, 61 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 1b6fcd31..97c4ac63 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,12 @@ This repo is the API server. The frontend is at [coinos/coinos-ui](https://githu ## Getting Started +```bash +bash <(curl -s https://raw.githubusercontent.com/coinos/coinos-server/staging/setup.sh) +``` + +Or clone and run manually: + ```bash git clone https://github.com/coinos/coinos-server.git cd coinos-server diff --git a/compose.yml.sample b/compose.yml.sample index c56c668e..da4d5294 100644 --- a/compose.yml.sample +++ b/compose.yml.sample @@ -1,4 +1,17 @@ services: + ui: + image: ghcr.io/coinos/base + container_name: ui + command: "bun run dev" + environment: + - NODE_ENV=development + - API_URL=http://app:3119 + ports: + - '5173:5173' + - '24678:24678' + volumes: + - ../coinos-ui:/home/bun/app + restart: always app: image: ghcr.io/coinos/base container_name: app diff --git a/setup.sh b/setup.sh index 5a4e2267..e1cc1d01 100755 --- a/setup.sh +++ b/setup.sh @@ -36,6 +36,20 @@ warn() { echo -e " ${YELLOW}!${NC} $*"; } err() { echo -e " ${RED}✗${NC} $*"; } step() { echo -e "\n${BOLD}${GREEN}▸ $*${NC}"; } +# Bootstrap: if run via curl (not from inside the repo), clone first +if [ ! -f "compose.yml.sample" ]; then + REPO_DIR="${COINOS_DIR:-$HOME/coinos-server}" + if [ ! -d "$REPO_DIR" ]; then + echo -e " ${BLUE}•${NC} Cloning coinos-server..." + git clone https://github.com/coinos/coinos-server.git "$REPO_DIR" + cd "$REPO_DIR" + git checkout staging 2>/dev/null || true + else + cd "$REPO_DIR" + fi + exec bash "$REPO_DIR/setup.sh" "$@" +fi + DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" cd "$DIR" @@ -275,18 +289,38 @@ setup_network() { install_deps() { step "Installing application dependencies" + # Server deps if [ -d node_modules ] && [ -d node_modules/.cache ]; then - ok "node_modules exists (run 'bun i' manually to update)" - return + ok "Server node_modules exists" + else + info "Running bun install for server..." + docker run --rm \ + -v "$DIR":/home/bun/app \ + -w /home/bun/app \ + ghcr.io/coinos/base bun i + ok "Server dependencies installed" fi - info "Running bun install (via Docker)..." - docker run --rm \ - -v "$DIR":/home/bun/app \ - -w /home/bun/app \ - ghcr.io/coinos/base bun i + # UI deps + local ui_dir="$DIR/../coinos-ui" + if [ ! -d "$ui_dir" ]; then + info "Cloning coinos-ui..." + git clone https://github.com/coinos/coinos-ui.git "$ui_dir" 2>/dev/null || { + warn "Could not clone coinos-ui — skipping frontend setup" + return + } + fi - ok "Dependencies installed" + if [ -d "$ui_dir/node_modules" ]; then + ok "UI node_modules exists" + else + info "Running bun install for UI..." + docker run --rm \ + -v "$ui_dir":/home/bun/app \ + -w /home/bun/app \ + ghcr.io/coinos/base bun i + ok "UI dependencies installed" + fi } # ── phase 7: pull images ──────────────────────────────────────────── -- cgit v1.2.3