From 47e0977b722c6ab9a08d764db8320a80ae58d31c Mon Sep 17 00:00:00 2001 From: Niranjan Date: Tue, 7 Apr 2026 02:30:14 +0530 Subject: [PATCH] Initial YakPanel commit --- YakPanel-server/README.md | 4 ++-- YakPanel-server/backend/app/core/database.py | 12 +++++++++--- YakPanel-server/install.sh | 7 +++++-- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/YakPanel-server/README.md b/YakPanel-server/README.md index ae2a8698..0071b97b 100644 --- a/YakPanel-server/README.md +++ b/YakPanel-server/README.md @@ -49,7 +49,7 @@ All native installs require **root**. Use `sudo -E ...` when you set environment | Variable | Meaning | Default | | --- | --- | --- | -| `REPO_URL` | Git URL to clone | `https://source.yakpanel.com/admin/yakpanel-core` (fallback: `https://github.com/YakPanel/YakPanel.git`) | +| `REPO_URL` | Git URL to clone | `https://github.com/YakPanel/YakPanel.git` (optional: `https://source.yakpanel.com/admin/yakpanel-core` if anonymous clone is enabled) | | `YAKPANEL_BRANCH` | Branch/tag for shallow clone | default branch | | `GIT_REF` | Alias for `YAKPANEL_BRANCH` | — | | `INSTALL_PATH` | Install directory | `/www/server/YakPanel-server` | @@ -103,7 +103,7 @@ sudo bash scripts/install.sh Uses `docker-compose.yml` in this directory — **not** the same layout as native (no host Nginx unit from `install.sh`). ```bash -git clone --depth 1 https://source.yakpanel.com/admin/yakpanel-core +git clone --depth 1 https://github.com/YakPanel/YakPanel.git # Then cd to this folder (in the full monorepo it is under YakPanel-master/YakPanel-server). cd YakPanel-master/YakPanel-server docker compose up -d diff --git a/YakPanel-server/backend/app/core/database.py b/YakPanel-server/backend/app/core/database.py index cb42b400..ddddce48 100644 --- a/YakPanel-server/backend/app/core/database.py +++ b/YakPanel-server/backend/app/core/database.py @@ -1,7 +1,7 @@ """YakPanel - Database configuration""" from pathlib import Path -from sqlalchemy.engine.url import URL, make_url +from sqlalchemy.engine.url import make_url from sqlalchemy.ext.asyncio import AsyncSession, async_sessionmaker, create_async_engine from sqlalchemy.orm import DeclarativeBase @@ -23,15 +23,21 @@ def _resolve_database_url(raw_url: str) -> str: else: path = path.resolve() path.parent.mkdir(parents=True, exist_ok=True) - return str(URL.create(drivername=url.drivername, database=str(path))) + # POSIX path for SQLite URL (backslashes break aiosqlite on unexpected setups) + posix = path.as_posix() + return str(url.set(database=posix)) settings = get_settings() DATABASE_URL = _resolve_database_url(settings.database_url) +_engine_kw = {"echo": settings.debug} +if make_url(DATABASE_URL).drivername.startswith("sqlite"): + _engine_kw["connect_args"] = {"timeout": 30} + engine = create_async_engine( DATABASE_URL, - echo=settings.debug, + **_engine_kw, ) AsyncSessionLocal = async_sessionmaker( diff --git a/YakPanel-server/install.sh b/YakPanel-server/install.sh index 6c3e3beb..c6e50063 100644 --- a/YakPanel-server/install.sh +++ b/YakPanel-server/install.sh @@ -9,7 +9,7 @@ # sudo -E bash install.sh # # Environment (optional): -# REPO_URL Git URL (default: https://source.yakpanel.com/admin/yakpanel-core) +# REPO_URL Git URL (default: public GitHub; set to source.yakpanel.com if anonymous clone works) # YAKPANEL_BRANCH Branch/tag for shallow clone (default: default branch) # GIT_REF Alias for YAKPANEL_BRANCH # INSTALL_PATH Install dir (default: /www/server/YakPanel-server) @@ -202,6 +202,7 @@ if [ -n "${YAKPANEL_SOURCE_DIR:-}" ]; then else TMP_DIR="$(mktemp -d)" trap 'rm -rf "$TMP_DIR"' EXIT + export GIT_TERMINAL_PROMPT=0 CLONE_ARGS=(git clone --depth 1) if [ -n "$YAKPANEL_BRANCH" ]; then CLONE_ARGS+=(--branch "$YAKPANEL_BRANCH") @@ -209,7 +210,9 @@ else CLONE_ARGS+=("$REPO_URL" "$TMP_DIR/repo") if ! "${CLONE_ARGS[@]}"; then echo "Git clone failed. Check REPO_URL=$REPO_URL, DNS, and outbound HTTPS." - echo "Try public fallback: sudo -E env REPO_URL=https://github.com/YakPanel/YakPanel.git bash install.sh" + echo "If using source.yakpanel.com: enable anonymous Git read, or use a token URL, e.g." + echo " REPO_URL=https://USER:TOKEN@source.yakpanel.com/admin/yakpanel-core" + echo "Public tree: REPO_URL=https://github.com/YakPanel/YakPanel.git" exit 1 fi SRC_DIR="$(find_yakpanel_root_in_tree "$TMP_DIR/repo")"