Switch deploy from WebDAV to cloudron exec (drop stale WebDAV token dependency)

This commit is contained in:
inference-bot committed 2026-09-23 20:45:12 -06:00
1 parent 448dbadbf0
commit 36078be586
2 files changed
+36 -51

No files matched your search

+9 -6
View File
@@ -1,7 +1,10 @@
# Deploy credentials for inference.coop Surfer (WebDAV). # Deploy credentials for inference.coop Surfer.
# This file is gitignored — never commit it. #
# Copy to .deploy.env and fill in the values. # Deploys now use `cloudron exec` (see deploy.sh), so the only credential is the
# Cloudron API token — no WebDAV token is needed.
#
# Copy to .deploy.env and fill in the value (this file is gitignored).
SURFER_URL=https://inference.coop/_webdav/ CLOUDRON_TOKEN=
SURFER_USER= CLOUDRON_SERVER=my.inference.coop
SURFER_TOKEN= SURFER_APP=inference.coop
Regular → Executable
+27 -45
View File
@@ -1,60 +1,42 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Deploy the Inference Cooperative landing page to Cloudron Surfer via WebDAV. # Deploy the Inference Cooperative landing page to Cloudron Surfer.
#
# Uses `cloudron exec` to write files directly into Surfer's /app/data/public
# directory — no WebDAV token or SSH required. Auth is the Cloudron CLI token
# (read from env as CLOUDRON_TOKEN, the same token the CLI uses everywhere else).
# #
# Usage: # Usage:
# ./deploy.sh # CLOUDRON_TOKEN=... ./deploy.sh
# #
# Credentials are read from .deploy.env (gitignored) or environment variables: # The script uploads the repo's site assets (index.html, favicon.svg, fonts/,
# SURFER_URL WebDAV base URL (e.g. https://inference.coop/_webdav/) # thanks/, and the static assets) to the Surfer instance.
# 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 set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SITE_DIR="$SCRIPT_DIR/landing-page"
# Load credentials from .deploy.env if present : "${CLOUDRON_TOKEN:?CLOUDRON_TOKEN is required (the Cloudron API token)}"
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)}" SERVER="${CLOUDRON_SERVER:-my.inference.coop}"
: "${SURFER_USER:?SURFER_USER is required}" APP="${SURFER_APP:-inference.coop}" # Surfer app location
: "${SURFER_TOKEN:?SURFER_TOKEN is required}"
# Strip trailing slash for clean joining # Files that make up the live site, mirrored in /app/data/public/.
SURFER_URL="${SURFER_URL%/}" SITE_FILES=(
index.html
favicon.svg
robots.txt
sitemap.xml
metagov-earth.png
fonts
thanks
)
AUTH=(-u "$SURFER_USER:$SURFER_TOKEN") echo "Deploying to $SERVER ($APP) via cloudron exec"
echo "Deploying $SITE_DIR -> $SURFER_URL" # Tar the site files and extract into Surfer's public dir on the server.
# cloudron exec is not a TTY, so `tar -x` works over the stdin pipe.
# 1. Create all directories (MKCOL). WebDAV requires parent collections to tar cf - "${SITE_FILES[@]}" | \
# exist before files can be uploaded into them. cloudron --server "$SERVER" --token "$CLOUDRON_TOKEN" exec --app "$APP" -- \
find "$SITE_DIR" -type d | while read -r dir; do sh -c 'tar xf - -C /app/data/public'
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." echo "Deploy complete."