From 11ddc77e32a0eb30e086b1215190814564cc7dd8 Mon Sep 17 00:00:00 2001 From: Tola Leng Date: Fri, 6 Jun 2025 17:42:18 +0800 Subject: [PATCH] Updated: one-click installation bash script that includes the output information after the container starts, such as the admin web management URL and default login credentials --- scripts/setup.sh | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/scripts/setup.sh b/scripts/setup.sh index 43a9737..85e698e 100644 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -2,14 +2,14 @@ set -e -REPO_URL="https://github.com/operacle/checkcle.git" -CLONE_DIR="/opt/checkcle" DATA_DIR="/opt/pb_data" PORT=8090 +COMPOSE_FILE="/opt/docker-compose.yml" +RAW_URL="https://raw.githubusercontent.com/operacle/checkcle/main/docker-compose.yml" -echo "πŸš€ Installing Checkcle from $REPO_URL" +echo "πŸš€ Installing Checkcle using Docker Compose" -# Step 1: Check if port 8090 is already in use +# Step 1: Check if port is already in use if lsof -i :"$PORT" &>/dev/null; then echo "❗ ERROR: Port $PORT is already in use. Please free the port or change the Docker Compose configuration." exit 1 @@ -27,13 +27,12 @@ if ! docker compose version &> /dev/null; then exit 1 fi -# Step 4: Clone the repository -if [ -d "$CLONE_DIR" ]; then - echo "πŸ“ Directory $CLONE_DIR already exists. Pulling latest changes..." - git -C "$CLONE_DIR" pull +# Step 4: Download docker-compose.yml if not exists +if [ ! -f "$COMPOSE_FILE" ]; then + echo "πŸ“₯ Downloading docker-compose.yml to $COMPOSE_FILE..." + curl -fsSL "$RAW_URL" -o "$COMPOSE_FILE" else - echo "πŸ“₯ Cloning repo to $CLONE_DIR" - git clone "$REPO_URL" "$CLONE_DIR" + echo "βœ… docker-compose.yml already exists at $COMPOSE_FILE" fi # Step 5: Create data volume directory if it doesn’t exist @@ -44,16 +43,19 @@ if [ ! -d "$DATA_DIR" ]; then fi # Step 6: Start the service -cd "$CLONE_DIR" +cd /opt echo "πŸ“¦ Starting Checkcle service with Docker Compose..." -docker compose up -d +docker compose -f "$COMPOSE_FILE" up -d -# Step 7: Show success output +# Step 7: Detect host IP address +HOST_IP=$(hostname -I | awk '{print $1}') + +# Step 8: Show success output echo "" echo "βœ… Checkcle has been successfully installed and started." echo "" echo "πŸ› οΈ Admin Web Management" -echo "πŸ”— Default URL: http://0.0.0.0:$PORT" +echo "πŸ”— Default URL: http://$HOST_IP:$PORT" echo "πŸ‘€ User: admin@example.com" echo "πŸ”‘ Passwd: Admin123456" echo ""