80 lines
2.4 KiB
Bash
Executable File
80 lines
2.4 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Wiki.js Setup Script for Home Server
|
|
# This script helps you set up your personal Wiki.js instance
|
|
|
|
set -e
|
|
|
|
echo "🚀 Setting up Wiki.js for your home server..."
|
|
|
|
# Check if Docker is installed
|
|
if ! command -v docker &> /dev/null; then
|
|
echo "❌ Docker is not installed. Please install Docker first."
|
|
echo "Visit: https://docs.docker.com/engine/install/"
|
|
exit 1
|
|
fi
|
|
|
|
# Check if Docker Compose is installed
|
|
if ! command -v docker-compose &> /dev/null && ! docker compose version &> /dev/null; then
|
|
echo "❌ Docker Compose is not installed. Please install Docker Compose first."
|
|
echo "Visit: https://docs.docker.com/compose/install/"
|
|
exit 1
|
|
fi
|
|
|
|
# Generate a secure database password if not already set
|
|
if [ ! -f .env ]; then
|
|
echo "❌ .env file not found. Please create it first."
|
|
exit 1
|
|
fi
|
|
|
|
# Check if password is still the default
|
|
if grep -q "your_secure_database_password_here" .env; then
|
|
echo "🔐 Generating secure database password..."
|
|
SECURE_PASSWORD=$(openssl rand -base64 32)
|
|
sed -i "s/your_secure_database_password_here/$SECURE_PASSWORD/g" .env
|
|
echo "✅ Secure password generated and saved to .env"
|
|
fi
|
|
|
|
# Create necessary directories
|
|
echo "📁 Creating data directories..."
|
|
mkdir -p data/wiki
|
|
mkdir -p data/db
|
|
mkdir -p data/assets
|
|
|
|
# Set proper permissions
|
|
echo "🔧 Setting permissions..."
|
|
chmod 755 data/wiki data/db data/assets
|
|
|
|
# Pull the latest images
|
|
echo "📥 Pulling Docker images..."
|
|
docker-compose pull
|
|
|
|
# Start the services
|
|
echo "🏃 Starting Wiki.js services..."
|
|
docker-compose up -d
|
|
|
|
# Wait for services to be ready
|
|
echo "⏳ Waiting for services to start..."
|
|
sleep 10
|
|
|
|
# Check if services are running
|
|
if docker-compose ps | grep -q "Up"; then
|
|
echo "✅ Wiki.js is starting up!"
|
|
echo ""
|
|
echo "🌐 Your wiki will be available at: http://localhost:3000"
|
|
echo "⏰ Please wait 1-2 minutes for the initial setup to complete."
|
|
echo ""
|
|
echo "📋 Next steps:"
|
|
echo "1. Open http://localhost:3000 in your browser"
|
|
echo "2. Complete the initial setup wizard"
|
|
echo "3. Create your administrator account"
|
|
echo "4. Start adding content to your personal wiki!"
|
|
echo ""
|
|
echo "📊 To check status: docker-compose logs -f"
|
|
echo "🛑 To stop: docker-compose down"
|
|
echo "🔄 To restart: docker-compose restart"
|
|
else
|
|
echo "❌ Something went wrong. Check the logs with: docker-compose logs"
|
|
exit 1
|
|
fi
|