diff --git a/.deploy.env.example b/.deploy.env.example new file mode 100644 index 0000000..a6a8fcf --- /dev/null +++ b/.deploy.env.example @@ -0,0 +1,7 @@ +# Deploy credentials for inference.coop Surfer (WebDAV). +# This file is gitignored — never commit it. +# Copy to .deploy.env and fill in the values. + +SURFER_URL=https://inference.coop/_webdav/ +SURFER_USER= +SURFER_TOKEN= diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0df405c --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +# Deploy credentials — never commit +.deploy.env +.cloudron.env diff --git a/deploy.sh b/deploy.sh new file mode 100644 index 0000000..fb4e253 --- /dev/null +++ b/deploy.sh @@ -0,0 +1,60 @@ +#!/usr/bin/env bash +# Deploy the Inference Cooperative landing page to Cloudron Surfer via WebDAV. +# +# Usage: +# ./deploy.sh +# +# Credentials are read from .deploy.env (gitignored) or environment variables: +# SURFER_URL WebDAV base URL (e.g. https://inference.coop/_webdav/) +# SURFER_USER WebDAV username +# SURFER_TOKEN WebDAV password / app token +# +# The script uploads the contents of landing-page/ (index.html, favicon.svg, +# fonts/) to the Surfer instance, creating directories as needed and +# overwriting existing files. + +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +SITE_DIR="$SCRIPT_DIR/landing-page" + +# Load credentials from .deploy.env if present +if [[ -f "$SCRIPT_DIR/.deploy.env" ]]; then + set -a + # shellcheck disable=SC1091 + source "$SCRIPT_DIR/.deploy.env" + set +a +fi + +: "${SURFER_URL:?SURFER_URL is required (set in .deploy.env or env)}" +: "${SURFER_USER:?SURFER_USER is required}" +: "${SURFER_TOKEN:?SURFER_TOKEN is required}" + +# Strip trailing slash for clean joining +SURFER_URL="${SURFER_URL%/}" + +AUTH=(-u "$SURFER_USER:$SURFER_TOKEN") + +echo "Deploying $SITE_DIR -> $SURFER_URL" + +# 1. Create all directories (MKCOL). WebDAV requires parent collections to +# exist before files can be uploaded into them. +find "$SITE_DIR" -type d | while read -r dir; do + rel="${dir#"$SITE_DIR"}" + # Skip the root (rel is empty) + [[ -z "$rel" ]] && continue + dest="$SURFER_URL/$rel" + echo " mkdir $rel" + # MKCOL returns 405 if the collection already exists — that's fine. + curl -sS -X MKCOL "${AUTH[@]}" "$dest" >/dev/null 2>&1 || true +done + +# 2. Upload every file, preserving relative paths. +find "$SITE_DIR" -type f | while read -r file; do + rel="${file#"$SITE_DIR"/}" + dest="$SURFER_URL/$rel" + echo " -> $rel" + curl -sS -f -T "$file" "${AUTH[@]}" "$dest" +done + +echo "Deploy complete." diff --git a/index.html b/index.html index c737013..2baa43c 100644 --- a/index.html +++ b/index.html @@ -386,7 +386,7 @@
- Become a member + Become a member Member login