Initial YakPanel commit
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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")"
|
||||
|
||||
Reference in New Issue
Block a user