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
This commit is contained in:
+43
-66
@@ -2,82 +2,59 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
echo "🚀 Starting Checkcle Installation..."
|
REPO_URL="https://github.com/operacle/checkcle.git"
|
||||||
|
CLONE_DIR="/opt/checkcle"
|
||||||
|
DATA_DIR="/opt/pb_data"
|
||||||
|
PORT=8090
|
||||||
|
|
||||||
# Check if npm is installed
|
echo "🚀 Installing Checkcle from $REPO_URL"
|
||||||
if ! command -v npm &> /dev/null; then
|
|
||||||
echo "📦 npm is not installed. Installing Node.js and npm..."
|
|
||||||
|
|
||||||
# Install Node.js and npm (Ubuntu/Debian-based systems)
|
# Step 1: Check if port 8090 is already in use
|
||||||
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
|
if lsof -i :"$PORT" &>/dev/null; then
|
||||||
sudo apt-get install -y nodejs
|
echo "❗ ERROR: Port $PORT is already in use. Please free the port or change the Docker Compose configuration."
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Clone the repo
|
# Step 2: Ensure Docker is installed
|
||||||
if [ ! -d "checkcle" ]; then
|
if ! command -v docker &> /dev/null; then
|
||||||
echo "📁 Cloning repository..."
|
echo "🔧 Docker not found. Installing Docker..."
|
||||||
git clone https://github.com/operacle/checkcle.git
|
curl -fsSL https://get.docker.com | sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd checkcle
|
# Step 3: Ensure Docker Compose v2 is available
|
||||||
|
if ! docker compose version &> /dev/null; then
|
||||||
|
echo "❗ Docker Compose v2 not found. Please install Docker Compose v2 and rerun this script."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# Set up paths
|
# Step 4: Clone the repository
|
||||||
PROJECT_DIR=$(pwd)
|
if [ -d "$CLONE_DIR" ]; then
|
||||||
APP_DIR="$PROJECT_DIR/application"
|
echo "📁 Directory $CLONE_DIR already exists. Pulling latest changes..."
|
||||||
PB_DIR="$PROJECT_DIR/server"
|
git -C "$CLONE_DIR" pull
|
||||||
PB_BINARY="$PB_DIR/pocketbase"
|
else
|
||||||
|
echo "📥 Cloning repo to $CLONE_DIR"
|
||||||
|
git clone "$REPO_URL" "$CLONE_DIR"
|
||||||
|
fi
|
||||||
|
|
||||||
# Install web dependencies
|
# Step 5: Create data volume directory if it doesn’t exist
|
||||||
echo "📦 Installing Web Application dependencies..."
|
if [ ! -d "$DATA_DIR" ]; then
|
||||||
cd "$APP_DIR"
|
echo "📁 Creating data volume directory at $DATA_DIR"
|
||||||
npm install
|
sudo mkdir -p "$DATA_DIR"
|
||||||
|
sudo chown "$(whoami)":"$(whoami)" "$DATA_DIR"
|
||||||
|
fi
|
||||||
|
|
||||||
# Create systemd service for frontend
|
# Step 6: Start the service
|
||||||
echo "🛠️ Setting up systemd service for Web Application..."
|
cd "$CLONE_DIR"
|
||||||
sudo tee /etc/systemd/system/checkcle-web.service > /dev/null <<EOF
|
echo "📦 Starting Checkcle service with Docker Compose..."
|
||||||
[Unit]
|
docker compose up -d
|
||||||
Description=Checkcle Web Application
|
|
||||||
After=network.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=simple
|
|
||||||
WorkingDirectory=$APP_DIR
|
|
||||||
ExecStart=/usr/bin/npm run dev
|
|
||||||
Restart=on-failure
|
|
||||||
User=$USER
|
|
||||||
Environment=NODE_ENV=development
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# Create systemd service for PocketBase
|
|
||||||
echo "🛠️ Setting up systemd service for PocketBase..."
|
|
||||||
sudo tee /etc/systemd/system/checkcle-pb.service > /dev/null <<EOF
|
|
||||||
[Unit]
|
|
||||||
Description=Checkcle PocketBase Server
|
|
||||||
After=network.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=simple
|
|
||||||
WorkingDirectory=$PB_DIR
|
|
||||||
ExecStart=$PB_BINARY serve --dir pb_data
|
|
||||||
Restart=on-failure
|
|
||||||
User=$USER
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# Reload systemd and start services
|
|
||||||
echo "🔄 Enabling and starting services..."
|
|
||||||
sudo systemctl daemon-reexec
|
|
||||||
sudo systemctl daemon-reload
|
|
||||||
sudo systemctl enable --now checkcle-web
|
|
||||||
sudo systemctl enable --now checkcle-pb
|
|
||||||
|
|
||||||
|
# Step 7: Show success output
|
||||||
echo ""
|
echo ""
|
||||||
echo "✅ All done!"
|
echo "✅ Checkcle has been successfully installed and started."
|
||||||
echo "🌐 Admin Panel: http://0.0.0.0:8090"
|
echo ""
|
||||||
|
echo "🛠️ Admin Web Management"
|
||||||
|
echo "🔗 Default URL: http://0.0.0.0:$PORT"
|
||||||
echo "👤 User: admin@example.com"
|
echo "👤 User: admin@example.com"
|
||||||
echo "🔑 Passwd: Admin123456"
|
echo "🔑 Passwd: Admin123456"
|
||||||
|
echo ""
|
||||||
|
echo "📌 Make sure port $PORT is accessible from your host system or cloud firewall."
|
||||||
|
|||||||
Reference in New Issue
Block a user