new era
This commit is contained in:
1 parent
e30f89697b
commit
3e24d4a7bb
26 files changed
+4224
-4
No files matched your search
Executable
+34
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env bash
|
||||
# Native macOS control process + Apple Linux containers for local server testing.
|
||||
set -euo pipefail
|
||||
project_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
local_dir="$project_dir/data/apple-native"
|
||||
command -v container >/dev/null
|
||||
container system status >/dev/null
|
||||
mkdir -p "$local_dir/project"
|
||||
if [[ ! -f "$local_dir/panel.env" ]]; then
|
||||
python3 - "$local_dir/panel.env" <<'PY'
|
||||
import os, secrets, sys
|
||||
fd=os.open(sys.argv[1],os.O_WRONLY|os.O_CREAT|os.O_EXCL,0o600)
|
||||
with os.fdopen(fd,'w') as f:
|
||||
for key in ('PANEL_SESSION_SECRET','PANEL_ADMIN_PASSWORD','RCON_PASSWORD'):
|
||||
f.write(key+'='+secrets.token_hex(24)+'\n')
|
||||
PY
|
||||
fi
|
||||
set -a
|
||||
source "$local_dir/panel.env"
|
||||
set +a
|
||||
export CONTAINER_RUNTIME=apple
|
||||
export APPLE_CONTAINER_CLI="$(command -v container)"
|
||||
export APP_DATA_DIR="$local_dir/dashboard"
|
||||
export MC_DATA_DIR="$local_dir/mc"
|
||||
export BACKUPS_DIR="$local_dir/backups"
|
||||
export PROJECT_DIR="$local_dir/project"
|
||||
export RESTORE_HELPER="$project_dir/dashboard/scripts/restore_data.py"
|
||||
export RESTORE_WORK_DIR="$local_dir/recovery"
|
||||
export NEXT_TELEMETRY_DISABLED=1
|
||||
export PORT="${CRAFTDECK_LOCAL_PORT:-8081}"
|
||||
echo "Native Apple runtime panel: http://localhost:$PORT/network"
|
||||
echo "Login: admin; password is PANEL_ADMIN_PASSWORD in $local_dir/panel.env"
|
||||
cd "$project_dir/dashboard"
|
||||
exec npm run dev -- --hostname 127.0.0.1 --port "$PORT"
|
||||
Executable
+36
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build and run the ARM64 panel using Apple's container CLI, without Docker Desktop.
|
||||
# This is a local UI/API preview; Apple container does not expose a Docker Engine API.
|
||||
set -euo pipefail
|
||||
project_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
preview_dir="$project_dir/data/apple-preview"
|
||||
command -v container >/dev/null || { echo "Install Apple's container CLI first." >&2; exit 1; }
|
||||
container system status >/dev/null
|
||||
mkdir -p "$preview_dir"
|
||||
if [[ ! -f "$preview_dir/preview.env" ]]; then
|
||||
python3 - "$preview_dir/preview.env" <<'PY'
|
||||
import os, secrets, sys
|
||||
fd = os.open(sys.argv[1], os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0o600)
|
||||
with os.fdopen(fd, 'w') as f:
|
||||
f.write('PANEL_SESSION_SECRET=' + secrets.token_hex(32) + '\n')
|
||||
f.write('PANEL_ADMIN_PASSWORD=' + secrets.token_urlsafe(20) + '\n')
|
||||
f.write('APP_DATA_DIR=/preview/dashboard\nMC_DATA_DIR=/preview/mc\nBACKUPS_DIR=/preview/backups\nPROJECT_DIR=/preview/project\n')
|
||||
PY
|
||||
fi
|
||||
case "${1:-start}" in
|
||||
build) container build --platform linux/arm64 --cpus 4 --memory 4G -t craftdeck:network-local "$project_dir/dashboard" ;;
|
||||
start)
|
||||
if container inspect craftdeck-preview >/dev/null 2>&1; then
|
||||
container start craftdeck-preview
|
||||
else
|
||||
container run -d --name craftdeck-preview --cpus 2 --memory 1G \
|
||||
-p 127.0.0.1:8080:8080 --env-file "$preview_dir/preview.env" \
|
||||
-v "$preview_dir:/preview" craftdeck:network-local
|
||||
fi
|
||||
echo "Panel: http://localhost:8080/network"
|
||||
echo "Login: admin; password is PANEL_ADMIN_PASSWORD in $preview_dir/preview.env"
|
||||
echo "Docker orchestration requires the regular Docker deployment; this is an Apple-container UI/API preview."
|
||||
;;
|
||||
stop) container stop craftdeck-preview ;;
|
||||
*) echo "Usage: $0 {build|start|stop}" >&2; exit 1 ;;
|
||||
esac
|
||||
Reference in new issue
Block a user