mirror of
https://github.com/KohakuBlueleaf/KohakuHub.git
synced 2026-03-09 07:12:07 -05:00
kohakuboard deploy
This commit is contained in:
60
scripts/deploy_board.py
Normal file
60
scripts/deploy_board.py
Normal file
@@ -0,0 +1,60 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Deploy KohakuBoard (build frontend + start Docker)"""
|
||||
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def main():
|
||||
print("=" * 60)
|
||||
print("KohakuBoard Deployment Script")
|
||||
print("=" * 60)
|
||||
|
||||
# Build frontend
|
||||
print("\n[1/3] Installing frontend dependencies...")
|
||||
result = subprocess.run(
|
||||
["npm", "install", "--prefix", "./src/kohaku-board-ui"],
|
||||
check=False,
|
||||
)
|
||||
if result.returncode != 0:
|
||||
print("✗ Failed to install dependencies")
|
||||
sys.exit(1)
|
||||
|
||||
print("\n[2/3] Building frontend...")
|
||||
result = subprocess.run(
|
||||
["npm", "run", "build", "--prefix", "./src/kohaku-board-ui"],
|
||||
check=False,
|
||||
)
|
||||
if result.returncode != 0:
|
||||
print("✗ Failed to build frontend")
|
||||
sys.exit(1)
|
||||
|
||||
print("\n[3/3] Starting Docker services...")
|
||||
result = subprocess.run(
|
||||
[
|
||||
"docker-compose",
|
||||
"-f",
|
||||
"docker-compose.kohakuboard.yml",
|
||||
"up",
|
||||
"-d",
|
||||
"--build",
|
||||
],
|
||||
check=False,
|
||||
)
|
||||
if result.returncode != 0:
|
||||
print("✗ Failed to start Docker services")
|
||||
sys.exit(1)
|
||||
|
||||
print("\n" + "=" * 60)
|
||||
print("✓ KohakuBoard deployed successfully!")
|
||||
print("=" * 60)
|
||||
print(f"\nWeb UI: http://localhost:28081")
|
||||
print(f"API Docs: http://localhost:48889/api/docs")
|
||||
print("\nView logs: docker-compose -f docker-compose.kohakuboard.yml logs -f")
|
||||
print("Stop services: docker-compose -f docker-compose.kohakuboard.yml down")
|
||||
print()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
62
scripts/test_server_board.py
Normal file
62
scripts/test_server_board.py
Normal file
@@ -0,0 +1,62 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Start KohakuBoard test server (SQLite, remote mode, no Docker)
|
||||
|
||||
This is a convenience script for testing remote mode with SQLite database.
|
||||
Useful for development and testing without Docker.
|
||||
"""
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
||||
def main():
|
||||
print("=" * 60)
|
||||
print("KohakuBoard Test Server (SQLite + Remote Mode)")
|
||||
print("=" * 60)
|
||||
|
||||
# Set test configuration
|
||||
os.environ["KOHAKU_BOARD_MODE"] = "remote"
|
||||
os.environ["KOHAKU_BOARD_DB_BACKEND"] = "sqlite"
|
||||
os.environ["KOHAKU_BOARD_DATABASE_URL"] = "sqlite:///test-kohakuboard.db"
|
||||
os.environ["KOHAKU_BOARD_AUTH_SESSION_SECRET"] = "test-secret-do-not-use-in-prod"
|
||||
os.environ["KOHAKU_BOARD_AUTH_REQUIRE_EMAIL_VERIFICATION"] = "false"
|
||||
os.environ["KOHAKU_BOARD_AUTH_INVITATION_ONLY"] = "false"
|
||||
os.environ["KOHAKU_BOARD_BASE_URL"] = "http://localhost:48889"
|
||||
os.environ["KOHAKU_BOARD_PORT"] = "48889"
|
||||
os.environ["KOHAKU_BOARD_SMTP_ENABLED"] = "false"
|
||||
|
||||
print("\n📋 Configuration:")
|
||||
print(f" Mode: remote")
|
||||
print(f" Database: test-kohakuboard.db (SQLite)")
|
||||
print(f" Port: 48889")
|
||||
print(f" Auth: Enabled (no email verification)")
|
||||
print("\n🌐 URLs:")
|
||||
print(f" API: http://localhost:48889")
|
||||
print(f" API Docs: http://localhost:48889/api/docs")
|
||||
print("\n⚠️ Note: This is a TEST server. Do NOT use in production!")
|
||||
print("=" * 60)
|
||||
print("\nStarting server...\n")
|
||||
|
||||
try:
|
||||
subprocess.run(
|
||||
[
|
||||
"uvicorn",
|
||||
"kohakuboard.main:app",
|
||||
"--host",
|
||||
"0.0.0.0",
|
||||
"--port",
|
||||
"48889",
|
||||
"--reload",
|
||||
],
|
||||
check=True,
|
||||
)
|
||||
except KeyboardInterrupt:
|
||||
print("\n\nServer stopped by user")
|
||||
except Exception as e:
|
||||
print(f"\n✗ Server error: {e}")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user