From 547fc845a443c288aeab639065af0b90f66ea6cb Mon Sep 17 00:00:00 2001 From: j Date: Mon, 29 Dec 2025 13:23:10 +1300 Subject: [PATCH] config: Update 5 files --- seafile/config/service.env | 2 +- seafile/destroy.sh | 7 +++++-- seafile/docker-compose.yml | 1 + seafile/install.sh | 28 +++++++++++++++++++++++++--- seafile/uninstall.sh | 5 +---- 5 files changed, 33 insertions(+), 10 deletions(-) diff --git a/seafile/config/service.env b/seafile/config/service.env index 7b52816..73c7c87 100644 --- a/seafile/config/service.env +++ b/seafile/config/service.env @@ -13,7 +13,7 @@ DATA_PATH="/home/dropshell/seafile" # Seafile server configuration SEAFILE_SERVER_HOSTNAME="seafile.example.com" -SEAFILE_SERVER_PROTOCOL="http" +SEAFILE_SERVER_PROTOCOL="https" HTTP_PORT=8080 # Admin credentials (change these!) diff --git a/seafile/destroy.sh b/seafile/destroy.sh index 5ba8db3..cb8bcc8 100755 --- a/seafile/destroy.sh +++ b/seafile/destroy.sh @@ -16,7 +16,10 @@ cd "$SCRIPT_DIR" || _die "Failed to change to script directory" # Stop and remove containers docker compose -p "${CONTAINER_NAME}" down -v 2>/dev/null || true -# Remove data directory -rm -rf "${DATA_PATH}" +# Remove data directory using Docker (files are owned by root from containers) +if [ -d "${DATA_PATH}" ]; then + docker run --rm -v "${DATA_PATH}:/data" alpine rm -rf /data/* /data/.[!.]* 2>/dev/null || true + rmdir "${DATA_PATH}" 2>/dev/null || true +fi echo "Destroyed ${CONTAINER_NAME} and all data." diff --git a/seafile/docker-compose.yml b/seafile/docker-compose.yml index d5d31e4..d19daf2 100644 --- a/seafile/docker-compose.yml +++ b/seafile/docker-compose.yml @@ -43,6 +43,7 @@ services: SEAFILE_ADMIN_EMAIL: ${SEAFILE_ADMIN_EMAIL} SEAFILE_ADMIN_PASSWORD: ${SEAFILE_ADMIN_PASSWORD} SEAFILE_SERVER_HOSTNAME: ${SEAFILE_SERVER_HOSTNAME} + SEAFILE_SERVER_PROTOCOL: ${SEAFILE_SERVER_PROTOCOL} SEAFILE_SERVER_LETSENCRYPT: "false" JWT_PRIVATE_KEY: ${JWT_PRIVATE_KEY} TIME_ZONE: ${TZ} diff --git a/seafile/install.sh b/seafile/install.sh index 372faf5..c75a497 100755 --- a/seafile/install.sh +++ b/seafile/install.sh @@ -18,9 +18,31 @@ cd "$SCRIPT_DIR" || _die "Failed to change to script directory" # Stop existing containers docker compose -p "${CONTAINER_NAME}" down 2>/dev/null || true -# Start containers (pull latest images if available) -docker compose -p "${CONTAINER_NAME}" up -d --pull always || _die "Failed to start containers" +# Start containers (only pull if image missing locally) +docker compose -p "${CONTAINER_NAME}" up -d --pull missing || _die "Failed to start containers" + +echo "Waiting for Seafile to initialize..." + +# Wait for Seafile to be fully ready (check for seahub process) +# shellcheck disable=SC2034 +for i in {1..60}; do + if docker exec "${CONTAINER_NAME}" pgrep -f "seahub" &>/dev/null; then + echo "Seafile is ready" + break + fi + sleep 3 +done + +# Give it a moment to fully initialize +sleep 5 + +# Always update admin credentials using Seafile's reset-admin script +echo "Setting admin credentials..." +docker exec "${CONTAINER_NAME}" bash -c " +cd /opt/seafile/seafile-server-latest +echo -e '${SEAFILE_ADMIN_EMAIL}\n${SEAFILE_ADMIN_PASSWORD}\n${SEAFILE_ADMIN_PASSWORD}' | ./reset-admin.sh +" 2>&1 echo "Installation of ${CONTAINER_NAME} complete" echo "Access Seafile at ${SEAFILE_SERVER_PROTOCOL}://${SEAFILE_SERVER_HOSTNAME}:${HTTP_PORT}" -echo "Note: First startup may take a few minutes while Seafile initializes the database." +echo "Login with: ${SEAFILE_ADMIN_EMAIL}" diff --git a/seafile/uninstall.sh b/seafile/uninstall.sh index 19db0f1..0fb7d62 100755 --- a/seafile/uninstall.sh +++ b/seafile/uninstall.sh @@ -10,11 +10,8 @@ export SEAFILE_SERVER_HOSTNAME SEAFILE_SERVER_PROTOCOL JWT_PRIVATE_KEY TZ cd "$SCRIPT_DIR" || _die "Failed to change to script directory" -# Stop and remove containers (but preserve volumes/data) +# Stop and remove containers (but preserve volumes/data and images) docker compose -p "${CONTAINER_NAME}" down || _die "Failed to stop containers" -# Remove images -docker compose -p "${CONTAINER_NAME}" config --images | xargs -r docker rmi 2>/dev/null || true - echo "Uninstallation of ${CONTAINER_NAME} complete." echo "Data preserved in ${DATA_PATH}. To remove all data, use destroy.sh"