Files
SuperCharged-Claude-Code-Up…/install-web.sh
uroma 0dd2083556 Initial commit: Obsidian Web Interface for Claude Code
- Full IDE with terminal integration using xterm.js
- Session management with local and web sessions
- HTML preview functionality
- Multi-terminal support with session picker

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-19 16:29:44 +00:00

108 lines
3.1 KiB
Bash
Executable File

#!/bin/bash
# Setup script for Obsidian Web Interface
# This script configures nginx and systemd service
set -e
echo "🔧 Obsidian Web Interface Setup"
echo "================================"
echo ""
# Check if running as root
if [ "$EUID" -ne 0 ]; then
echo "❌ This script requires root privileges. Please run with sudo:"
echo " sudo ./install-web.sh"
exit 1
fi
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
SERVICE_USER="uroma"
SERVICE_DIR="/home/uroma/obsidian-web-interface"
NGINX_SITES_AVAILABLE="/etc/nginx/sites-available"
NGINX_SITES_ENABLED="/etc/nginx/sites-enabled"
echo "📋 Configuration:"
echo " Service user: $SERVICE_USER"
echo " Service directory: $SERVICE_DIR"
echo " Nginx config: $NGINX_SITES_AVAILABLE/obsidian-web"
echo ""
# 1. Create systemd service
echo "📦 Installing systemd service..."
cp "$SCRIPT_DIR/obsidian-web.service" /etc/systemd/system/
systemctl daemon-reload
echo "✅ Systemd service installed"
# 2. Configure nginx
echo ""
echo "🌐 Configuring nginx..."
# Backup existing config if it exists
if [ -f "$NGINX_SITES_AVAILABLE/obsidian-web" ]; then
echo "⚠️ Existing nginx config found, backing up..."
cp "$NGINX_SITES_AVAILABLE/obsidian-web" "$NGINX_SITES_AVAILABLE/obsidian-web.backup.$(date +%Y%m%d%H%M%S)"
fi
# Copy nginx config
cp "$SCRIPT_DIR/obsidian-nginx.conf" "$NGINX_SITES_AVAILABLE/obsidian-web"
# Create symlink if it doesn't exist
if [ ! -L "$NGINX_SITES_ENABLED/obsidian-web" ]; then
ln -s "$NGINX_SITES_AVAILABLE/obsidian-web" "$NGINX_SITES_ENABLED/obsidian-web"
fi
# Test nginx config
if /usr/sbin/nginx -t 2>&1 | grep -q "successful"; then
echo "✅ Nginx configuration valid"
else
echo "❌ Nginx configuration test failed!"
echo "Please check the configuration with: nginx -t"
exit 1
fi
# Reload nginx
systemctl reload nginx
echo "✅ Nginx reloaded"
# 3. Start the service
echo ""
echo "🚀 Starting Obsidian Web Interface..."
systemctl enable obsidian-web
systemctl start obsidian-web
# Wait a moment for service to start
sleep 2
# Check service status
if systemctl is-active --quiet obsidian-web; then
echo "✅ Service started successfully"
else
echo "⚠️ Service may not have started correctly. Check status with:"
echo " systemctl status obsidian-web"
fi
echo ""
echo "================================"
echo "✅ Setup complete!"
echo ""
echo "📋 Service management:"
echo " Start: sudo systemctl start obsidian-web"
echo " Stop: sudo systemctl stop obsidian-web"
echo " Restart: sudo systemctl restart obsidian-web"
echo " Status: sudo systemctl status obsidian-web"
echo " Logs: sudo journalctl -u obsidian-web -f"
echo ""
echo "🌐 Access your Obsidian Web Interface at:"
echo " http://www.rommark.dev/claude"
echo ""
echo "🔐 Login credentials:"
echo " Username: admin"
echo " Password: !@#\$q1w2e3r4!A"
echo ""
echo "📝 Notes:"
echo " - Your Obsidian vault is at: /home/$SERVICE_USER/obsidian-vault"
echo " - The web server runs on port 3000 (behind nginx reverse proxy)"
echo " - To enable HTTPS, run: sudo certbot --nginx -d www.rommark.dev"
echo ""