mirror of
https://github.com/stellarshenson/stellars-jupyterhub-ds.git
synced 2026-03-08 22:20:28 +00:00
64 lines
1.6 KiB
Bash
Executable File
64 lines
1.6 KiB
Bash
Executable File
#!/bin/bash
|
|
# Start JupyterHub platform
|
|
# Usage: ./start.sh [--refresh]
|
|
|
|
set -e
|
|
|
|
cd "$(dirname "$0")"
|
|
|
|
REPO_URL="https://github.com/stellarshenson/stellars-jupyterhub-ds.git"
|
|
REPO_DIR="stellars-jupyterhub-ds"
|
|
REFRESH=false
|
|
|
|
# Load defaults, then local overrides
|
|
source .env.default
|
|
if [[ -f .env ]]; then
|
|
source .env
|
|
fi
|
|
|
|
# Parse arguments
|
|
while [[ $# -gt 0 ]]; do
|
|
case $1 in
|
|
--refresh)
|
|
REFRESH=true
|
|
shift
|
|
;;
|
|
*)
|
|
echo "Unknown option: $1"
|
|
echo "Usage: $0 [--refresh]"
|
|
exit 1
|
|
;;
|
|
esac
|
|
done
|
|
|
|
if [ -d "$REPO_DIR" ]; then
|
|
if [ "$REFRESH" = true ]; then
|
|
echo "Refreshing $REPO_DIR..."
|
|
git -C "$REPO_DIR" fetch origin main
|
|
git -C "$REPO_DIR" checkout -B main origin/main
|
|
else
|
|
echo "Using existing $REPO_DIR (use --refresh to update)"
|
|
fi
|
|
else
|
|
echo "Cloning $REPO_DIR..."
|
|
git clone "$REPO_URL"
|
|
fi
|
|
|
|
# Build compose command with optional CIFS mount
|
|
COMPOSE_FILES="--env-file .env.default"
|
|
if [[ -f .env ]]; then
|
|
COMPOSE_FILES="${COMPOSE_FILES} --env-file .env"
|
|
fi
|
|
COMPOSE_FILES="${COMPOSE_FILES} -f stellars-jupyterhub-ds/compose.yml -f compose_override.yml"
|
|
if [[ "${ENABLE_CIFS}" == "1" ]]; then
|
|
echo "CIFS mount enabled"
|
|
COMPOSE_FILES="${COMPOSE_FILES} -f compose_cifs.yml"
|
|
fi
|
|
|
|
echo "Starting JupyterHub platform..."
|
|
docker compose ${COMPOSE_FILES} pull
|
|
docker pull stellars/stellars-jupyterlab-ds:latest
|
|
docker compose ${COMPOSE_FILES} up -d --no-build
|
|
|
|
echo "Done. Access: https://${JUPYTERHUB_PREFIX:-jupyterhub.}${BASE_HOSTNAME:-localhost}/"
|