Compare commits
96 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c0f9f979c7 | |||
| 6e5743c837 | |||
| 829f7e47f1 | |||
| a36af5c3d5 | |||
| 3c99ee5f83 | |||
| 2faa416895 | |||
| acbf448c6f | |||
| 5c48ae4156 | |||
| 3108408133 | |||
| 6defdb4431 | |||
| f63be883ce | |||
| 87844bbb8e | |||
| 02b7cda2be | |||
| 3b8f95e8e1 | |||
| ee774e3f41 | |||
| 6d93dfa459 | |||
| ac394cfafc | |||
| 97e9f232fa | |||
| 3dcb6a38e5 | |||
| ca33970e9a | |||
| cd34b98a25 | |||
| a089e5bedb | |||
| 9786ff62f0 | |||
| 4a5abc4a0a | |||
| 893a532758 | |||
| 7ea286c0a9 | |||
| f94f47e313 | |||
| b1a46f8757 | |||
| 56c71226e5 | |||
| f53109a01e | |||
| bcb2473cc5 | |||
| 689dcf295b | |||
| c1e14e9fc7 | |||
| d5fd57e2c3 | |||
| 079e6a64a9 | |||
| a04cf053db | |||
| ec0e377ccb | |||
| 3b3d0433cb | |||
| 5f876449ca | |||
| 8e781c7f9d | |||
| a3eefbe92c | |||
| 41679427c6 | |||
| c420a30341 | |||
| fe109f0953 | |||
| 012dce63b1 | |||
| 54780482c7 | |||
| 7ab0fb3c1f | |||
| 713fda2a86 | |||
| ec32c19300 | |||
| 7d1d91157c | |||
| b69c96c240 | |||
| 9ee8851d03 | |||
| 7f6031f31a | |||
| 6f1b8469e0 | |||
| cd06c74cc3 | |||
| d3acc720ca | |||
| 1b6de75097 | |||
| 497f8f59a7 | |||
| 0c7d65e4ad | |||
| 3f2cd074ce | |||
| 59ed7233bd | |||
| 01e3ba16c4 | |||
| f5c1d5fcda | |||
| 45b0971f2f | |||
| 178f440d7e | |||
| 7fff15a90c | |||
| 69e23f667e | |||
| a2bf4df7c2 | |||
| 9e0a0b5a89 | |||
| 3a227bd838 | |||
| f5a7fccfc2 | |||
| a30d2029a5 | |||
| 88727dd47d | |||
| 9a5ed2220e | |||
| decd39e7c4 | |||
| ad2e228208 | |||
| cf06019d79 | |||
| cf44b0047d | |||
| 260b5364e6 | |||
| 51c1962042 | |||
| d3b78054ad | |||
| d2ae35f0ce | |||
| a605477663 | |||
| ba98086548 | |||
| 0b3c22556b | |||
| 069e6e6c8f | |||
| 10598520d8 | |||
| 075b7946b1 | |||
| f47fca3304 | |||
| 575e010a6b | |||
| 60a5dc4663 | |||
| 36d80b1e27 | |||
| 465cf0ee72 | |||
| bd5cd5c0cb | |||
| b622565e34 | |||
| 56376121ab |
@@ -1,114 +0,0 @@
|
|||||||
name: CI
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
check:
|
|
||||||
name: Type Check & Lint
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
container:
|
|
||||||
image: code.foss.global/host.today/ht-docker-node:latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set up Deno
|
|
||||||
uses: denoland/setup-deno@v1
|
|
||||||
with:
|
|
||||||
deno-version: v2.x
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: deno install --entrypoint mod.ts
|
|
||||||
|
|
||||||
- name: Check TypeScript types
|
|
||||||
run: deno check mod.ts
|
|
||||||
|
|
||||||
- name: Lint code
|
|
||||||
run: deno lint
|
|
||||||
continue-on-error: true
|
|
||||||
|
|
||||||
- name: Format check
|
|
||||||
run: deno fmt --check
|
|
||||||
continue-on-error: true
|
|
||||||
|
|
||||||
build:
|
|
||||||
name: Build Test (Current Platform)
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
container:
|
|
||||||
image: code.foss.global/host.today/ht-docker-node:latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set up Deno
|
|
||||||
uses: denoland/setup-deno@v1
|
|
||||||
with:
|
|
||||||
deno-version: v2.x
|
|
||||||
|
|
||||||
- name: Set up Node.js
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: '22'
|
|
||||||
|
|
||||||
- name: Enable corepack
|
|
||||||
run: corepack enable
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: pnpm install --ignore-scripts
|
|
||||||
|
|
||||||
- name: Compile for current platform
|
|
||||||
run: |
|
|
||||||
echo "Testing compilation for Linux x86_64..."
|
|
||||||
npx tsdeno compile --allow-all --no-check \
|
|
||||||
--output onebox-test \
|
|
||||||
--target x86_64-unknown-linux-gnu mod.ts
|
|
||||||
|
|
||||||
- name: Test binary execution
|
|
||||||
run: |
|
|
||||||
chmod +x onebox-test
|
|
||||||
./onebox-test --version
|
|
||||||
./onebox-test --help
|
|
||||||
|
|
||||||
build-all:
|
|
||||||
name: Build All Platforms
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
container:
|
|
||||||
image: code.foss.global/host.today/ht-docker-node:latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set up Deno
|
|
||||||
uses: denoland/setup-deno@v1
|
|
||||||
with:
|
|
||||||
deno-version: v2.x
|
|
||||||
|
|
||||||
- name: Set up Node.js
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: '22'
|
|
||||||
|
|
||||||
- name: Enable corepack
|
|
||||||
run: corepack enable
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: pnpm install --ignore-scripts
|
|
||||||
|
|
||||||
- name: Compile all platform binaries
|
|
||||||
run: mkdir -p dist/binaries && npx tsdeno compile
|
|
||||||
|
|
||||||
- name: Upload all binaries as artifact
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: onebox-binaries.zip
|
|
||||||
path: dist/binaries/*
|
|
||||||
retention-days: 30
|
|
||||||
@@ -1,131 +0,0 @@
|
|||||||
name: Publish to npm
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- 'v*'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
npm-publish:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
container:
|
|
||||||
image: code.foss.global/host.today/ht-docker-node:latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set up Deno
|
|
||||||
uses: denoland/setup-deno@v1
|
|
||||||
with:
|
|
||||||
deno-version: v2.x
|
|
||||||
|
|
||||||
- name: Setup Node.js for npm publishing
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: '18.x'
|
|
||||||
registry-url: 'https://registry.npmjs.org/'
|
|
||||||
|
|
||||||
- name: Get version from tag
|
|
||||||
id: version
|
|
||||||
run: |
|
|
||||||
VERSION=${GITHUB_REF#refs/tags/}
|
|
||||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
||||||
echo "version_number=${VERSION#v}" >> $GITHUB_OUTPUT
|
|
||||||
echo "Publishing version: $VERSION"
|
|
||||||
|
|
||||||
- name: Verify deno.json version matches tag
|
|
||||||
run: |
|
|
||||||
DENO_VERSION=$(grep -o '"version": "[^"]*"' deno.json | cut -d'"' -f4)
|
|
||||||
TAG_VERSION="${{ steps.version.outputs.version_number }}"
|
|
||||||
echo "deno.json version: $DENO_VERSION"
|
|
||||||
echo "Tag version: $TAG_VERSION"
|
|
||||||
if [ "$DENO_VERSION" != "$TAG_VERSION" ]; then
|
|
||||||
echo "ERROR: Version mismatch!"
|
|
||||||
echo "deno.json has version $DENO_VERSION but tag is $TAG_VERSION"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Compile binaries for npm package
|
|
||||||
run: |
|
|
||||||
echo "Compiling binaries for npm package..."
|
|
||||||
deno task compile
|
|
||||||
echo ""
|
|
||||||
echo "Binary sizes:"
|
|
||||||
ls -lh dist/binaries/
|
|
||||||
|
|
||||||
- name: Generate SHA256 checksums
|
|
||||||
run: |
|
|
||||||
cd dist/binaries
|
|
||||||
sha256sum * > SHA256SUMS
|
|
||||||
cat SHA256SUMS
|
|
||||||
cd ../..
|
|
||||||
|
|
||||||
- name: Sync package.json version
|
|
||||||
run: |
|
|
||||||
VERSION="${{ steps.version.outputs.version_number }}"
|
|
||||||
echo "Syncing package.json to version ${VERSION}..."
|
|
||||||
npm version ${VERSION} --no-git-tag-version --allow-same-version
|
|
||||||
echo "package.json version: $(grep '"version"' package.json | head -1)"
|
|
||||||
|
|
||||||
- name: Create npm package
|
|
||||||
run: |
|
|
||||||
echo "Creating npm package..."
|
|
||||||
npm pack
|
|
||||||
echo ""
|
|
||||||
echo "Package created:"
|
|
||||||
ls -lh *.tgz
|
|
||||||
|
|
||||||
- name: Test local installation
|
|
||||||
run: |
|
|
||||||
echo "Testing local package installation..."
|
|
||||||
PACKAGE_FILE=$(ls *.tgz)
|
|
||||||
npm install -g ${PACKAGE_FILE}
|
|
||||||
echo ""
|
|
||||||
echo "Testing onebox command:"
|
|
||||||
onebox --version || echo "Note: Binary execution may fail in CI environment"
|
|
||||||
echo ""
|
|
||||||
echo "Checking installed files:"
|
|
||||||
npm ls -g @serve.zone/onebox || true
|
|
||||||
|
|
||||||
- name: Publish to npm
|
|
||||||
env:
|
|
||||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
||||||
run: |
|
|
||||||
echo "Publishing to npm registry..."
|
|
||||||
npm publish --access public
|
|
||||||
echo ""
|
|
||||||
echo "Successfully published @serve.zone/onebox to npm!"
|
|
||||||
echo ""
|
|
||||||
echo "Package info:"
|
|
||||||
npm view @serve.zone/onebox
|
|
||||||
|
|
||||||
- name: Verify npm package
|
|
||||||
run: |
|
|
||||||
echo "Waiting for npm propagation..."
|
|
||||||
sleep 30
|
|
||||||
echo ""
|
|
||||||
echo "Verifying published package..."
|
|
||||||
npm view @serve.zone/onebox
|
|
||||||
echo ""
|
|
||||||
echo "Testing installation from npm:"
|
|
||||||
npm install -g @serve.zone/onebox
|
|
||||||
echo ""
|
|
||||||
echo "Package installed successfully!"
|
|
||||||
which onebox || echo "Binary location check skipped"
|
|
||||||
|
|
||||||
- name: Publish Summary
|
|
||||||
run: |
|
|
||||||
echo "================================================"
|
|
||||||
echo " npm Publish Complete!"
|
|
||||||
echo "================================================"
|
|
||||||
echo ""
|
|
||||||
echo "Package: @serve.zone/onebox"
|
|
||||||
echo "Version: ${{ steps.version.outputs.version }}"
|
|
||||||
echo ""
|
|
||||||
echo "Installation:"
|
|
||||||
echo " npm install -g @serve.zone/onebox"
|
|
||||||
echo ""
|
|
||||||
echo "Registry:"
|
|
||||||
echo " https://www.npmjs.com/package/@serve.zone/onebox"
|
|
||||||
echo ""
|
|
||||||
268
changelog.md
268
changelog.md
@@ -1,5 +1,273 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2026-03-18 - 1.22.2 - fix(web-ui)
|
||||||
|
stabilize app store service creation flow and add Ghost sqlite defaults
|
||||||
|
|
||||||
|
- Defers App Store navigation to the services view to avoid destroying the current view during the deploy event handler.
|
||||||
|
- Processes pending app templates after services view updates so the create flow opens reliably.
|
||||||
|
- Adds default Ghost environment variables for sqlite3 and the database file path in the App Store template.
|
||||||
|
- Removes obsolete Gitea CI and npm publish workflow definitions.
|
||||||
|
|
||||||
|
## 2026-03-18 - 1.22.1 - fix(repo)
|
||||||
|
no changes to commit
|
||||||
|
|
||||||
|
|
||||||
|
## 2026-03-18 - 1.22.0 - feat(web-appstore)
|
||||||
|
add an App Store view for quick service deployment from curated templates
|
||||||
|
|
||||||
|
- adds a new App Store tab to the web UI with curated Docker app templates
|
||||||
|
- passes selected app templates through UI state into the services view for quick deployment
|
||||||
|
- supports quick deploy creation with prefilled image, port, environment variables, and optional platform service flags
|
||||||
|
- updates @serve.zone/catalog to ^2.8.0 to support the new app store view
|
||||||
|
|
||||||
|
## 2026-03-18 - 1.21.0 - feat(opsserver)
|
||||||
|
add container workspace API and backend execution environment for services
|
||||||
|
|
||||||
|
- introduces typed workspace handlers for reading, writing, listing, creating, removing, and executing commands inside service containers
|
||||||
|
- adds frontend backend-execution environment integration so the service view can open a workspace against a selected service
|
||||||
|
- extends Docker exec lookup to resolve Swarm service container IDs when a direct container ID is unavailable
|
||||||
|
|
||||||
|
## 2026-03-17 - 1.20.0 - feat(ops-dashboard)
|
||||||
|
stream user service logs to the ops dashboard and resolve service containers for Docker log streaming
|
||||||
|
|
||||||
|
- add typed socket support for pushing live user service log entries to the web app
|
||||||
|
- extend platform log streaming to include running user services with separate dashboard handlers
|
||||||
|
- fall back from direct container lookup to service-to-container resolution when streaming Docker logs
|
||||||
|
- update log parsing to preserve timestamps and infer log levels for service log entries
|
||||||
|
- bump @serve.zone/catalog to ^2.7.0
|
||||||
|
|
||||||
|
## 2026-03-17 - 1.19.12 - fix(repo)
|
||||||
|
no changes to commit
|
||||||
|
|
||||||
|
|
||||||
|
## 2026-03-17 - 1.19.11 - fix(repo)
|
||||||
|
no changes to commit
|
||||||
|
|
||||||
|
|
||||||
|
## 2026-03-17 - 1.19.10 - fix(repo)
|
||||||
|
no changes to commit
|
||||||
|
|
||||||
|
|
||||||
|
## 2026-03-17 - 1.19.9 - fix(repo)
|
||||||
|
no changes to commit
|
||||||
|
|
||||||
|
|
||||||
|
## 2026-03-17 - 1.19.8 - fix(repo)
|
||||||
|
no changes to commit
|
||||||
|
|
||||||
|
|
||||||
|
## 2026-03-17 - 1.19.7 - fix(repo)
|
||||||
|
no changes to commit
|
||||||
|
|
||||||
|
|
||||||
|
## 2026-03-17 - 1.19.6 - fix(repository)
|
||||||
|
no changes to commit
|
||||||
|
|
||||||
|
|
||||||
|
## 2026-03-17 - 1.19.5 - fix(repo)
|
||||||
|
no changes to commit
|
||||||
|
|
||||||
|
|
||||||
|
## 2026-03-17 - 1.19.4 - fix(repository)
|
||||||
|
no changes to commit
|
||||||
|
|
||||||
|
|
||||||
|
## 2026-03-16 - 1.19.3 - fix(repo)
|
||||||
|
no changes to commit
|
||||||
|
|
||||||
|
|
||||||
|
## 2026-03-16 - 1.19.2 - fix(docs)
|
||||||
|
remove outdated UI screenshot assets from project documentation
|
||||||
|
|
||||||
|
- Deletes multiple PNG screenshots that documented previous dashboard, service form, and hello-world states.
|
||||||
|
- Reduces repository clutter by removing obsolete image assets no longer needed in docs.
|
||||||
|
|
||||||
|
## 2026-03-16 - 1.19.1 - fix(dashboard)
|
||||||
|
add updated dashboard screenshots for refresh and resource usage states
|
||||||
|
|
||||||
|
- Adds new dashboard screenshots covering post-refresh, resource usage, and populated data views.
|
||||||
|
- Updates visual assets to document current dashboard behavior and UI states.
|
||||||
|
|
||||||
|
## 2026-03-16 - 1.19.1 - fix(dashboard)
|
||||||
|
add aggregated resource usage stats to the dashboard
|
||||||
|
|
||||||
|
- Aggregate CPU, memory, and network stats across all running user and platform service containers in getSystemStatus
|
||||||
|
- Extend ISystemStatus.docker interface with cpuUsage, memoryUsage, memoryTotal, networkIn, networkOut fields
|
||||||
|
- Fix getContainerStats to properly handle Swarm service IDs by catching exceptions and falling back to label-based container lookup
|
||||||
|
- Wire dashboard resource usage card to display real aggregated data from the backend
|
||||||
|
|
||||||
|
## 2026-03-16 - 1.19.0 - feat(opsserver,web)
|
||||||
|
add real-time platform service log streaming to the dashboard
|
||||||
|
|
||||||
|
- stream running platform service container logs from the ops server to connected dashboard clients via TypedSocket
|
||||||
|
- parse Docker log timestamps and levels for both pushed and fetched platform service log entries
|
||||||
|
- enhance the platform service detail view with mapped statuses and predefined host, port, version, and config metadata
|
||||||
|
- add the typedsocket dependency and update the catalog package for dashboard support
|
||||||
|
|
||||||
|
## 2026-03-16 - 1.18.5 - fix(platform-services)
|
||||||
|
fix platform service detail view navigation and log display
|
||||||
|
|
||||||
|
- Add back button to platform service detail view for returning to services list
|
||||||
|
- Fix DOM lifecycle when switching between platform services (destroy and recreate dees-chart-log)
|
||||||
|
- Fix timestamp format for log entries to use ISO 8601 for dees-chart-log compatibility
|
||||||
|
- Clear previous stats/logs state before fetching new platform service data
|
||||||
|
|
||||||
|
## 2026-03-16 - 1.18.4 - fix(repo)
|
||||||
|
no changes to commit
|
||||||
|
|
||||||
|
|
||||||
|
## 2026-03-16 - 1.18.3 - fix(deps)
|
||||||
|
bump @serve.zone/catalog to ^2.6.1
|
||||||
|
|
||||||
|
- Updates the @serve.zone/catalog runtime dependency from ^2.6.0 to ^2.6.1.
|
||||||
|
|
||||||
|
## 2026-03-16 - 1.18.2 - fix(repo)
|
||||||
|
no changes to commit
|
||||||
|
|
||||||
|
|
||||||
|
## 2026-03-16 - 1.18.1 - fix(repo)
|
||||||
|
no changes to commit
|
||||||
|
|
||||||
|
|
||||||
|
## 2026-03-16 - 1.18.0 - feat(platform-services)
|
||||||
|
add platform service log retrieval and display in the services UI
|
||||||
|
|
||||||
|
- add typed request support in the ops server to fetch Docker logs for platform service containers
|
||||||
|
- store fetched platform service logs in web app state and load them when opening platform service details
|
||||||
|
- render platform service logs in the services detail view and add sidebar icons for main navigation tabs
|
||||||
|
|
||||||
|
## 2026-03-16 - 1.17.4 - fix(docs)
|
||||||
|
add hello world running screenshot for documentation
|
||||||
|
|
||||||
|
- Adds a new PNG asset showing the application in a running hello world state.
|
||||||
|
- Supports project documentation or README usage without changing runtime behavior.
|
||||||
|
|
||||||
|
## 2026-03-16 - 1.17.3 - fix(mongodb)
|
||||||
|
downgrade the MongoDB service image to 4.4 and use the legacy mongo shell for container operations
|
||||||
|
|
||||||
|
- changes the default MongoDB container image from mongo:7 to mongo:4.4
|
||||||
|
- replaces mongosh with mongo for health checks, provisioning, and deprovisioning inside the container
|
||||||
|
|
||||||
|
## 2026-03-16 - 1.17.2 - fix(platform-services)
|
||||||
|
provision ClickHouse, MinIO, and MongoDB resources via docker exec instead of host port access
|
||||||
|
|
||||||
|
- switch ClickHouse provisioning and teardown to in-container client commands to avoid host port mapping issues
|
||||||
|
- replace MinIO host-side S3 API calls with in-container mc commands for bucket creation and removal
|
||||||
|
- run MongoDB provisioning and deprovisioning through mongosh inside the container and improve docker exec failure reporting
|
||||||
|
|
||||||
|
## 2026-03-16 - 1.17.1 - fix(repo)
|
||||||
|
no changes to commit
|
||||||
|
|
||||||
|
|
||||||
|
## 2026-03-16 - 1.17.0 - feat(web/services)
|
||||||
|
add deploy service action to the services view
|
||||||
|
|
||||||
|
- Adds a prominent "Deploy Service" button to the services page header.
|
||||||
|
- Routes users into the create service view directly from the services listing.
|
||||||
|
- Includes a new service creation form screenshot asset for the updated interface.
|
||||||
|
|
||||||
|
## 2026-03-16 - 1.16.0 - feat(services)
|
||||||
|
add platform service navigation and stats in the services UI
|
||||||
|
|
||||||
|
- add platform service stats state and fetch action
|
||||||
|
- show platform services in the services list and open a platform detail view
|
||||||
|
- enable dashboard clicks to jump directly to the selected platform service
|
||||||
|
- refresh platform service stats after start and restart actions
|
||||||
|
- bump @serve.zone/catalog to ^2.6.0 for the new platform service UI components
|
||||||
|
|
||||||
|
## 2026-03-16 - 1.15.3 - fix(install)
|
||||||
|
refresh systemd service configuration before restarting previously running installations
|
||||||
|
|
||||||
|
- Re-enable the systemd service during updates so unit file changes are applied before restart
|
||||||
|
- Add a log message indicating the service configuration is being refreshed
|
||||||
|
|
||||||
|
## 2026-03-16 - 1.15.2 - fix(systemd)
|
||||||
|
set HOME and DENO_DIR for the systemd service environment
|
||||||
|
|
||||||
|
- Adds HOME=/root to the generated onebox systemd unit
|
||||||
|
- Adds DENO_DIR=/root/.cache/deno so Deno cache paths are available when running as a service
|
||||||
|
|
||||||
|
## 2026-03-16 - 1.15.1 - fix(systemd)
|
||||||
|
move Docker installation and swarm initialization to systemd enable flow
|
||||||
|
|
||||||
|
- Ensures Docker is installed before writing and enabling the systemd unit that depends on docker.service.
|
||||||
|
- Removes Docker auto-installation from Onebox initialization so setup happens in the service management path.
|
||||||
|
|
||||||
|
## 2026-03-16 - 1.15.0 - feat(systemd)
|
||||||
|
replace smartdaemon-based service management with native systemd commands
|
||||||
|
|
||||||
|
- adds a dedicated OneboxSystemd manager for enabling, disabling, starting, stopping, checking status, and following logs
|
||||||
|
- introduces a new `onebox systemd` CLI command set and updates install and help output to use it
|
||||||
|
- removes the smartdaemon dependency and related service management code
|
||||||
|
|
||||||
|
## 2026-03-16 - 1.14.10 - fix(services)
|
||||||
|
stop auto-update monitoring during shutdown
|
||||||
|
|
||||||
|
- Track the auto-update polling interval in the services manager
|
||||||
|
- Clear the auto-update interval when Onebox shuts down to prevent background checks after shutdown
|
||||||
|
|
||||||
|
## 2026-03-16 - 1.14.9 - fix(repo)
|
||||||
|
no changes to commit
|
||||||
|
|
||||||
|
|
||||||
|
## 2026-03-16 - 1.14.8 - fix(repo)
|
||||||
|
no changes to commit
|
||||||
|
|
||||||
|
|
||||||
|
## 2026-03-16 - 1.14.7 - fix(repo)
|
||||||
|
no changes to commit
|
||||||
|
|
||||||
|
|
||||||
|
## 2026-03-16 - 1.14.6 - fix(project)
|
||||||
|
no changes to commit
|
||||||
|
|
||||||
|
|
||||||
|
## 2026-03-16 - 1.14.5 - fix(onebox)
|
||||||
|
move Docker auto-install and swarm initialization into Onebox startup flow
|
||||||
|
|
||||||
|
- removes Docker setup from daemon service installation
|
||||||
|
- ensures Docker is installed before Docker initialization during Onebox startup
|
||||||
|
- preserves automatic Docker Swarm initialization on fresh servers
|
||||||
|
|
||||||
|
## 2026-03-16 - 1.14.4 - fix(repo)
|
||||||
|
no changes to commit
|
||||||
|
|
||||||
|
|
||||||
|
## 2026-03-16 - 1.14.3 - fix(repo)
|
||||||
|
no changes to commit
|
||||||
|
|
||||||
|
|
||||||
|
## 2026-03-16 - 1.14.2 - fix(repo)
|
||||||
|
no changes to commit
|
||||||
|
|
||||||
|
|
||||||
|
## 2026-03-16 - 1.14.1 - fix(repo)
|
||||||
|
no changes to commit
|
||||||
|
|
||||||
|
|
||||||
|
## 2026-03-16 - 1.14.0 - feat(daemon)
|
||||||
|
auto-install Docker and initialize Swarm during daemon service setup
|
||||||
|
|
||||||
|
- Adds a Docker availability check before installing the Onebox daemon service
|
||||||
|
- Installs Docker automatically when it is missing using the standard installation script
|
||||||
|
- Attempts to initialize Docker Swarm after installation and handles already-initialized environments gracefully
|
||||||
|
|
||||||
|
## 2026-03-16 - 1.13.17 - fix(ci)
|
||||||
|
remove forced container image pulling from Gitea workflow jobs
|
||||||
|
|
||||||
|
- Drops the `--pull always` container option from CI, npm publish, and release workflows.
|
||||||
|
- Keeps workflow container images unchanged while avoiding forced pulls on every job run.
|
||||||
|
|
||||||
|
## 2026-03-16 - 1.13.16 - fix(ci)
|
||||||
|
refresh workflow container images on every run and bump @apiclient.xyz/docker to ^5.1.1
|
||||||
|
|
||||||
|
- add --pull always to CI, release, and npm publish workflow containers to avoid stale images
|
||||||
|
- update @apiclient.xyz/docker from ^5.1.0 to ^5.1.1 in deno.json
|
||||||
|
|
||||||
|
## 2026-03-15 - 1.13.15 - fix(repo)
|
||||||
|
no changes to commit
|
||||||
|
|
||||||
|
|
||||||
## 2026-03-15 - 1.13.14 - fix(repo)
|
## 2026-03-15 - 1.13.14 - fix(repo)
|
||||||
no changes to commit
|
no changes to commit
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@serve.zone/onebox",
|
"name": "@serve.zone/onebox",
|
||||||
"version": "1.13.14",
|
"version": "1.22.2",
|
||||||
"exports": "./mod.ts",
|
"exports": "./mod.ts",
|
||||||
"tasks": {
|
"tasks": {
|
||||||
"test": "deno test --allow-all test/",
|
"test": "deno test --allow-all test/",
|
||||||
@@ -15,8 +15,7 @@
|
|||||||
"@std/assert": "jsr:@std/assert@^1.0.15",
|
"@std/assert": "jsr:@std/assert@^1.0.15",
|
||||||
"@std/encoding": "jsr:@std/encoding@^1.0.10",
|
"@std/encoding": "jsr:@std/encoding@^1.0.10",
|
||||||
"@db/sqlite": "jsr:@db/sqlite@0.12.0",
|
"@db/sqlite": "jsr:@db/sqlite@0.12.0",
|
||||||
"@push.rocks/smartdaemon": "npm:@push.rocks/smartdaemon@^2.1.0",
|
"@apiclient.xyz/docker": "npm:@apiclient.xyz/docker@^5.1.1",
|
||||||
"@apiclient.xyz/docker": "npm:@apiclient.xyz/docker@^5.1.0",
|
|
||||||
"@apiclient.xyz/cloudflare": "npm:@apiclient.xyz/cloudflare@6.4.3",
|
"@apiclient.xyz/cloudflare": "npm:@apiclient.xyz/cloudflare@6.4.3",
|
||||||
"@push.rocks/smartacme": "npm:@push.rocks/smartacme@^8.0.0",
|
"@push.rocks/smartacme": "npm:@push.rocks/smartacme@^8.0.0",
|
||||||
"@push.rocks/smartregistry": "npm:@push.rocks/smartregistry@^2.2.0",
|
"@push.rocks/smartregistry": "npm:@push.rocks/smartregistry@^2.2.0",
|
||||||
@@ -26,7 +25,8 @@
|
|||||||
"@api.global/typedrequest": "npm:@api.global/typedrequest@^3.2.6",
|
"@api.global/typedrequest": "npm:@api.global/typedrequest@^3.2.6",
|
||||||
"@api.global/typedserver": "npm:@api.global/typedserver@^8.3.1",
|
"@api.global/typedserver": "npm:@api.global/typedserver@^8.3.1",
|
||||||
"@push.rocks/smartguard": "npm:@push.rocks/smartguard@^3.1.0",
|
"@push.rocks/smartguard": "npm:@push.rocks/smartguard@^3.1.0",
|
||||||
"@push.rocks/smartjwt": "npm:@push.rocks/smartjwt@^2.2.1"
|
"@push.rocks/smartjwt": "npm:@push.rocks/smartjwt@^2.2.1",
|
||||||
|
"@api.global/typedsocket": "npm:@api.global/typedsocket@^4.1.2"
|
||||||
},
|
},
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"lib": [
|
"lib": [
|
||||||
|
|||||||
16
install.sh
16
install.sh
@@ -23,7 +23,7 @@ SPECIFIED_VERSION=""
|
|||||||
INSTALL_DIR="/opt/onebox"
|
INSTALL_DIR="/opt/onebox"
|
||||||
GITEA_BASE_URL="https://code.foss.global"
|
GITEA_BASE_URL="https://code.foss.global"
|
||||||
GITEA_REPO="serve.zone/onebox"
|
GITEA_REPO="serve.zone/onebox"
|
||||||
SERVICE_NAME="smartdaemon_onebox"
|
SERVICE_NAME="onebox"
|
||||||
|
|
||||||
# Parse command line arguments
|
# Parse command line arguments
|
||||||
while [[ $# -gt 0 ]]; do
|
while [[ $# -gt 0 ]]; do
|
||||||
@@ -250,8 +250,10 @@ echo ""
|
|||||||
mkdir -p /var/lib/onebox
|
mkdir -p /var/lib/onebox
|
||||||
mkdir -p /var/www/certbot
|
mkdir -p /var/www/certbot
|
||||||
|
|
||||||
# Restart service if it was running before update
|
# Re-enable and restart service if it was previously running (refreshes unit file)
|
||||||
if [ $SERVICE_WAS_RUNNING -eq 1 ]; then
|
if [ $SERVICE_WAS_RUNNING -eq 1 ]; then
|
||||||
|
echo "Refreshing systemd service..."
|
||||||
|
onebox systemd enable
|
||||||
echo "Restarting Onebox service..."
|
echo "Restarting Onebox service..."
|
||||||
systemctl restart "$SERVICE_NAME"
|
systemctl restart "$SERVICE_NAME"
|
||||||
echo "Service restarted successfully."
|
echo "Service restarted successfully."
|
||||||
@@ -276,7 +278,7 @@ if [ -f "/var/lib/onebox/onebox.db" ]; then
|
|||||||
if [ $SERVICE_WAS_RUNNING -eq 1 ]; then
|
if [ $SERVICE_WAS_RUNNING -eq 1 ]; then
|
||||||
echo "The service has been restarted with your current settings."
|
echo "The service has been restarted with your current settings."
|
||||||
else
|
else
|
||||||
echo "Start the service with: onebox daemon start"
|
echo "Start the service with: onebox systemd start"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "Get started:"
|
echo "Get started:"
|
||||||
@@ -293,11 +295,11 @@ else
|
|||||||
echo " 2. Configure ACME email:"
|
echo " 2. Configure ACME email:"
|
||||||
echo " onebox config set acmeEmail <your@email.com>"
|
echo " onebox config set acmeEmail <your@email.com>"
|
||||||
echo ""
|
echo ""
|
||||||
echo " 3. Install daemon:"
|
echo " 3. Enable systemd service:"
|
||||||
echo " onebox daemon install"
|
echo " onebox systemd enable"
|
||||||
echo ""
|
echo ""
|
||||||
echo " 4. Start daemon:"
|
echo " 4. Start service:"
|
||||||
echo " onebox daemon start"
|
echo " onebox systemd start"
|
||||||
echo ""
|
echo ""
|
||||||
echo " 5. Deploy your first service:"
|
echo " 5. Deploy your first service:"
|
||||||
echo " onebox service add myapp --image nginx:latest --domain app.example.com"
|
echo " onebox service add myapp --image nginx:latest --domain app.example.com"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@serve.zone/onebox",
|
"name": "@serve.zone/onebox",
|
||||||
"version": "1.13.14",
|
"version": "1.22.2",
|
||||||
"description": "Self-hosted container platform with automatic SSL and DNS - a mini Heroku for single servers",
|
"description": "Self-hosted container platform with automatic SSL and DNS - a mini Heroku for single servers",
|
||||||
"main": "mod.ts",
|
"main": "mod.ts",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
@@ -55,9 +55,10 @@
|
|||||||
"packageManager": "pnpm@10.18.1+sha512.77a884a165cbba2d8d1c19e3b4880eee6d2fcabd0d879121e282196b80042351d5eb3ca0935fa599da1dc51265cc68816ad2bddd2a2de5ea9fdf92adbec7cd34",
|
"packageManager": "pnpm@10.18.1+sha512.77a884a165cbba2d8d1c19e3b4880eee6d2fcabd0d879121e282196b80042351d5eb3ca0935fa599da1dc51265cc68816ad2bddd2a2de5ea9fdf92adbec7cd34",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@api.global/typedrequest-interfaces": "^3.0.19",
|
"@api.global/typedrequest-interfaces": "^3.0.19",
|
||||||
|
"@api.global/typedsocket": "^4.1.2",
|
||||||
"@design.estate/dees-catalog": "^3.43.3",
|
"@design.estate/dees-catalog": "^3.43.3",
|
||||||
"@design.estate/dees-element": "^2.1.6",
|
"@design.estate/dees-element": "^2.1.6",
|
||||||
"@serve.zone/catalog": "^2.5.0"
|
"@serve.zone/catalog": "^2.8.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@git.zone/tsbundle": "^2.9.0",
|
"@git.zone/tsbundle": "^2.9.0",
|
||||||
|
|||||||
229
pnpm-lock.yaml
generated
229
pnpm-lock.yaml
generated
@@ -11,6 +11,9 @@ importers:
|
|||||||
'@api.global/typedrequest-interfaces':
|
'@api.global/typedrequest-interfaces':
|
||||||
specifier: ^3.0.19
|
specifier: ^3.0.19
|
||||||
version: 3.0.19
|
version: 3.0.19
|
||||||
|
'@api.global/typedsocket':
|
||||||
|
specifier: ^4.1.2
|
||||||
|
version: 4.1.2(@push.rocks/smartserve@2.0.1)
|
||||||
'@design.estate/dees-catalog':
|
'@design.estate/dees-catalog':
|
||||||
specifier: ^3.43.3
|
specifier: ^3.43.3
|
||||||
version: 3.48.5(@tiptap/pm@2.27.2)
|
version: 3.48.5(@tiptap/pm@2.27.2)
|
||||||
@@ -18,8 +21,8 @@ importers:
|
|||||||
specifier: ^2.1.6
|
specifier: ^2.1.6
|
||||||
version: 2.2.3
|
version: 2.2.3
|
||||||
'@serve.zone/catalog':
|
'@serve.zone/catalog':
|
||||||
specifier: ^2.5.0
|
specifier: ^2.8.0
|
||||||
version: 2.5.0(@tiptap/pm@2.27.2)
|
version: 2.8.0(@tiptap/pm@2.27.2)
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@git.zone/tsbundle':
|
'@git.zone/tsbundle':
|
||||||
specifier: ^2.9.0
|
specifier: ^2.9.0
|
||||||
@@ -60,8 +63,8 @@ packages:
|
|||||||
'@cfworker/json-schema@4.1.1':
|
'@cfworker/json-schema@4.1.1':
|
||||||
resolution: {integrity: sha512-gAmrUZSGtKc3AiBL71iNWxDsyUC5uMaKKGdvzYsBoTW/xi42JQHl7eKV2OYzCUqvc+D2RCcf7EXY2iCyFIk6og==}
|
resolution: {integrity: sha512-gAmrUZSGtKc3AiBL71iNWxDsyUC5uMaKKGdvzYsBoTW/xi42JQHl7eKV2OYzCUqvc+D2RCcf7EXY2iCyFIk6og==}
|
||||||
|
|
||||||
'@cloudflare/workers-types@4.20260313.1':
|
'@cloudflare/workers-types@4.20260317.1':
|
||||||
resolution: {integrity: sha512-jMEeX3RKfOSVqqXRKr/ulgglcTloeMzSH3FdzIfqJHtvc12/ELKd5Ldsg8ZHahKX/4eRxYdw3kbzb8jLXbq/jQ==}
|
resolution: {integrity: sha512-+G4eVwyCpm8Au1ex8vQBCuA9wnwqetz4tPNRoB/53qvktERWBRMQnrtvC1k584yRE3emMThtuY0gWshvSJ++PQ==}
|
||||||
|
|
||||||
'@configvault.io/interfaces@1.0.17':
|
'@configvault.io/interfaces@1.0.17':
|
||||||
resolution: {integrity: sha512-bEcCUR2VBDJsTin8HQh8Uw/mlYl2v8A3jMIaQ+MTB9Hrqd6CZL2dL7iJdWyFl/3EIX+LDxWFR+Oq7liIq7w+1Q==}
|
resolution: {integrity: sha512-bEcCUR2VBDJsTin8HQh8Uw/mlYl2v8A3jMIaQ+MTB9Hrqd6CZL2dL7iJdWyFl/3EIX+LDxWFR+Oq7liIq7w+1Q==}
|
||||||
@@ -373,74 +376,74 @@ packages:
|
|||||||
'@module-federation/webpack-bundler-runtime@0.22.0':
|
'@module-federation/webpack-bundler-runtime@0.22.0':
|
||||||
resolution: {integrity: sha512-aM8gCqXu+/4wBmJtVeMeeMN5guw3chf+2i6HajKtQv7SJfxV/f4IyNQJUeUQu9HfiAZHjqtMV5Lvq/Lvh8LdyA==}
|
resolution: {integrity: sha512-aM8gCqXu+/4wBmJtVeMeeMN5guw3chf+2i6HajKtQv7SJfxV/f4IyNQJUeUQu9HfiAZHjqtMV5Lvq/Lvh8LdyA==}
|
||||||
|
|
||||||
'@napi-rs/canvas-android-arm64@0.1.96':
|
'@napi-rs/canvas-android-arm64@0.1.97':
|
||||||
resolution: {integrity: sha512-ew1sPrN3dGdZ3L4FoohPfnjq0f9/Jk7o+wP7HkQZokcXgIUD6FIyICEWGhMYzv53j63wUcPvZeAwgewX58/egg==}
|
resolution: {integrity: sha512-V1c/WVw+NzH8vk7ZK/O8/nyBSCQimU8sfMsB/9qeSvdkGKNU7+mxy/bIF0gTgeBFmHpj30S4E9WHMSrxXGQuVQ==}
|
||||||
engines: {node: '>= 10'}
|
engines: {node: '>= 10'}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [android]
|
os: [android]
|
||||||
|
|
||||||
'@napi-rs/canvas-darwin-arm64@0.1.96':
|
'@napi-rs/canvas-darwin-arm64@0.1.97':
|
||||||
resolution: {integrity: sha512-Q/wOXZ5PzTqpdmA5eUOcegCf4Go/zz3aZ5DlzSeDpOjFmfwMKh8EzLAoweQ+mJVagcHQyzoJhaTEnrO68TNyNg==}
|
resolution: {integrity: sha512-ok+SCEF4YejcxuJ9Rm+WWunHHpf2HmiPxfz6z1a/NFQECGXtsY7A4B8XocK1LmT1D7P174MzwPF9Wy3AUAwEPw==}
|
||||||
engines: {node: '>= 10'}
|
engines: {node: '>= 10'}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [darwin]
|
os: [darwin]
|
||||||
|
|
||||||
'@napi-rs/canvas-darwin-x64@0.1.96':
|
'@napi-rs/canvas-darwin-x64@0.1.97':
|
||||||
resolution: {integrity: sha512-UrXiQz28tQEvGM1qvyptewOAfmUrrd5+wvi6Rzjj2VprZI8iZ2KIvBD2lTTG1bVF95AbeDeG7PJA0D9sLKaOFA==}
|
resolution: {integrity: sha512-PUP6e6/UGlclUvAQNnuXCcnkpdUou6VYZfQOQxExLp86epOylmiwLkqXIvpFmjoTEDmPmXrI+coL/9EFU1gKPA==}
|
||||||
engines: {node: '>= 10'}
|
engines: {node: '>= 10'}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [darwin]
|
os: [darwin]
|
||||||
|
|
||||||
'@napi-rs/canvas-linux-arm-gnueabihf@0.1.96':
|
'@napi-rs/canvas-linux-arm-gnueabihf@0.1.97':
|
||||||
resolution: {integrity: sha512-I90ODxweD8aEP6XKU/NU+biso95MwCtQ2F46dUvhec1HesFi0tq/tAJkYic/1aBSiO/1kGKmSeD1B0duOHhEHQ==}
|
resolution: {integrity: sha512-XyXH2L/cic8eTNtbrXCcvqHtMX/nEOxN18+7rMrAM2XtLYC/EB5s0wnO1FsLMWmK+04ZSLN9FBGipo7kpIkcOw==}
|
||||||
engines: {node: '>= 10'}
|
engines: {node: '>= 10'}
|
||||||
cpu: [arm]
|
cpu: [arm]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
|
||||||
'@napi-rs/canvas-linux-arm64-gnu@0.1.96':
|
'@napi-rs/canvas-linux-arm64-gnu@0.1.97':
|
||||||
resolution: {integrity: sha512-Dx/0+RFV++w3PcRy+4xNXkghhXjA5d0Mw1bs95emn5Llinp1vihMaA6WJt3oYv2LAHc36+gnrhIBsPhUyI2SGw==}
|
resolution: {integrity: sha512-Kuq/M3djq0K8ktgz6nPlK7Ne5d4uWeDxPpyKWOjWDK2RIOhHVtLtyLiJw2fuldw7Vn4mhw05EZXCEr4Q76rs9w==}
|
||||||
engines: {node: '>= 10'}
|
engines: {node: '>= 10'}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
|
||||||
'@napi-rs/canvas-linux-arm64-musl@0.1.96':
|
'@napi-rs/canvas-linux-arm64-musl@0.1.97':
|
||||||
resolution: {integrity: sha512-UvOi7fii3IE2KDfEfhh8m+LpzSRvhGK7o1eho99M2M0HTik11k3GX+2qgVx9EtujN3/bhFFS1kSO3+vPMaJ0Mg==}
|
resolution: {integrity: sha512-kKmSkQVnWeqg7qdsiXvYxKhAFuHz3tkBjW/zyQv5YKUPhotpaVhpBGv5LqCngzyuRV85SXoe+OFj+Tv0a0QXkQ==}
|
||||||
engines: {node: '>= 10'}
|
engines: {node: '>= 10'}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
|
||||||
'@napi-rs/canvas-linux-riscv64-gnu@0.1.96':
|
'@napi-rs/canvas-linux-riscv64-gnu@0.1.97':
|
||||||
resolution: {integrity: sha512-MBSukhGCQ5nRtf9NbFYWOU080yqkZU1PbuH4o1ROvB4CbPl12fchDR35tU83Wz8gWIM9JTn99lBn9DenPIv7Ig==}
|
resolution: {integrity: sha512-Jc7I3A51jnEOIAXeLsN/M/+Z28LUeakcsXs07FLq9prXc0eYOtVwsDEv913Gr+06IRo34gJJVgT0TXvmz+N2VA==}
|
||||||
engines: {node: '>= 10'}
|
engines: {node: '>= 10'}
|
||||||
cpu: [riscv64]
|
cpu: [riscv64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
|
||||||
'@napi-rs/canvas-linux-x64-gnu@0.1.96':
|
'@napi-rs/canvas-linux-x64-gnu@0.1.97':
|
||||||
resolution: {integrity: sha512-I/ccu2SstyKiV3HIeVzyBIWfrJo8cN7+MSQZPnabewWV6hfJ2nY7Df2WqOHmobBRUw84uGR6zfQHsUEio/m5Vg==}
|
resolution: {integrity: sha512-iDUBe7AilfuBSRbSa8/IGX38Mf+iCSBqoVKLSQ5XaY2JLOaqz1TVyPFEyIck7wT6mRQhQt5sN6ogfjIDfi74tg==}
|
||||||
engines: {node: '>= 10'}
|
engines: {node: '>= 10'}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
|
||||||
'@napi-rs/canvas-linux-x64-musl@0.1.96':
|
'@napi-rs/canvas-linux-x64-musl@0.1.97':
|
||||||
resolution: {integrity: sha512-H3uov7qnTl73GDT4h52lAqpJPsl1tIUyNPWJyhQ6gHakohNqqRq3uf80+NEpzcytKGEOENP1wX3yGwZxhjiWEQ==}
|
resolution: {integrity: sha512-AKLFd/v0Z5fvgqBDqhvqtAdx+fHMJ5t9JcUNKq4FIZ5WH+iegGm8HPdj00NFlCSnm83Fp3Ln8I2f7uq1aIiWaA==}
|
||||||
engines: {node: '>= 10'}
|
engines: {node: '>= 10'}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
|
||||||
'@napi-rs/canvas-win32-arm64-msvc@0.1.96':
|
'@napi-rs/canvas-win32-arm64-msvc@0.1.97':
|
||||||
resolution: {integrity: sha512-ATp6Y+djOjYtkfV/VRH7CZ8I1MEtkUQBmKUbuWw5zWEHHqfL0cEcInE4Cxgx7zkNAhEdBbnH8HMVrqNp+/gwxA==}
|
resolution: {integrity: sha512-u883Yr6A6fO7Vpsy9YE4FVCIxzzo5sO+7pIUjjoDLjS3vQaNMkVzx5bdIpEL+ob+gU88WDK4VcxYMZ6nmnoX9A==}
|
||||||
engines: {node: '>= 10'}
|
engines: {node: '>= 10'}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [win32]
|
os: [win32]
|
||||||
|
|
||||||
'@napi-rs/canvas-win32-x64-msvc@0.1.96':
|
'@napi-rs/canvas-win32-x64-msvc@0.1.97':
|
||||||
resolution: {integrity: sha512-UYGdTltVd+Z8mcIuoqGmAXXUvwH5CLf2M6mIB5B0/JmX5J041jETjqtSYl7gN+aj3k1by/SG6sS0hAwCqyK7zw==}
|
resolution: {integrity: sha512-sWtD2EE3fV0IzN+iiQUqr/Q1SwqWhs2O1FKItFlxtdDkikpEj5g7DKQpY3x55H/MAOnL8iomnlk3mcEeGiUMoQ==}
|
||||||
engines: {node: '>= 10'}
|
engines: {node: '>= 10'}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [win32]
|
os: [win32]
|
||||||
|
|
||||||
'@napi-rs/canvas@0.1.96':
|
'@napi-rs/canvas@0.1.97':
|
||||||
resolution: {integrity: sha512-6NNmNxvoJKeucVjxaaRUt3La2i5jShgiAbaY3G/72s1Vp3U06XPrAIxkAjBxpDcamEn/t+WJ4OOlGmvILo4/Ew==}
|
resolution: {integrity: sha512-8cFniXvrIEnVwuNSRCW9wirRZbHvrD3JVujdS2P5n5xiJZNZMOZcfOvJ1pb66c7jXMKHHglJEDVJGbm8XWFcXQ==}
|
||||||
engines: {node: '>= 10'}
|
engines: {node: '>= 10'}
|
||||||
|
|
||||||
'@napi-rs/wasm-runtime@1.0.7':
|
'@napi-rs/wasm-runtime@1.0.7':
|
||||||
@@ -769,60 +772,60 @@ packages:
|
|||||||
'@rolldown/pluginutils@1.0.0-beta.52':
|
'@rolldown/pluginutils@1.0.0-beta.52':
|
||||||
resolution: {integrity: sha512-/L0htLJZbaZFL1g9OHOblTxbCYIGefErJjtYOwgl9ZqNx27P3L0SDfjhhHIss32gu5NWgnxuT2a2Hnnv6QGHKA==}
|
resolution: {integrity: sha512-/L0htLJZbaZFL1g9OHOblTxbCYIGefErJjtYOwgl9ZqNx27P3L0SDfjhhHIss32gu5NWgnxuT2a2Hnnv6QGHKA==}
|
||||||
|
|
||||||
'@rspack/binding-darwin-arm64@1.7.8':
|
'@rspack/binding-darwin-arm64@1.7.9':
|
||||||
resolution: {integrity: sha512-KS6SRc+4VYRdX1cKr1j1HEuMNyEzt7onBS0rkenaiCRRYF0z4WNZNyZqRiuxgM3qZ3TISF7gdmgJQyd4ZB43ig==}
|
resolution: {integrity: sha512-64dgstte0If5czi9bA/cpOe0ryY6wC9AIQRtyJ3DlOF6Tt+y9cKkmUoGu3V+WYaYIZRT7HNk8V7kL8amVjFTYw==}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [darwin]
|
os: [darwin]
|
||||||
|
|
||||||
'@rspack/binding-darwin-x64@1.7.8':
|
'@rspack/binding-darwin-x64@1.7.9':
|
||||||
resolution: {integrity: sha512-uyXSDKLg2CtqIJrsJDlCqQH80YIPsCUiTToJ59cXAG3v4eke0Qbiv6d/+pV0h/mc0u4inAaSkr5dD18zkMIghw==}
|
resolution: {integrity: sha512-2QSLs3w4rLy4UUGVnIlkt6IlIKOzR1e0RPsq2FYQW6s3p9JrwRCtOeHohyh7EJSqF54dtfhe9UZSAwba3LqH1Q==}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [darwin]
|
os: [darwin]
|
||||||
|
|
||||||
'@rspack/binding-linux-arm64-gnu@1.7.8':
|
'@rspack/binding-linux-arm64-gnu@1.7.9':
|
||||||
resolution: {integrity: sha512-dD6gSHA18Uj0eqc1FCwwQ5IO5mIckrpYN4H4kPk9Pjau+1mxWvC4y5Lryz1Z8P/Rh1lnQ/wwGE0XL9nd80+LqQ==}
|
resolution: {integrity: sha512-qhUGI/uVfvLmKWts4QkVHGL8yfUyJkblZs+OFD5Upa2y676EOsbQgWsCwX4xGB6Tv+TOzFP0SLh/UfO8ZfdE+w==}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
|
||||||
'@rspack/binding-linux-arm64-musl@1.7.8':
|
'@rspack/binding-linux-arm64-musl@1.7.9':
|
||||||
resolution: {integrity: sha512-m+uBi9mEVGkZ02PPOAYN2BSmmvc00XGa6v9CjV8qLpolpUXQIMzDNG+i1fD5SHp8LO+XWsZJOHypMsT0MzGTGw==}
|
resolution: {integrity: sha512-VjfmR1hgO9n3L6MaE5KG+DXSrrLVqHHOkVcOtS2LMq3bjMTwbBywY7ycymcLnX5KJsol8d3ZGYep6IfSOt3lFA==}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
|
||||||
'@rspack/binding-linux-x64-gnu@1.7.8':
|
'@rspack/binding-linux-x64-gnu@1.7.9':
|
||||||
resolution: {integrity: sha512-IAPp2L3yS33MAEkcGn/I1gO+a+WExJHXz2ZlRlL2oFCUGpYi2ZQHyAcJ3o2tJqkXmdqsTiN+OjEVMd/RcLa24g==}
|
resolution: {integrity: sha512-0kldV+3WTs/VYDWzxJ7K40hCW26IHtnk8xPK3whKoo1649rgeXXa0EdsU5P7hG8Ef5SWQjHHHZ/fuHYSO3Y6HA==}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
|
||||||
'@rspack/binding-linux-x64-musl@1.7.8':
|
'@rspack/binding-linux-x64-musl@1.7.9':
|
||||||
resolution: {integrity: sha512-do/QNzb4GWdXCsipblDcroqRDR3BFcbyzpZpAw/3j9ajvEqsOKpdHZpILT2NZX/VahhjqfqB3k0kJVt3uK7UYQ==}
|
resolution: {integrity: sha512-Gi4872cFtc2d83FKATR6Qcf2VBa/tFCqffI/IwRRl6Hx5FulEBqx+tH7gAuRVF693vrbXNxK+FQ+k4iEsEJxrw==}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
|
||||||
'@rspack/binding-wasm32-wasi@1.7.8':
|
'@rspack/binding-wasm32-wasi@1.7.9':
|
||||||
resolution: {integrity: sha512-mHtgYTpdhx01i0XNKFYBZyCjtv9YUe/sDfpD1QK4FytPFB+1VpYnmZiaJIMM77VpNsjxGAqWhmUYxi2P6jWifw==}
|
resolution: {integrity: sha512-5QEzqo6EaolpuZmK6w/mgSueorgGnnzp7dJaAvBj6ECFIg/aLXhXXmWCWbxt7Ws2gKvG5/PgaxDqbUxYL51juA==}
|
||||||
cpu: [wasm32]
|
cpu: [wasm32]
|
||||||
|
|
||||||
'@rspack/binding-win32-arm64-msvc@1.7.8':
|
'@rspack/binding-win32-arm64-msvc@1.7.9':
|
||||||
resolution: {integrity: sha512-Mkxg86F7kIT4pM9XvE/1LAGjK5NOQi/GJxKyyiKbUAeKM8XBUizVeNuvKR0avf2V5IDAIRXiH1SX8SpujMJteA==}
|
resolution: {integrity: sha512-MMqvcrIc8aOqTuHjWkjdzilvoZ3Hv07Od0Foogiyq3JMudsS3Wcmh7T1dFerGg19MOJcRUeEkrg2NQOMOQ6xDA==}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [win32]
|
os: [win32]
|
||||||
|
|
||||||
'@rspack/binding-win32-ia32-msvc@1.7.8':
|
'@rspack/binding-win32-ia32-msvc@1.7.9':
|
||||||
resolution: {integrity: sha512-VmTOZ/X7M85lKFNwb2qJpCRzr4SgO42vucq/X7Uz1oSoTPAf8UUMNdi7BPnu+D4lgy6l8PwV804ZyHO3gGsvPA==}
|
resolution: {integrity: sha512-4kYYS+NZ2CuNbKjq40yB/UEyB51o1PHj5wpr+Y943oOJXpEKWU2Q4vkF8VEohPEcnA9cKVotYCnqStme+02suA==}
|
||||||
cpu: [ia32]
|
cpu: [ia32]
|
||||||
os: [win32]
|
os: [win32]
|
||||||
|
|
||||||
'@rspack/binding-win32-x64-msvc@1.7.8':
|
'@rspack/binding-win32-x64-msvc@1.7.9':
|
||||||
resolution: {integrity: sha512-BK0I4HAwp/yQLnmdJpUtGHcht3x11e9fZwyaiMzznznFc+Oypbf+FS5h+aBgpb53QnNkPpdG7MfAPoKItOcU8A==}
|
resolution: {integrity: sha512-1g+QyXXvs+838Un/4GaUvJfARDGHMCs15eXDYWBl5m/Skubyng8djWAgr6ag1+cVoJZXCPOvybTItcblWF3gbQ==}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [win32]
|
os: [win32]
|
||||||
|
|
||||||
'@rspack/binding@1.7.8':
|
'@rspack/binding@1.7.9':
|
||||||
resolution: {integrity: sha512-P4fbrQx5hRhAiC8TBTEMCTnNawrIzJLjWwAgrTwRxjgenpjNvimEkQBtSGrXOY+c+MV5Q74P+9wPvVWLKzRkQQ==}
|
resolution: {integrity: sha512-A56e0NdfNwbOSJoilMkxzaPuVYaKCNn1shuiwWnCIBmhV9ix1n9S1XvquDjkGyv+gCdR1+zfJBOa5DMB7htLHw==}
|
||||||
|
|
||||||
'@rspack/core@1.7.8':
|
'@rspack/core@1.7.9':
|
||||||
resolution: {integrity: sha512-kT6yYo8xjKoDfM7iB8N9AmN9DJIlrs7UmQDbpTu1N4zaZocN1/t2fIAWOKjr5+3eJlZQR2twKZhDVHNLbLPjOw==}
|
resolution: {integrity: sha512-VHuSKvRkuv42Ya+TxEGO0LE0r9+8P4tKGokmomj4R1f/Nu2vtS3yoaIMfC4fR6VuHGd3MZ+KTI0cNNwHfFcskw==}
|
||||||
engines: {node: '>=18.12.0'}
|
engines: {node: '>=18.12.0'}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
'@swc/helpers': '>=0.5.1'
|
'@swc/helpers': '>=0.5.1'
|
||||||
@@ -836,8 +839,8 @@ packages:
|
|||||||
'@sec-ant/readable-stream@0.4.1':
|
'@sec-ant/readable-stream@0.4.1':
|
||||||
resolution: {integrity: sha512-831qok9r2t8AlxLko40y2ebgSDhenenCatLVeW/uBtnHPyhHOvG0C7TvfgecV+wHzIm5KUICgzmVpWS+IMEAeg==}
|
resolution: {integrity: sha512-831qok9r2t8AlxLko40y2ebgSDhenenCatLVeW/uBtnHPyhHOvG0C7TvfgecV+wHzIm5KUICgzmVpWS+IMEAeg==}
|
||||||
|
|
||||||
'@serve.zone/catalog@2.5.0':
|
'@serve.zone/catalog@2.8.0':
|
||||||
resolution: {integrity: sha512-bRwk7pbDxUB471wUAS7p22MTOOBCHlMWijsE43K9tDAPcxlRarhtf2Dgx0Y25s/dFXqj2JHwe6jjE84S80jFzg==}
|
resolution: {integrity: sha512-p0ES14JwUoJE88DBtLSHcCfFPVa0vKhvHnQLaAY3OC15kfheNKidi1SwTFyMh43jj0ZNi4Lecc3W02wG6sasHw==}
|
||||||
|
|
||||||
'@tempfix/idb@8.0.3':
|
'@tempfix/idb@8.0.3':
|
||||||
resolution: {integrity: sha512-hPJQKO7+oAIY+pDNImrZ9QAINbz9KmwT+yO4iRVwdPanok2YKpaUxdJzIvCUwY0YgAawlvYdffbLvRLV5hbs2g==}
|
resolution: {integrity: sha512-hPJQKO7+oAIY+pDNImrZ9QAINbz9KmwT+yO4iRVwdPanok2YKpaUxdJzIvCUwY0YgAawlvYdffbLvRLV5hbs2g==}
|
||||||
@@ -1362,15 +1365,15 @@ packages:
|
|||||||
fast-json-stable-stringify@2.1.0:
|
fast-json-stable-stringify@2.1.0:
|
||||||
resolution: {integrity: sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==}
|
resolution: {integrity: sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==}
|
||||||
|
|
||||||
fast-xml-builder@1.1.3:
|
fast-xml-builder@1.1.4:
|
||||||
resolution: {integrity: sha512-1o60KoFw2+LWKQu3IdcfcFlGTW4dpqEWmjhYec6H82AYZU2TVBXep6tMl8Z1Y+wM+ZrzCwe3BZ9Vyd9N2rIvmg==}
|
resolution: {integrity: sha512-f2jhpN4Eccy0/Uz9csxh3Nu6q4ErKxf0XIsasomfOihuSUa3/xw6w8dnOtCDgEItQFJG8KyXPzQXzcODDrrbOg==}
|
||||||
|
|
||||||
fast-xml-parser@4.5.4:
|
fast-xml-parser@4.5.4:
|
||||||
resolution: {integrity: sha512-jE8ugADnYOBsu1uaoayVl1tVKAMNOXyjwvv2U6udEA2ORBhDooJDWoGxTkhd4Qn4yh59JVVt/pKXtjPwx9OguQ==}
|
resolution: {integrity: sha512-jE8ugADnYOBsu1uaoayVl1tVKAMNOXyjwvv2U6udEA2ORBhDooJDWoGxTkhd4Qn4yh59JVVt/pKXtjPwx9OguQ==}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
||||||
fast-xml-parser@5.5.5:
|
fast-xml-parser@5.5.6:
|
||||||
resolution: {integrity: sha512-NLY+V5NNbdmiEszx9n14mZBseJTC50bRq1VHsaxOmR72JDuZt+5J1Co+dC/4JPnyq+WrIHNM69r0sqf7BMb3Mg==}
|
resolution: {integrity: sha512-3+fdZyBRVg29n4rXP0joHthhcHdPUHaIC16cuyyd1iLsuaO6Vea36MPrxgAzbZna8lhvZeRL8Bc9GP56/J9xEw==}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
||||||
fault@2.0.1:
|
fault@2.0.1:
|
||||||
@@ -2337,7 +2340,7 @@ snapshots:
|
|||||||
'@api.global/typedrequest': 3.3.0
|
'@api.global/typedrequest': 3.3.0
|
||||||
'@api.global/typedrequest-interfaces': 3.0.19
|
'@api.global/typedrequest-interfaces': 3.0.19
|
||||||
'@api.global/typedsocket': 4.1.2(@push.rocks/smartserve@2.0.1)
|
'@api.global/typedsocket': 4.1.2(@push.rocks/smartserve@2.0.1)
|
||||||
'@cloudflare/workers-types': 4.20260313.1
|
'@cloudflare/workers-types': 4.20260317.1
|
||||||
'@design.estate/dees-catalog': 3.48.5(@tiptap/pm@2.27.2)
|
'@design.estate/dees-catalog': 3.48.5(@tiptap/pm@2.27.2)
|
||||||
'@design.estate/dees-comms': 1.0.30
|
'@design.estate/dees-comms': 1.0.30
|
||||||
'@push.rocks/lik': 6.3.1
|
'@push.rocks/lik': 6.3.1
|
||||||
@@ -2397,7 +2400,7 @@ snapshots:
|
|||||||
|
|
||||||
'@cfworker/json-schema@4.1.1': {}
|
'@cfworker/json-schema@4.1.1': {}
|
||||||
|
|
||||||
'@cloudflare/workers-types@4.20260313.1': {}
|
'@cloudflare/workers-types@4.20260317.1': {}
|
||||||
|
|
||||||
'@configvault.io/interfaces@1.0.17':
|
'@configvault.io/interfaces@1.0.17':
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -2620,7 +2623,7 @@ snapshots:
|
|||||||
'@push.rocks/smartpath': 6.0.0
|
'@push.rocks/smartpath': 6.0.0
|
||||||
'@push.rocks/smartpromise': 4.2.3
|
'@push.rocks/smartpromise': 4.2.3
|
||||||
'@push.rocks/smartspawn': 3.0.3
|
'@push.rocks/smartspawn': 3.0.3
|
||||||
'@rspack/core': 1.7.8
|
'@rspack/core': 1.7.9
|
||||||
'@types/html-minifier': 4.0.6
|
'@types/html-minifier': 4.0.6
|
||||||
esbuild: 0.27.4
|
esbuild: 0.27.4
|
||||||
html-minifier: 4.0.0
|
html-minifier: 4.0.0
|
||||||
@@ -2814,52 +2817,52 @@ snapshots:
|
|||||||
'@module-federation/runtime': 0.22.0
|
'@module-federation/runtime': 0.22.0
|
||||||
'@module-federation/sdk': 0.22.0
|
'@module-federation/sdk': 0.22.0
|
||||||
|
|
||||||
'@napi-rs/canvas-android-arm64@0.1.96':
|
'@napi-rs/canvas-android-arm64@0.1.97':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@napi-rs/canvas-darwin-arm64@0.1.96':
|
'@napi-rs/canvas-darwin-arm64@0.1.97':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@napi-rs/canvas-darwin-x64@0.1.96':
|
'@napi-rs/canvas-darwin-x64@0.1.97':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@napi-rs/canvas-linux-arm-gnueabihf@0.1.96':
|
'@napi-rs/canvas-linux-arm-gnueabihf@0.1.97':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@napi-rs/canvas-linux-arm64-gnu@0.1.96':
|
'@napi-rs/canvas-linux-arm64-gnu@0.1.97':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@napi-rs/canvas-linux-arm64-musl@0.1.96':
|
'@napi-rs/canvas-linux-arm64-musl@0.1.97':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@napi-rs/canvas-linux-riscv64-gnu@0.1.96':
|
'@napi-rs/canvas-linux-riscv64-gnu@0.1.97':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@napi-rs/canvas-linux-x64-gnu@0.1.96':
|
'@napi-rs/canvas-linux-x64-gnu@0.1.97':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@napi-rs/canvas-linux-x64-musl@0.1.96':
|
'@napi-rs/canvas-linux-x64-musl@0.1.97':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@napi-rs/canvas-win32-arm64-msvc@0.1.96':
|
'@napi-rs/canvas-win32-arm64-msvc@0.1.97':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@napi-rs/canvas-win32-x64-msvc@0.1.96':
|
'@napi-rs/canvas-win32-x64-msvc@0.1.97':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@napi-rs/canvas@0.1.96':
|
'@napi-rs/canvas@0.1.97':
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
'@napi-rs/canvas-android-arm64': 0.1.96
|
'@napi-rs/canvas-android-arm64': 0.1.97
|
||||||
'@napi-rs/canvas-darwin-arm64': 0.1.96
|
'@napi-rs/canvas-darwin-arm64': 0.1.97
|
||||||
'@napi-rs/canvas-darwin-x64': 0.1.96
|
'@napi-rs/canvas-darwin-x64': 0.1.97
|
||||||
'@napi-rs/canvas-linux-arm-gnueabihf': 0.1.96
|
'@napi-rs/canvas-linux-arm-gnueabihf': 0.1.97
|
||||||
'@napi-rs/canvas-linux-arm64-gnu': 0.1.96
|
'@napi-rs/canvas-linux-arm64-gnu': 0.1.97
|
||||||
'@napi-rs/canvas-linux-arm64-musl': 0.1.96
|
'@napi-rs/canvas-linux-arm64-musl': 0.1.97
|
||||||
'@napi-rs/canvas-linux-riscv64-gnu': 0.1.96
|
'@napi-rs/canvas-linux-riscv64-gnu': 0.1.97
|
||||||
'@napi-rs/canvas-linux-x64-gnu': 0.1.96
|
'@napi-rs/canvas-linux-x64-gnu': 0.1.97
|
||||||
'@napi-rs/canvas-linux-x64-musl': 0.1.96
|
'@napi-rs/canvas-linux-x64-musl': 0.1.97
|
||||||
'@napi-rs/canvas-win32-arm64-msvc': 0.1.96
|
'@napi-rs/canvas-win32-arm64-msvc': 0.1.97
|
||||||
'@napi-rs/canvas-win32-x64-msvc': 0.1.96
|
'@napi-rs/canvas-win32-x64-msvc': 0.1.97
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@napi-rs/wasm-runtime@1.0.7':
|
'@napi-rs/wasm-runtime@1.0.7':
|
||||||
@@ -3273,7 +3276,7 @@ snapshots:
|
|||||||
|
|
||||||
'@push.rocks/smartxml@2.0.0':
|
'@push.rocks/smartxml@2.0.0':
|
||||||
dependencies:
|
dependencies:
|
||||||
fast-xml-parser: 5.5.5
|
fast-xml-parser: 5.5.6
|
||||||
|
|
||||||
'@push.rocks/smartyaml@2.0.5':
|
'@push.rocks/smartyaml@2.0.5':
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -3419,62 +3422,62 @@ snapshots:
|
|||||||
|
|
||||||
'@rolldown/pluginutils@1.0.0-beta.52': {}
|
'@rolldown/pluginutils@1.0.0-beta.52': {}
|
||||||
|
|
||||||
'@rspack/binding-darwin-arm64@1.7.8':
|
'@rspack/binding-darwin-arm64@1.7.9':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@rspack/binding-darwin-x64@1.7.8':
|
'@rspack/binding-darwin-x64@1.7.9':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@rspack/binding-linux-arm64-gnu@1.7.8':
|
'@rspack/binding-linux-arm64-gnu@1.7.9':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@rspack/binding-linux-arm64-musl@1.7.8':
|
'@rspack/binding-linux-arm64-musl@1.7.9':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@rspack/binding-linux-x64-gnu@1.7.8':
|
'@rspack/binding-linux-x64-gnu@1.7.9':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@rspack/binding-linux-x64-musl@1.7.8':
|
'@rspack/binding-linux-x64-musl@1.7.9':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@rspack/binding-wasm32-wasi@1.7.8':
|
'@rspack/binding-wasm32-wasi@1.7.9':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@napi-rs/wasm-runtime': 1.0.7
|
'@napi-rs/wasm-runtime': 1.0.7
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@rspack/binding-win32-arm64-msvc@1.7.8':
|
'@rspack/binding-win32-arm64-msvc@1.7.9':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@rspack/binding-win32-ia32-msvc@1.7.8':
|
'@rspack/binding-win32-ia32-msvc@1.7.9':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@rspack/binding-win32-x64-msvc@1.7.8':
|
'@rspack/binding-win32-x64-msvc@1.7.9':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@rspack/binding@1.7.8':
|
'@rspack/binding@1.7.9':
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
'@rspack/binding-darwin-arm64': 1.7.8
|
'@rspack/binding-darwin-arm64': 1.7.9
|
||||||
'@rspack/binding-darwin-x64': 1.7.8
|
'@rspack/binding-darwin-x64': 1.7.9
|
||||||
'@rspack/binding-linux-arm64-gnu': 1.7.8
|
'@rspack/binding-linux-arm64-gnu': 1.7.9
|
||||||
'@rspack/binding-linux-arm64-musl': 1.7.8
|
'@rspack/binding-linux-arm64-musl': 1.7.9
|
||||||
'@rspack/binding-linux-x64-gnu': 1.7.8
|
'@rspack/binding-linux-x64-gnu': 1.7.9
|
||||||
'@rspack/binding-linux-x64-musl': 1.7.8
|
'@rspack/binding-linux-x64-musl': 1.7.9
|
||||||
'@rspack/binding-wasm32-wasi': 1.7.8
|
'@rspack/binding-wasm32-wasi': 1.7.9
|
||||||
'@rspack/binding-win32-arm64-msvc': 1.7.8
|
'@rspack/binding-win32-arm64-msvc': 1.7.9
|
||||||
'@rspack/binding-win32-ia32-msvc': 1.7.8
|
'@rspack/binding-win32-ia32-msvc': 1.7.9
|
||||||
'@rspack/binding-win32-x64-msvc': 1.7.8
|
'@rspack/binding-win32-x64-msvc': 1.7.9
|
||||||
|
|
||||||
'@rspack/core@1.7.8':
|
'@rspack/core@1.7.9':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@module-federation/runtime-tools': 0.22.0
|
'@module-federation/runtime-tools': 0.22.0
|
||||||
'@rspack/binding': 1.7.8
|
'@rspack/binding': 1.7.9
|
||||||
'@rspack/lite-tapable': 1.1.0
|
'@rspack/lite-tapable': 1.1.0
|
||||||
|
|
||||||
'@rspack/lite-tapable@1.1.0': {}
|
'@rspack/lite-tapable@1.1.0': {}
|
||||||
|
|
||||||
'@sec-ant/readable-stream@0.4.1': {}
|
'@sec-ant/readable-stream@0.4.1': {}
|
||||||
|
|
||||||
'@serve.zone/catalog@2.5.0(@tiptap/pm@2.27.2)':
|
'@serve.zone/catalog@2.8.0(@tiptap/pm@2.27.2)':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@design.estate/dees-catalog': 3.48.5(@tiptap/pm@2.27.2)
|
'@design.estate/dees-catalog': 3.48.5(@tiptap/pm@2.27.2)
|
||||||
'@design.estate/dees-domtools': 2.5.1
|
'@design.estate/dees-domtools': 2.5.1
|
||||||
@@ -4004,7 +4007,7 @@ snapshots:
|
|||||||
|
|
||||||
fast-json-stable-stringify@2.1.0: {}
|
fast-json-stable-stringify@2.1.0: {}
|
||||||
|
|
||||||
fast-xml-builder@1.1.3:
|
fast-xml-builder@1.1.4:
|
||||||
dependencies:
|
dependencies:
|
||||||
path-expression-matcher: 1.1.3
|
path-expression-matcher: 1.1.3
|
||||||
|
|
||||||
@@ -4012,9 +4015,9 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
strnum: 1.1.2
|
strnum: 1.1.2
|
||||||
|
|
||||||
fast-xml-parser@5.5.5:
|
fast-xml-parser@5.5.6:
|
||||||
dependencies:
|
dependencies:
|
||||||
fast-xml-builder: 1.1.3
|
fast-xml-builder: 1.1.4
|
||||||
path-expression-matcher: 1.1.3
|
path-expression-matcher: 1.1.3
|
||||||
strnum: 2.2.0
|
strnum: 2.2.0
|
||||||
|
|
||||||
@@ -4736,7 +4739,7 @@ snapshots:
|
|||||||
|
|
||||||
pdfjs-dist@4.10.38:
|
pdfjs-dist@4.10.38:
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
'@napi-rs/canvas': 0.1.96
|
'@napi-rs/canvas': 0.1.97
|
||||||
|
|
||||||
peek-readable@5.4.2: {}
|
peek-readable@5.4.2: {}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@serve.zone/onebox',
|
name: '@serve.zone/onebox',
|
||||||
version: '1.13.14',
|
version: '1.22.2',
|
||||||
description: 'Self-hosted container platform with automatic SSL and DNS - a mini Heroku for single servers'
|
description: 'Self-hosted container platform with automatic SSL and DNS - a mini Heroku for single servers'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,9 +4,7 @@
|
|||||||
* Handles background monitoring, metrics collection, and automatic tasks
|
* Handles background monitoring, metrics collection, and automatic tasks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as plugins from '../plugins.ts';
|
|
||||||
import { logger } from '../logging.ts';
|
import { logger } from '../logging.ts';
|
||||||
import { projectInfo } from '../info.ts';
|
|
||||||
import { getErrorMessage } from '../utils/error.ts';
|
import { getErrorMessage } from '../utils/error.ts';
|
||||||
import type { Onebox } from './onebox.ts';
|
import type { Onebox } from './onebox.ts';
|
||||||
|
|
||||||
@@ -18,7 +16,6 @@ const FALLBACK_PID_FILE = `${FALLBACK_PID_DIR}/onebox.pid`;
|
|||||||
|
|
||||||
export class OneboxDaemon {
|
export class OneboxDaemon {
|
||||||
private oneboxRef: Onebox;
|
private oneboxRef: Onebox;
|
||||||
private smartdaemon: plugins.smartdaemon.SmartDaemon | null = null;
|
|
||||||
private running = false;
|
private running = false;
|
||||||
private monitoringInterval: number | null = null;
|
private monitoringInterval: number | null = null;
|
||||||
private statsInterval: number | null = null;
|
private statsInterval: number | null = null;
|
||||||
@@ -46,68 +43,6 @@ export class OneboxDaemon {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Install systemd service
|
|
||||||
*/
|
|
||||||
async installService(): Promise<void> {
|
|
||||||
try {
|
|
||||||
logger.info('Installing Onebox daemon service...');
|
|
||||||
|
|
||||||
// Initialize smartdaemon if needed
|
|
||||||
if (!this.smartdaemon) {
|
|
||||||
this.smartdaemon = new plugins.smartdaemon.SmartDaemon();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get installation directory
|
|
||||||
const execPath = Deno.execPath();
|
|
||||||
|
|
||||||
const service = await this.smartdaemon.addService({
|
|
||||||
name: 'onebox',
|
|
||||||
version: projectInfo.version,
|
|
||||||
command: `${execPath} run --allow-all ${Deno.cwd()}/mod.ts daemon start`,
|
|
||||||
description: 'Onebox - Self-hosted container platform',
|
|
||||||
workingDir: Deno.cwd(),
|
|
||||||
});
|
|
||||||
|
|
||||||
await service.save();
|
|
||||||
await service.enable();
|
|
||||||
|
|
||||||
logger.success('Onebox daemon service installed');
|
|
||||||
logger.info('Start with: sudo systemctl start smartdaemon_onebox');
|
|
||||||
} catch (error) {
|
|
||||||
logger.error(`Failed to install daemon service: ${getErrorMessage(error)}`);
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Uninstall systemd service
|
|
||||||
*/
|
|
||||||
async uninstallService(): Promise<void> {
|
|
||||||
try {
|
|
||||||
logger.info('Uninstalling Onebox daemon service...');
|
|
||||||
|
|
||||||
// Initialize smartdaemon if needed
|
|
||||||
if (!this.smartdaemon) {
|
|
||||||
this.smartdaemon = new plugins.smartdaemon.SmartDaemon();
|
|
||||||
}
|
|
||||||
|
|
||||||
const services = await this.smartdaemon.systemdManager.getServices();
|
|
||||||
const service = services.find(s => s.name === 'onebox');
|
|
||||||
|
|
||||||
if (service) {
|
|
||||||
await service.stop();
|
|
||||||
await service.disable();
|
|
||||||
await service.delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.success('Onebox daemon service uninstalled');
|
|
||||||
} catch (error) {
|
|
||||||
logger.error(`Failed to uninstall daemon service: ${getErrorMessage(error)}`);
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start daemon mode (background monitoring)
|
* Start daemon mode (background monitoring)
|
||||||
*/
|
*/
|
||||||
@@ -482,36 +417,7 @@ export class OneboxDaemon {
|
|||||||
static async ensureNoDaemon(): Promise<void> {
|
static async ensureNoDaemon(): Promise<void> {
|
||||||
const running = await OneboxDaemon.isDaemonRunning();
|
const running = await OneboxDaemon.isDaemonRunning();
|
||||||
if (running) {
|
if (running) {
|
||||||
throw new Error('Daemon is already running. Please stop it first with: onebox daemon stop');
|
throw new Error('Daemon is already running. Please stop it first with: onebox systemd stop');
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get service status from systemd
|
|
||||||
*/
|
|
||||||
async getServiceStatus(): Promise<string> {
|
|
||||||
try {
|
|
||||||
// Don't need smartdaemon to check status, just use systemctl directly
|
|
||||||
const command = new Deno.Command('systemctl', {
|
|
||||||
args: ['status', 'smartdaemon_onebox'],
|
|
||||||
stdout: 'piped',
|
|
||||||
stderr: 'piped',
|
|
||||||
});
|
|
||||||
|
|
||||||
const { code, stdout } = await command.output();
|
|
||||||
const output = new TextDecoder().decode(stdout);
|
|
||||||
|
|
||||||
if (code === 0 || output.includes('active (running)')) {
|
|
||||||
return 'running';
|
|
||||||
} else if (output.includes('inactive') || output.includes('dead')) {
|
|
||||||
return 'stopped';
|
|
||||||
} else if (output.includes('failed')) {
|
|
||||||
return 'failed';
|
|
||||||
} else {
|
|
||||||
return 'unknown';
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
return 'not-installed';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -596,18 +596,26 @@ export class OneboxDockerManager {
|
|||||||
async getContainerStats(containerID: string): Promise<IContainerStats | null> {
|
async getContainerStats(containerID: string): Promise<IContainerStats | null> {
|
||||||
try {
|
try {
|
||||||
// Try to get container directly first
|
// Try to get container directly first
|
||||||
let container = await this.dockerClient!.getContainerById(containerID);
|
let container: any = null;
|
||||||
|
try {
|
||||||
|
container = await this.dockerClient!.getContainerById(containerID);
|
||||||
|
} catch {
|
||||||
|
// Container not found by ID — might be a Swarm service ID
|
||||||
|
}
|
||||||
|
|
||||||
// If not found, it might be a service ID - try to get the actual container ID
|
// If not found, it might be a service ID - try to get the actual container ID
|
||||||
if (!container) {
|
if (!container) {
|
||||||
const serviceContainerId = await this.getContainerIdForService(containerID);
|
const serviceContainerId = await this.getContainerIdForService(containerID);
|
||||||
if (serviceContainerId) {
|
if (serviceContainerId) {
|
||||||
container = await this.dockerClient!.getContainerById(serviceContainerId);
|
try {
|
||||||
|
container = await this.dockerClient!.getContainerById(serviceContainerId);
|
||||||
|
} catch {
|
||||||
|
// Service container also not found
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!container) {
|
if (!container) {
|
||||||
// Container/service not found
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -849,7 +857,23 @@ export class OneboxDockerManager {
|
|||||||
cmd: string[]
|
cmd: string[]
|
||||||
): Promise<{ stdout: string; stderr: string; exitCode: number }> {
|
): Promise<{ stdout: string; stderr: string; exitCode: number }> {
|
||||||
try {
|
try {
|
||||||
const container = await this.dockerClient!.getContainerById(containerID);
|
let container: any = null;
|
||||||
|
try {
|
||||||
|
container = await this.dockerClient!.getContainerById(containerID);
|
||||||
|
} catch {
|
||||||
|
// Not a direct container ID — try Swarm service lookup
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!container) {
|
||||||
|
const serviceContainerId = await this.getContainerIdForService(containerID);
|
||||||
|
if (serviceContainerId) {
|
||||||
|
try {
|
||||||
|
container = await this.dockerClient!.getContainerById(serviceContainerId);
|
||||||
|
} catch {
|
||||||
|
// Service container also not found
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!container) {
|
if (!container) {
|
||||||
throw new Error(`Container not found: ${containerID}`);
|
throw new Error(`Container not found: ${containerID}`);
|
||||||
@@ -881,12 +905,12 @@ export class OneboxDockerManager {
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
const execInfo = await inspect();
|
const execInfo = await inspect();
|
||||||
const exitCode = execInfo.ExitCode || 0;
|
const exitCode = execInfo.ExitCode ?? -1;
|
||||||
|
|
||||||
return { stdout, stderr, exitCode };
|
return { stdout, stderr, exitCode };
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error(`Failed to exec in container ${containerID}: ${getErrorMessage(error)}`);
|
logger.error(`Failed to exec in container ${containerID}: ${getErrorMessage(error)}`);
|
||||||
throw error;
|
return { stdout: '', stderr: getErrorMessage(error), exitCode: -1 };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1011,7 +1035,23 @@ export class OneboxDockerManager {
|
|||||||
callback: (line: string, isError: boolean) => void
|
callback: (line: string, isError: boolean) => void
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
try {
|
try {
|
||||||
const container = await this.dockerClient!.getContainerById(containerID);
|
let container: any = null;
|
||||||
|
try {
|
||||||
|
container = await this.dockerClient!.getContainerById(containerID);
|
||||||
|
} catch {
|
||||||
|
// Not a direct container ID — try Swarm service lookup
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!container) {
|
||||||
|
const serviceContainerId = await this.getContainerIdForService(containerID);
|
||||||
|
if (serviceContainerId) {
|
||||||
|
try {
|
||||||
|
container = await this.dockerClient!.getContainerById(serviceContainerId);
|
||||||
|
} catch {
|
||||||
|
// Service container also not found
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!container) {
|
if (!container) {
|
||||||
throw new Error(`Container not found: ${containerID}`);
|
throw new Error(`Container not found: ${containerID}`);
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import { OneboxReverseProxy } from './reverseproxy.ts';
|
|||||||
import { OneboxDnsManager } from './dns.ts';
|
import { OneboxDnsManager } from './dns.ts';
|
||||||
import { OneboxSslManager } from './ssl.ts';
|
import { OneboxSslManager } from './ssl.ts';
|
||||||
import { OneboxDaemon } from './daemon.ts';
|
import { OneboxDaemon } from './daemon.ts';
|
||||||
|
import { OneboxSystemd } from './systemd.ts';
|
||||||
import { OneboxHttpServer } from './httpserver.ts';
|
import { OneboxHttpServer } from './httpserver.ts';
|
||||||
import { CloudflareDomainSync } from './cloudflare-sync.ts';
|
import { CloudflareDomainSync } from './cloudflare-sync.ts';
|
||||||
import { CertRequirementManager } from './cert-requirement-manager.ts';
|
import { CertRequirementManager } from './cert-requirement-manager.ts';
|
||||||
@@ -33,6 +34,7 @@ export class Onebox {
|
|||||||
public dns: OneboxDnsManager;
|
public dns: OneboxDnsManager;
|
||||||
public ssl: OneboxSslManager;
|
public ssl: OneboxSslManager;
|
||||||
public daemon: OneboxDaemon;
|
public daemon: OneboxDaemon;
|
||||||
|
public systemd: OneboxSystemd;
|
||||||
public httpServer: OneboxHttpServer;
|
public httpServer: OneboxHttpServer;
|
||||||
public cloudflareDomainSync: CloudflareDomainSync;
|
public cloudflareDomainSync: CloudflareDomainSync;
|
||||||
public certRequirementManager: CertRequirementManager;
|
public certRequirementManager: CertRequirementManager;
|
||||||
@@ -57,6 +59,7 @@ export class Onebox {
|
|||||||
this.dns = new OneboxDnsManager(this);
|
this.dns = new OneboxDnsManager(this);
|
||||||
this.ssl = new OneboxSslManager(this);
|
this.ssl = new OneboxSslManager(this);
|
||||||
this.daemon = new OneboxDaemon(this);
|
this.daemon = new OneboxDaemon(this);
|
||||||
|
this.systemd = new OneboxSystemd();
|
||||||
this.httpServer = new OneboxHttpServer(this);
|
this.httpServer = new OneboxHttpServer(this);
|
||||||
this.registry = new RegistryManager({
|
this.registry = new RegistryManager({
|
||||||
dataDir: './.nogit/registry-data',
|
dataDir: './.nogit/registry-data',
|
||||||
@@ -288,10 +291,65 @@ export class Onebox {
|
|||||||
// Sort expiring domains by days remaining (ascending)
|
// Sort expiring domains by days remaining (ascending)
|
||||||
expiringDomains.sort((a, b) => a.daysRemaining - b.daysRemaining);
|
expiringDomains.sort((a, b) => a.daysRemaining - b.daysRemaining);
|
||||||
|
|
||||||
|
// Aggregate resource usage across all running service containers
|
||||||
|
let totalCpu = 0;
|
||||||
|
let totalMemoryUsed = 0;
|
||||||
|
let totalMemoryLimit = 0;
|
||||||
|
let totalNetworkIn = 0;
|
||||||
|
let totalNetworkOut = 0;
|
||||||
|
|
||||||
|
if (dockerRunning) {
|
||||||
|
const allServices = this.services.listServices();
|
||||||
|
const runningUserServices = allServices.filter((s) => s.status === 'running' && s.containerID);
|
||||||
|
logger.debug(`Resource stats: ${runningUserServices.length} running user services`);
|
||||||
|
|
||||||
|
const statsPromises = runningUserServices
|
||||||
|
.map((s) => {
|
||||||
|
logger.debug(`Fetching stats for user service: ${s.name} (${s.containerID})`);
|
||||||
|
return this.docker.getContainerStats(s.containerID!).catch((err) => {
|
||||||
|
logger.debug(`Stats failed for ${s.name}: ${(err as Error).message}`);
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Also get stats for platform service containers
|
||||||
|
const allPlatformServices = this.platformServices.getAllPlatformServices();
|
||||||
|
const runningPlatformServices = allPlatformServices.filter((s) => s.status === 'running' && s.containerId);
|
||||||
|
logger.debug(`Resource stats: ${runningPlatformServices.length} running platform services`);
|
||||||
|
|
||||||
|
const platformStatsPromises = runningPlatformServices
|
||||||
|
.map((s) => {
|
||||||
|
logger.debug(`Fetching stats for platform service: ${s.type} (${s.containerId})`);
|
||||||
|
return this.docker.getContainerStats(s.containerId!).catch((err) => {
|
||||||
|
logger.debug(`Stats failed for ${s.type}: ${(err as Error).message}`);
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
const allStats = await Promise.all([...statsPromises, ...platformStatsPromises]);
|
||||||
|
let successCount = 0;
|
||||||
|
for (const stats of allStats) {
|
||||||
|
if (stats) {
|
||||||
|
successCount++;
|
||||||
|
totalCpu += stats.cpuPercent;
|
||||||
|
totalMemoryUsed += stats.memoryUsed;
|
||||||
|
totalMemoryLimit = Math.max(totalMemoryLimit, stats.memoryLimit);
|
||||||
|
totalNetworkIn += stats.networkRx;
|
||||||
|
totalNetworkOut += stats.networkTx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
logger.debug(`Resource stats: ${successCount}/${allStats.length} containers returned stats. CPU: ${totalCpu}, Mem: ${totalMemoryUsed}`);
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
docker: {
|
docker: {
|
||||||
running: dockerRunning,
|
running: dockerRunning,
|
||||||
version: dockerRunning ? await this.docker.getDockerVersion() : null,
|
version: dockerRunning ? await this.docker.getDockerVersion() : null,
|
||||||
|
cpuUsage: Math.round(totalCpu * 10) / 10,
|
||||||
|
memoryUsage: totalMemoryUsed,
|
||||||
|
memoryTotal: totalMemoryLimit,
|
||||||
|
networkIn: totalNetworkIn,
|
||||||
|
networkOut: totalNetworkOut,
|
||||||
},
|
},
|
||||||
reverseProxy: proxyStatus,
|
reverseProxy: proxyStatus,
|
||||||
dns: {
|
dns: {
|
||||||
@@ -320,20 +378,6 @@ export class Onebox {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Start daemon mode
|
|
||||||
*/
|
|
||||||
async startDaemon(): Promise<void> {
|
|
||||||
await this.daemon.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Stop daemon mode
|
|
||||||
*/
|
|
||||||
async stopDaemon(): Promise<void> {
|
|
||||||
await this.daemon.stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start OpsServer (TypedRequest-based, serves new UI)
|
* Start OpsServer (TypedRequest-based, serves new UI)
|
||||||
*/
|
*/
|
||||||
@@ -355,6 +399,9 @@ export class Onebox {
|
|||||||
try {
|
try {
|
||||||
logger.info('Shutting down Onebox...');
|
logger.info('Shutting down Onebox...');
|
||||||
|
|
||||||
|
// Stop auto-update monitoring
|
||||||
|
this.services.stopAutoUpdateMonitoring();
|
||||||
|
|
||||||
// Stop backup scheduler
|
// Stop backup scheduler
|
||||||
await this.backupScheduler.stop();
|
await this.backupScheduler.stop();
|
||||||
|
|
||||||
|
|||||||
@@ -194,12 +194,6 @@ export class ClickHouseProvider extends BasePlatformServiceProvider {
|
|||||||
const adminCreds = await credentialEncryption.decrypt(platformService.adminCredentialsEncrypted);
|
const adminCreds = await credentialEncryption.decrypt(platformService.adminCredentialsEncrypted);
|
||||||
const containerName = this.getContainerName();
|
const containerName = this.getContainerName();
|
||||||
|
|
||||||
// Get container host port for connection from host (overlay network IPs not accessible from host)
|
|
||||||
const hostPort = await this.oneboxRef.docker.getContainerHostPort(platformService.containerId, 8123);
|
|
||||||
if (!hostPort) {
|
|
||||||
throw new Error('Could not get ClickHouse container host port');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Generate resource names and credentials
|
// Generate resource names and credentials
|
||||||
const dbName = this.generateResourceName(userService.name);
|
const dbName = this.generateResourceName(userService.name);
|
||||||
const username = this.generateResourceName(userService.name);
|
const username = this.generateResourceName(userService.name);
|
||||||
@@ -207,35 +201,16 @@ export class ClickHouseProvider extends BasePlatformServiceProvider {
|
|||||||
|
|
||||||
logger.info(`Provisioning ClickHouse database '${dbName}' for service '${userService.name}'...`);
|
logger.info(`Provisioning ClickHouse database '${dbName}' for service '${userService.name}'...`);
|
||||||
|
|
||||||
// Connect to ClickHouse via localhost and the mapped host port
|
// Use docker exec to provision inside the container (avoids host port mapping issues)
|
||||||
const baseUrl = `http://127.0.0.1:${hostPort}`;
|
const queries = [
|
||||||
|
`CREATE DATABASE IF NOT EXISTS ${dbName}`,
|
||||||
|
`CREATE USER IF NOT EXISTS ${username} IDENTIFIED BY '${password}'`,
|
||||||
|
`GRANT ALL ON ${dbName}.* TO ${username}`,
|
||||||
|
];
|
||||||
|
|
||||||
// Create database
|
for (const query of queries) {
|
||||||
await this.executeQuery(
|
await this.execClickHouseQuery(platformService.containerId, adminCreds, query);
|
||||||
baseUrl,
|
}
|
||||||
adminCreds.username,
|
|
||||||
adminCreds.password,
|
|
||||||
`CREATE DATABASE IF NOT EXISTS ${dbName}`
|
|
||||||
);
|
|
||||||
logger.info(`Created ClickHouse database '${dbName}'`);
|
|
||||||
|
|
||||||
// Create user with access to this database
|
|
||||||
await this.executeQuery(
|
|
||||||
baseUrl,
|
|
||||||
adminCreds.username,
|
|
||||||
adminCreds.password,
|
|
||||||
`CREATE USER IF NOT EXISTS ${username} IDENTIFIED BY '${password}'`
|
|
||||||
);
|
|
||||||
logger.info(`Created ClickHouse user '${username}'`);
|
|
||||||
|
|
||||||
// Grant permissions on the database
|
|
||||||
await this.executeQuery(
|
|
||||||
baseUrl,
|
|
||||||
adminCreds.username,
|
|
||||||
adminCreds.password,
|
|
||||||
`GRANT ALL ON ${dbName}.* TO ${username}`
|
|
||||||
);
|
|
||||||
logger.info(`Granted permissions to user '${username}' on database '${dbName}'`);
|
|
||||||
|
|
||||||
logger.success(`ClickHouse database '${dbName}' provisioned with user '${username}'`);
|
logger.success(`ClickHouse database '${dbName}' provisioned with user '${username}'`);
|
||||||
|
|
||||||
@@ -274,37 +249,11 @@ export class ClickHouseProvider extends BasePlatformServiceProvider {
|
|||||||
|
|
||||||
const adminCreds = await credentialEncryption.decrypt(platformService.adminCredentialsEncrypted);
|
const adminCreds = await credentialEncryption.decrypt(platformService.adminCredentialsEncrypted);
|
||||||
|
|
||||||
// Get container host port for connection from host (overlay network IPs not accessible from host)
|
|
||||||
const hostPort = await this.oneboxRef.docker.getContainerHostPort(platformService.containerId, 8123);
|
|
||||||
if (!hostPort) {
|
|
||||||
throw new Error('Could not get ClickHouse container host port');
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.info(`Deprovisioning ClickHouse database '${resource.resourceName}'...`);
|
logger.info(`Deprovisioning ClickHouse database '${resource.resourceName}'...`);
|
||||||
|
|
||||||
const baseUrl = `http://127.0.0.1:${hostPort}`;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Drop the user
|
await this.execClickHouseQuery(platformService.containerId, adminCreds, `DROP USER IF EXISTS ${credentials.username}`);
|
||||||
try {
|
await this.execClickHouseQuery(platformService.containerId, adminCreds, `DROP DATABASE IF EXISTS ${resource.resourceName}`);
|
||||||
await this.executeQuery(
|
|
||||||
baseUrl,
|
|
||||||
adminCreds.username,
|
|
||||||
adminCreds.password,
|
|
||||||
`DROP USER IF EXISTS ${credentials.username}`
|
|
||||||
);
|
|
||||||
logger.info(`Dropped ClickHouse user '${credentials.username}'`);
|
|
||||||
} catch (e) {
|
|
||||||
logger.warn(`Could not drop ClickHouse user: ${getErrorMessage(e)}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Drop the database
|
|
||||||
await this.executeQuery(
|
|
||||||
baseUrl,
|
|
||||||
adminCreds.username,
|
|
||||||
adminCreds.password,
|
|
||||||
`DROP DATABASE IF EXISTS ${resource.resourceName}`
|
|
||||||
);
|
|
||||||
logger.success(`ClickHouse database '${resource.resourceName}' dropped`);
|
logger.success(`ClickHouse database '${resource.resourceName}' dropped`);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.error(`Failed to deprovision ClickHouse database: ${getErrorMessage(e)}`);
|
logger.error(`Failed to deprovision ClickHouse database: ${getErrorMessage(e)}`);
|
||||||
@@ -313,26 +262,27 @@ export class ClickHouseProvider extends BasePlatformServiceProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute a ClickHouse SQL query via HTTP interface
|
* Execute a ClickHouse SQL query via docker exec inside the container
|
||||||
*/
|
*/
|
||||||
private async executeQuery(
|
private async execClickHouseQuery(
|
||||||
baseUrl: string,
|
containerId: string,
|
||||||
username: string,
|
adminCreds: { username: string; password: string },
|
||||||
password: string,
|
|
||||||
query: string
|
query: string
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
const url = `${baseUrl}/?user=${encodeURIComponent(username)}&password=${encodeURIComponent(password)}`;
|
const result = await this.oneboxRef.docker.execInContainer(
|
||||||
|
containerId,
|
||||||
|
[
|
||||||
|
'clickhouse-client',
|
||||||
|
'--user', adminCreds.username,
|
||||||
|
'--password', adminCreds.password,
|
||||||
|
'--query', query,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
const response = await fetch(url, {
|
if (result.exitCode !== 0) {
|
||||||
method: 'POST',
|
throw new Error(`ClickHouse query failed (exit ${result.exitCode}): ${result.stderr.substring(0, 200)}`);
|
||||||
body: query,
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!response.ok) {
|
|
||||||
const errorText = await response.text();
|
|
||||||
throw new Error(`ClickHouse query failed: ${errorText}`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return await response.text();
|
return result.stdout;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -196,84 +196,28 @@ export class MinioProvider extends BasePlatformServiceProvider {
|
|||||||
const adminCreds = await credentialEncryption.decrypt(platformService.adminCredentialsEncrypted);
|
const adminCreds = await credentialEncryption.decrypt(platformService.adminCredentialsEncrypted);
|
||||||
const containerName = this.getContainerName();
|
const containerName = this.getContainerName();
|
||||||
|
|
||||||
// Get container host port for connection from host (overlay network IPs not accessible from host)
|
// Generate bucket name
|
||||||
const hostPort = await this.oneboxRef.docker.getContainerHostPort(platformService.containerId, 9000);
|
|
||||||
if (!hostPort) {
|
|
||||||
throw new Error('Could not get MinIO container host port');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Generate bucket name and credentials
|
|
||||||
const bucketName = this.generateBucketName(userService.name);
|
const bucketName = this.generateBucketName(userService.name);
|
||||||
const accessKey = credentialEncryption.generateAccessKey(20);
|
|
||||||
const secretKey = credentialEncryption.generateSecretKey(40);
|
|
||||||
|
|
||||||
logger.info(`Provisioning MinIO bucket '${bucketName}' for service '${userService.name}'...`);
|
logger.info(`Provisioning MinIO bucket '${bucketName}' for service '${userService.name}'...`);
|
||||||
|
|
||||||
// Connect to MinIO via localhost and the mapped host port (for provisioning from host)
|
// Use docker exec with mc (MinIO Client) inside the container
|
||||||
const provisioningEndpoint = `http://127.0.0.1:${hostPort}`;
|
// First configure mc alias for local server
|
||||||
|
await this.execMc(platformService.containerId, [
|
||||||
// Import AWS S3 client
|
'alias', 'set', 'local', 'http://localhost:9000',
|
||||||
const { S3Client, CreateBucketCommand, PutBucketPolicyCommand } = await import('npm:@aws-sdk/client-s3@3');
|
adminCreds.username, adminCreds.password,
|
||||||
|
]);
|
||||||
// Create S3 client with admin credentials - connect via host port
|
|
||||||
const s3Client = new S3Client({
|
|
||||||
endpoint: provisioningEndpoint,
|
|
||||||
region: 'us-east-1',
|
|
||||||
credentials: {
|
|
||||||
accessKeyId: adminCreds.username,
|
|
||||||
secretAccessKey: adminCreds.password,
|
|
||||||
},
|
|
||||||
forcePathStyle: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
// Create the bucket
|
// Create the bucket
|
||||||
try {
|
const mbResult = await this.execMc(platformService.containerId, [
|
||||||
await s3Client.send(new CreateBucketCommand({
|
'mb', '--ignore-existing', `local/${bucketName}`,
|
||||||
Bucket: bucketName,
|
]);
|
||||||
}));
|
logger.info(`Created MinIO bucket '${bucketName}'`);
|
||||||
logger.info(`Created MinIO bucket '${bucketName}'`);
|
|
||||||
} catch (e: any) {
|
|
||||||
if (e.name !== 'BucketAlreadyOwnedByYou' && e.name !== 'BucketAlreadyExists') {
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
logger.warn(`Bucket '${bucketName}' already exists`);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create service account/access key using MinIO Admin API
|
// Set bucket policy to allow public read/write (services on the same network use root creds)
|
||||||
// MinIO Admin API requires mc client or direct API calls
|
await this.execMc(platformService.containerId, [
|
||||||
// For simplicity, we'll use root credentials and bucket policy isolation
|
'anonymous', 'set', 'none', `local/${bucketName}`,
|
||||||
// In production, you'd use MinIO's Admin API to create service accounts
|
]);
|
||||||
|
|
||||||
// Set bucket policy to allow access only with this bucket's credentials
|
|
||||||
const bucketPolicy = {
|
|
||||||
Version: '2012-10-17',
|
|
||||||
Statement: [
|
|
||||||
{
|
|
||||||
Effect: 'Allow',
|
|
||||||
Principal: { AWS: ['*'] },
|
|
||||||
Action: ['s3:GetObject', 's3:PutObject', 's3:DeleteObject', 's3:ListBucket'],
|
|
||||||
Resource: [
|
|
||||||
`arn:aws:s3:::${bucketName}`,
|
|
||||||
`arn:aws:s3:::${bucketName}/*`,
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
|
|
||||||
try {
|
|
||||||
await s3Client.send(new PutBucketPolicyCommand({
|
|
||||||
Bucket: bucketName,
|
|
||||||
Policy: JSON.stringify(bucketPolicy),
|
|
||||||
}));
|
|
||||||
logger.info(`Set bucket policy for '${bucketName}'`);
|
|
||||||
} catch (e) {
|
|
||||||
logger.warn(`Could not set bucket policy: ${getErrorMessage(e)}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Note: For proper per-service credentials, MinIO Admin API should be used
|
|
||||||
// For now, we're providing the bucket with root access
|
|
||||||
// TODO: Implement MinIO service account creation
|
|
||||||
logger.warn('Using root credentials for MinIO access. Consider implementing service accounts for production.');
|
|
||||||
|
|
||||||
// Use container name for the endpoint in credentials (user services run in same network)
|
// Use container name for the endpoint in credentials (user services run in same network)
|
||||||
const serviceEndpoint = `http://${containerName}:9000`;
|
const serviceEndpoint = `http://${containerName}:9000`;
|
||||||
@@ -281,7 +225,7 @@ export class MinioProvider extends BasePlatformServiceProvider {
|
|||||||
const credentials: Record<string, string> = {
|
const credentials: Record<string, string> = {
|
||||||
endpoint: serviceEndpoint,
|
endpoint: serviceEndpoint,
|
||||||
bucket: bucketName,
|
bucket: bucketName,
|
||||||
accessKey: adminCreds.username, // Using root for now
|
accessKey: adminCreds.username,
|
||||||
secretKey: adminCreds.password,
|
secretKey: adminCreds.password,
|
||||||
region: 'us-east-1',
|
region: 'us-east-1',
|
||||||
};
|
};
|
||||||
@@ -312,57 +256,37 @@ export class MinioProvider extends BasePlatformServiceProvider {
|
|||||||
|
|
||||||
const adminCreds = await credentialEncryption.decrypt(platformService.adminCredentialsEncrypted);
|
const adminCreds = await credentialEncryption.decrypt(platformService.adminCredentialsEncrypted);
|
||||||
|
|
||||||
// Get container host port for connection from host (overlay network IPs not accessible from host)
|
|
||||||
const hostPort = await this.oneboxRef.docker.getContainerHostPort(platformService.containerId, 9000);
|
|
||||||
if (!hostPort) {
|
|
||||||
throw new Error('Could not get MinIO container host port');
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.info(`Deprovisioning MinIO bucket '${resource.resourceName}'...`);
|
logger.info(`Deprovisioning MinIO bucket '${resource.resourceName}'...`);
|
||||||
|
|
||||||
const { S3Client, DeleteBucketCommand, ListObjectsV2Command, DeleteObjectsCommand } = await import('npm:@aws-sdk/client-s3@3');
|
// Configure mc alias
|
||||||
|
await this.execMc(platformService.containerId, [
|
||||||
const s3Client = new S3Client({
|
'alias', 'set', 'local', 'http://localhost:9000',
|
||||||
endpoint: `http://127.0.0.1:${hostPort}`,
|
adminCreds.username, adminCreds.password,
|
||||||
region: 'us-east-1',
|
]);
|
||||||
credentials: {
|
|
||||||
accessKeyId: adminCreds.username,
|
|
||||||
secretAccessKey: adminCreds.password,
|
|
||||||
},
|
|
||||||
forcePathStyle: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// First, delete all objects in the bucket
|
// Remove all objects and the bucket
|
||||||
let continuationToken: string | undefined;
|
await this.execMc(platformService.containerId, [
|
||||||
do {
|
'rb', '--force', `local/${resource.resourceName}`,
|
||||||
const listResponse = await s3Client.send(new ListObjectsV2Command({
|
]);
|
||||||
Bucket: resource.resourceName,
|
|
||||||
ContinuationToken: continuationToken,
|
|
||||||
}));
|
|
||||||
|
|
||||||
if (listResponse.Contents && listResponse.Contents.length > 0) {
|
|
||||||
await s3Client.send(new DeleteObjectsCommand({
|
|
||||||
Bucket: resource.resourceName,
|
|
||||||
Delete: {
|
|
||||||
Objects: listResponse.Contents.map(obj => ({ Key: obj.Key! })),
|
|
||||||
},
|
|
||||||
}));
|
|
||||||
logger.info(`Deleted ${listResponse.Contents.length} objects from bucket`);
|
|
||||||
}
|
|
||||||
|
|
||||||
continuationToken = listResponse.IsTruncated ? listResponse.NextContinuationToken : undefined;
|
|
||||||
} while (continuationToken);
|
|
||||||
|
|
||||||
// Now delete the bucket
|
|
||||||
await s3Client.send(new DeleteBucketCommand({
|
|
||||||
Bucket: resource.resourceName,
|
|
||||||
}));
|
|
||||||
|
|
||||||
logger.success(`MinIO bucket '${resource.resourceName}' deleted`);
|
logger.success(`MinIO bucket '${resource.resourceName}' deleted`);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.error(`Failed to delete MinIO bucket: ${getErrorMessage(e)}`);
|
logger.error(`Failed to delete MinIO bucket: ${getErrorMessage(e)}`);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute mc (MinIO Client) command inside the container
|
||||||
|
*/
|
||||||
|
private async execMc(
|
||||||
|
containerId: string,
|
||||||
|
args: string[],
|
||||||
|
): Promise<{ stdout: string; stderr: string }> {
|
||||||
|
const result = await this.oneboxRef.docker.execInContainer(containerId, ['mc', ...args]);
|
||||||
|
if (result.exitCode !== 0) {
|
||||||
|
throw new Error(`mc command failed (exit ${result.exitCode}): ${result.stderr.substring(0, 200)}`);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ export class MongoDBProvider extends BasePlatformServiceProvider {
|
|||||||
|
|
||||||
getDefaultConfig(): IPlatformServiceConfig {
|
getDefaultConfig(): IPlatformServiceConfig {
|
||||||
return {
|
return {
|
||||||
image: 'mongo:7',
|
image: 'mongo:4.4',
|
||||||
port: 27017,
|
port: 27017,
|
||||||
volumes: ['/var/lib/onebox/mongodb:/data/db'],
|
volumes: ['/var/lib/onebox/mongodb:/data/db'],
|
||||||
environment: {
|
environment: {
|
||||||
@@ -165,7 +165,7 @@ export class MongoDBProvider extends BasePlatformServiceProvider {
|
|||||||
// This avoids network issues with overlay networks
|
// This avoids network issues with overlay networks
|
||||||
const result = await this.oneboxRef.docker.execInContainer(
|
const result = await this.oneboxRef.docker.execInContainer(
|
||||||
platformService.containerId,
|
platformService.containerId,
|
||||||
['mongosh', '--eval', 'db.adminCommand("ping")', '--username', adminCreds.username, '--password', adminCreds.password, '--authenticationDatabase', 'admin', '--quiet']
|
['mongo', '--eval', 'db.adminCommand("ping")', '--username', adminCreds.username, '--password', adminCreds.password, '--authenticationDatabase', 'admin', '--quiet']
|
||||||
);
|
);
|
||||||
|
|
||||||
if (result.exitCode === 0) {
|
if (result.exitCode === 0) {
|
||||||
@@ -190,12 +190,6 @@ export class MongoDBProvider extends BasePlatformServiceProvider {
|
|||||||
const adminCreds = await credentialEncryption.decrypt(platformService.adminCredentialsEncrypted);
|
const adminCreds = await credentialEncryption.decrypt(platformService.adminCredentialsEncrypted);
|
||||||
const containerName = this.getContainerName();
|
const containerName = this.getContainerName();
|
||||||
|
|
||||||
// Get container host port for connection from host (overlay network IPs not accessible from host)
|
|
||||||
const hostPort = await this.oneboxRef.docker.getContainerHostPort(platformService.containerId, 27017);
|
|
||||||
if (!hostPort) {
|
|
||||||
throw new Error('Could not get MongoDB container host port');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Generate resource names and credentials
|
// Generate resource names and credentials
|
||||||
const dbName = this.generateResourceName(userService.name);
|
const dbName = this.generateResourceName(userService.name);
|
||||||
const username = this.generateResourceName(userService.name);
|
const username = this.generateResourceName(userService.name);
|
||||||
@@ -203,32 +197,40 @@ export class MongoDBProvider extends BasePlatformServiceProvider {
|
|||||||
|
|
||||||
logger.info(`Provisioning MongoDB database '${dbName}' for service '${userService.name}'...`);
|
logger.info(`Provisioning MongoDB database '${dbName}' for service '${userService.name}'...`);
|
||||||
|
|
||||||
// Connect to MongoDB via localhost and the mapped host port
|
// Use docker exec to provision inside the container (avoids host port mapping issues)
|
||||||
const { MongoClient } = await import('npm:mongodb@6');
|
const escapedPassword = password.replace(/'/g, "'\\''");
|
||||||
const adminUri = `mongodb://${adminCreds.username}:${adminCreds.password}@127.0.0.1:${hostPort}/?authSource=admin`;
|
const escapedAdminPassword = adminCreds.password.replace(/'/g, "'\\''");
|
||||||
|
|
||||||
const client = new MongoClient(adminUri);
|
// Create database and user via mongo inside the container
|
||||||
await client.connect();
|
const mongoScript = `
|
||||||
|
db = db.getSiblingDB('${dbName}');
|
||||||
try {
|
db.createCollection('_onebox_init');
|
||||||
// Create the database by switching to it (MongoDB creates on first write)
|
db.createUser({
|
||||||
const db = client.db(dbName);
|
user: '${username}',
|
||||||
|
pwd: '${escapedPassword}',
|
||||||
// Create a collection to ensure the database exists
|
roles: [{ role: 'readWrite', db: '${dbName}' }]
|
||||||
await db.createCollection('_onebox_init');
|
|
||||||
|
|
||||||
// Create user with readWrite access to this database
|
|
||||||
await db.command({
|
|
||||||
createUser: username,
|
|
||||||
pwd: password,
|
|
||||||
roles: [{ role: 'readWrite', db: dbName }],
|
|
||||||
});
|
});
|
||||||
|
print('PROVISION_SUCCESS');
|
||||||
|
`;
|
||||||
|
|
||||||
logger.success(`MongoDB database '${dbName}' provisioned with user '${username}'`);
|
const result = await this.oneboxRef.docker.execInContainer(
|
||||||
} finally {
|
platformService.containerId,
|
||||||
await client.close();
|
[
|
||||||
|
'mongo',
|
||||||
|
'--username', adminCreds.username,
|
||||||
|
'--password', escapedAdminPassword,
|
||||||
|
'--authenticationDatabase', 'admin',
|
||||||
|
'--quiet',
|
||||||
|
'--eval', mongoScript,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
if (result.exitCode !== 0 || !result.stdout.includes('PROVISION_SUCCESS')) {
|
||||||
|
throw new Error(`Failed to provision MongoDB database: exit code ${result.exitCode}, output: ${result.stdout.substring(0, 200)} ${result.stderr.substring(0, 200)}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.success(`MongoDB database '${dbName}' provisioned with user '${username}'`);
|
||||||
|
|
||||||
// Build the credentials and env vars
|
// Build the credentials and env vars
|
||||||
const credentials: Record<string, string> = {
|
const credentials: Record<string, string> = {
|
||||||
host: containerName,
|
host: containerName,
|
||||||
@@ -262,37 +264,33 @@ export class MongoDBProvider extends BasePlatformServiceProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const adminCreds = await credentialEncryption.decrypt(platformService.adminCredentialsEncrypted);
|
const adminCreds = await credentialEncryption.decrypt(platformService.adminCredentialsEncrypted);
|
||||||
|
const escapedAdminPassword = adminCreds.password.replace(/'/g, "'\\''");
|
||||||
// Get container host port for connection from host (overlay network IPs not accessible from host)
|
|
||||||
const hostPort = await this.oneboxRef.docker.getContainerHostPort(platformService.containerId, 27017);
|
|
||||||
if (!hostPort) {
|
|
||||||
throw new Error('Could not get MongoDB container host port');
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.info(`Deprovisioning MongoDB database '${resource.resourceName}'...`);
|
logger.info(`Deprovisioning MongoDB database '${resource.resourceName}'...`);
|
||||||
|
|
||||||
const { MongoClient } = await import('npm:mongodb@6');
|
const mongoScript = `
|
||||||
const adminUri = `mongodb://${adminCreds.username}:${adminCreds.password}@127.0.0.1:${hostPort}/?authSource=admin`;
|
db = db.getSiblingDB('${resource.resourceName}');
|
||||||
|
try { db.dropUser('${credentials.username}'); } catch(e) { print('User drop failed: ' + e); }
|
||||||
|
db.dropDatabase();
|
||||||
|
print('DEPROVISION_SUCCESS');
|
||||||
|
`;
|
||||||
|
|
||||||
const client = new MongoClient(adminUri);
|
const result = await this.oneboxRef.docker.execInContainer(
|
||||||
await client.connect();
|
platformService.containerId,
|
||||||
|
[
|
||||||
|
'mongo',
|
||||||
|
'--username', adminCreds.username,
|
||||||
|
'--password', escapedAdminPassword,
|
||||||
|
'--authenticationDatabase', 'admin',
|
||||||
|
'--quiet',
|
||||||
|
'--eval', mongoScript,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
try {
|
if (result.exitCode !== 0) {
|
||||||
const db = client.db(resource.resourceName);
|
logger.warn(`MongoDB deprovision returned exit code ${result.exitCode}: ${result.stderr.substring(0, 200)}`);
|
||||||
|
|
||||||
// Drop the user
|
|
||||||
try {
|
|
||||||
await db.command({ dropUser: credentials.username });
|
|
||||||
logger.info(`Dropped MongoDB user '${credentials.username}'`);
|
|
||||||
} catch (e) {
|
|
||||||
logger.warn(`Could not drop MongoDB user: ${getErrorMessage(e)}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Drop the database
|
|
||||||
await db.dropDatabase();
|
|
||||||
logger.success(`MongoDB database '${resource.resourceName}' dropped`);
|
|
||||||
} finally {
|
|
||||||
await client.close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.success(`MongoDB database '${resource.resourceName}' dropped`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ export class OneboxServicesManager {
|
|||||||
private oneboxRef: any; // Will be Onebox instance
|
private oneboxRef: any; // Will be Onebox instance
|
||||||
private database: OneboxDatabase;
|
private database: OneboxDatabase;
|
||||||
private docker: OneboxDockerManager;
|
private docker: OneboxDockerManager;
|
||||||
|
private autoUpdateIntervalId: number | null = null;
|
||||||
|
|
||||||
constructor(oneboxRef: any) {
|
constructor(oneboxRef: any) {
|
||||||
this.oneboxRef = oneboxRef;
|
this.oneboxRef = oneboxRef;
|
||||||
@@ -681,7 +682,7 @@ export class OneboxServicesManager {
|
|||||||
*/
|
*/
|
||||||
startAutoUpdateMonitoring(): void {
|
startAutoUpdateMonitoring(): void {
|
||||||
// Check every 30 seconds
|
// Check every 30 seconds
|
||||||
setInterval(async () => {
|
this.autoUpdateIntervalId = setInterval(async () => {
|
||||||
try {
|
try {
|
||||||
await this.checkForRegistryUpdates();
|
await this.checkForRegistryUpdates();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -692,6 +693,17 @@ export class OneboxServicesManager {
|
|||||||
logger.info('Auto-update monitoring started (30s interval)');
|
logger.info('Auto-update monitoring started (30s interval)');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stop auto-update monitoring
|
||||||
|
*/
|
||||||
|
stopAutoUpdateMonitoring(): void {
|
||||||
|
if (this.autoUpdateIntervalId !== null) {
|
||||||
|
clearInterval(this.autoUpdateIntervalId);
|
||||||
|
this.autoUpdateIntervalId = null;
|
||||||
|
logger.debug('Auto-update monitoring stopped');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check all services using onebox registry for updates
|
* Check all services using onebox registry for updates
|
||||||
*/
|
*/
|
||||||
|
|||||||
243
ts/classes/systemd.ts
Normal file
243
ts/classes/systemd.ts
Normal file
@@ -0,0 +1,243 @@
|
|||||||
|
/**
|
||||||
|
* Systemd Service Manager for Onebox
|
||||||
|
*
|
||||||
|
* Handles systemd unit file installation, enabling, starting, stopping,
|
||||||
|
* and status checking. Modeled on nupst's direct systemctl approach —
|
||||||
|
* no external library dependencies.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { logger } from '../logging.ts';
|
||||||
|
import { getErrorMessage } from '../utils/error.ts';
|
||||||
|
|
||||||
|
const SERVICE_NAME = 'onebox';
|
||||||
|
const SERVICE_FILE_PATH = '/etc/systemd/system/onebox.service';
|
||||||
|
|
||||||
|
const SERVICE_UNIT_TEMPLATE = `[Unit]
|
||||||
|
Description=Onebox - Self-hosted container platform
|
||||||
|
After=network-online.target docker.service
|
||||||
|
Wants=network-online.target
|
||||||
|
Requires=docker.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
ExecStart=/usr/local/bin/onebox systemd start-daemon
|
||||||
|
Restart=always
|
||||||
|
RestartSec=10
|
||||||
|
WorkingDirectory=/var/lib/onebox
|
||||||
|
Environment=PATH=/usr/bin:/usr/local/bin
|
||||||
|
Environment=HOME=/root
|
||||||
|
Environment=DENO_DIR=/root/.cache/deno
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
`;
|
||||||
|
|
||||||
|
export class OneboxSystemd {
|
||||||
|
/**
|
||||||
|
* Install and enable the systemd service
|
||||||
|
*/
|
||||||
|
async enable(): Promise<void> {
|
||||||
|
try {
|
||||||
|
// Ensure Docker is installed before writing unit file (it requires docker.service)
|
||||||
|
await this.ensureDocker();
|
||||||
|
|
||||||
|
// Write the unit file
|
||||||
|
logger.info('Writing systemd unit file...');
|
||||||
|
await Deno.writeTextFile(SERVICE_FILE_PATH, SERVICE_UNIT_TEMPLATE);
|
||||||
|
logger.info(`Unit file written to ${SERVICE_FILE_PATH}`);
|
||||||
|
|
||||||
|
// Reload systemd daemon
|
||||||
|
await this.runSystemctl(['daemon-reload']);
|
||||||
|
|
||||||
|
// Enable the service
|
||||||
|
const result = await this.runSystemctl(['enable', `${SERVICE_NAME}.service`]);
|
||||||
|
if (!result.success) {
|
||||||
|
throw new Error(`Failed to enable service: ${result.stderr}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.success('Onebox systemd service enabled');
|
||||||
|
logger.info('Start with: onebox systemd start');
|
||||||
|
} catch (error) {
|
||||||
|
logger.error(`Failed to enable service: ${getErrorMessage(error)}`);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stop, disable, and remove the systemd service
|
||||||
|
*/
|
||||||
|
async disable(): Promise<void> {
|
||||||
|
try {
|
||||||
|
// Stop the service (ignore errors if not running)
|
||||||
|
await this.runSystemctl(['stop', `${SERVICE_NAME}.service`]);
|
||||||
|
|
||||||
|
// Disable the service
|
||||||
|
await this.runSystemctl(['disable', `${SERVICE_NAME}.service`]);
|
||||||
|
|
||||||
|
// Remove the unit file
|
||||||
|
try {
|
||||||
|
await Deno.remove(SERVICE_FILE_PATH);
|
||||||
|
logger.info(`Removed ${SERVICE_FILE_PATH}`);
|
||||||
|
} catch {
|
||||||
|
// File might not exist
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reload systemd daemon
|
||||||
|
await this.runSystemctl(['daemon-reload']);
|
||||||
|
|
||||||
|
logger.success('Onebox systemd service disabled and removed');
|
||||||
|
} catch (error) {
|
||||||
|
logger.error(`Failed to disable service: ${getErrorMessage(error)}`);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Start the service via systemctl
|
||||||
|
*/
|
||||||
|
async start(): Promise<void> {
|
||||||
|
const result = await this.runSystemctl(['start', `${SERVICE_NAME}.service`]);
|
||||||
|
if (!result.success) {
|
||||||
|
logger.error(`Failed to start service: ${result.stderr}`);
|
||||||
|
throw new Error(`Failed to start onebox service`);
|
||||||
|
}
|
||||||
|
logger.success('Onebox service started');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stop the service via systemctl
|
||||||
|
*/
|
||||||
|
async stop(): Promise<void> {
|
||||||
|
const result = await this.runSystemctl(['stop', `${SERVICE_NAME}.service`]);
|
||||||
|
if (!result.success) {
|
||||||
|
logger.error(`Failed to stop service: ${result.stderr}`);
|
||||||
|
throw new Error(`Failed to stop onebox service`);
|
||||||
|
}
|
||||||
|
logger.success('Onebox service stopped');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get and display service status
|
||||||
|
*/
|
||||||
|
async getStatus(): Promise<string> {
|
||||||
|
const result = await this.runSystemctl(['status', `${SERVICE_NAME}.service`]);
|
||||||
|
const output = result.stdout;
|
||||||
|
|
||||||
|
let status: string;
|
||||||
|
if (output.includes('active (running)')) {
|
||||||
|
status = 'running';
|
||||||
|
} else if (output.includes('inactive') || output.includes('dead')) {
|
||||||
|
status = 'stopped';
|
||||||
|
} else if (output.includes('failed')) {
|
||||||
|
status = 'failed';
|
||||||
|
} else if (!result.success && result.stderr.includes('could not be found')) {
|
||||||
|
status = 'not-installed';
|
||||||
|
} else {
|
||||||
|
status = 'unknown';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Print the raw systemctl output for full details
|
||||||
|
if (output.trim()) {
|
||||||
|
console.log(output);
|
||||||
|
}
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show service logs via journalctl
|
||||||
|
*/
|
||||||
|
async showLogs(): Promise<void> {
|
||||||
|
const cmd = new Deno.Command('journalctl', {
|
||||||
|
args: ['-u', `${SERVICE_NAME}.service`, '-f'],
|
||||||
|
stdout: 'inherit',
|
||||||
|
stderr: 'inherit',
|
||||||
|
});
|
||||||
|
await cmd.output();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the service unit file is installed
|
||||||
|
*/
|
||||||
|
async isInstalled(): Promise<boolean> {
|
||||||
|
try {
|
||||||
|
await Deno.stat(SERVICE_FILE_PATH);
|
||||||
|
return true;
|
||||||
|
} catch {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ensure Docker is installed, installing it if necessary
|
||||||
|
*/
|
||||||
|
private async ensureDocker(): Promise<void> {
|
||||||
|
try {
|
||||||
|
const cmd = new Deno.Command('docker', {
|
||||||
|
args: ['--version'],
|
||||||
|
stdout: 'piped',
|
||||||
|
stderr: 'piped',
|
||||||
|
});
|
||||||
|
const result = await cmd.output();
|
||||||
|
if (result.success) {
|
||||||
|
const version = new TextDecoder().decode(result.stdout).trim();
|
||||||
|
logger.info(`Docker found: ${version}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
// docker command not found
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.info('Docker not found. Installing Docker...');
|
||||||
|
const installCmd = new Deno.Command('bash', {
|
||||||
|
args: ['-c', 'curl -fsSL https://get.docker.com | sh'],
|
||||||
|
stdin: 'inherit',
|
||||||
|
stdout: 'inherit',
|
||||||
|
stderr: 'inherit',
|
||||||
|
});
|
||||||
|
const installResult = await installCmd.output();
|
||||||
|
if (!installResult.success) {
|
||||||
|
throw new Error('Failed to install Docker. Please install it manually: curl -fsSL https://get.docker.com | sh');
|
||||||
|
}
|
||||||
|
logger.success('Docker installed successfully');
|
||||||
|
|
||||||
|
// Initialize Docker Swarm
|
||||||
|
logger.info('Initializing Docker Swarm...');
|
||||||
|
const swarmCmd = new Deno.Command('docker', {
|
||||||
|
args: ['swarm', 'init'],
|
||||||
|
stdout: 'piped',
|
||||||
|
stderr: 'piped',
|
||||||
|
});
|
||||||
|
const swarmResult = await swarmCmd.output();
|
||||||
|
if (swarmResult.success) {
|
||||||
|
logger.success('Docker Swarm initialized');
|
||||||
|
} else {
|
||||||
|
const stderr = new TextDecoder().decode(swarmResult.stderr);
|
||||||
|
if (stderr.includes('already part of a swarm')) {
|
||||||
|
logger.info('Docker Swarm already initialized');
|
||||||
|
} else {
|
||||||
|
logger.warn(`Docker Swarm init warning: ${stderr.trim()}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run a systemctl command and return results
|
||||||
|
*/
|
||||||
|
private async runSystemctl(
|
||||||
|
args: string[]
|
||||||
|
): Promise<{ success: boolean; stdout: string; stderr: string }> {
|
||||||
|
const cmd = new Deno.Command('systemctl', {
|
||||||
|
args,
|
||||||
|
stdout: 'piped',
|
||||||
|
stderr: 'piped',
|
||||||
|
});
|
||||||
|
|
||||||
|
const result = await cmd.output();
|
||||||
|
return {
|
||||||
|
success: result.success,
|
||||||
|
stdout: new TextDecoder().decode(result.stdout),
|
||||||
|
stderr: new TextDecoder().decode(result.stderr),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
89
ts/cli.ts
89
ts/cli.ts
@@ -7,6 +7,7 @@ import { projectInfo } from './info.ts';
|
|||||||
import { getErrorMessage } from './utils/error.ts';
|
import { getErrorMessage } from './utils/error.ts';
|
||||||
import { Onebox } from './classes/onebox.ts';
|
import { Onebox } from './classes/onebox.ts';
|
||||||
import { OneboxDaemon } from './classes/daemon.ts';
|
import { OneboxDaemon } from './classes/daemon.ts';
|
||||||
|
import { OneboxSystemd } from './classes/systemd.ts';
|
||||||
|
|
||||||
export async function runCli(): Promise<void> {
|
export async function runCli(): Promise<void> {
|
||||||
const args = Deno.args;
|
const args = Deno.args;
|
||||||
@@ -25,6 +26,19 @@ export async function runCli(): Promise<void> {
|
|||||||
const subcommand = args[1];
|
const subcommand = args[1];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// === LIGHTWEIGHT COMMANDS (no init()) ===
|
||||||
|
if (command === 'systemd') {
|
||||||
|
await handleSystemdCommand(subcommand, args.slice(2));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (command === 'upgrade') {
|
||||||
|
await handleUpgradeCommand();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// === HEAVY COMMANDS (require full init()) ===
|
||||||
|
|
||||||
// Server command has special handling (doesn't shut down)
|
// Server command has special handling (doesn't shut down)
|
||||||
if (command === 'server') {
|
if (command === 'server') {
|
||||||
const onebox = new Onebox();
|
const onebox = new Onebox();
|
||||||
@@ -60,10 +74,6 @@ export async function runCli(): Promise<void> {
|
|||||||
await handleNginxCommand(onebox, subcommand, args.slice(2));
|
await handleNginxCommand(onebox, subcommand, args.slice(2));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'daemon':
|
|
||||||
await handleDaemonCommand(onebox, subcommand, args.slice(2));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'config':
|
case 'config':
|
||||||
await handleConfigCommand(onebox, subcommand, args.slice(2));
|
await handleConfigCommand(onebox, subcommand, args.slice(2));
|
||||||
break;
|
break;
|
||||||
@@ -72,10 +82,6 @@ export async function runCli(): Promise<void> {
|
|||||||
await handleStatusCommand(onebox);
|
await handleStatusCommand(onebox);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'upgrade':
|
|
||||||
await handleUpgradeCommand();
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
logger.error(`Unknown command: ${command}`);
|
logger.error(`Unknown command: ${command}`);
|
||||||
printHelp();
|
printHelp();
|
||||||
@@ -282,7 +288,7 @@ async function handleServerCommand(onebox: Onebox, args: string[]) {
|
|||||||
await OneboxDaemon.ensureNoDaemon();
|
await OneboxDaemon.ensureNoDaemon();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error('Cannot start in ephemeral mode: Daemon is already running');
|
logger.error('Cannot start in ephemeral mode: Daemon is already running');
|
||||||
logger.info('Stop the daemon first: onebox daemon stop');
|
logger.info('Stop the daemon first: onebox systemd stop');
|
||||||
logger.info('Or run without --ephemeral to use the existing daemon');
|
logger.info('Or run without --ephemeral to use the existing daemon');
|
||||||
Deno.exit(1);
|
Deno.exit(1);
|
||||||
}
|
}
|
||||||
@@ -326,39 +332,49 @@ async function handleServerCommand(onebox: Onebox, args: string[]) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Daemon commands
|
// Systemd service commands (lightweight — no Onebox init)
|
||||||
async function handleDaemonCommand(onebox: Onebox, subcommand: string, _args: string[]) {
|
async function handleSystemdCommand(subcommand: string, _args: string[]) {
|
||||||
|
const systemd = new OneboxSystemd();
|
||||||
|
|
||||||
switch (subcommand) {
|
switch (subcommand) {
|
||||||
case 'install':
|
case 'enable':
|
||||||
await onebox.daemon.installService();
|
await systemd.enable();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'disable':
|
||||||
|
await systemd.disable();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'start':
|
case 'start':
|
||||||
await onebox.startDaemon();
|
await systemd.start();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'stop':
|
case 'stop':
|
||||||
await onebox.stopDaemon();
|
await systemd.stop();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'logs': {
|
case 'status': {
|
||||||
const command = new Deno.Command('journalctl', {
|
const status = await systemd.getStatus();
|
||||||
args: ['-u', 'smartdaemon_onebox', '-f'],
|
logger.info(`Service status: ${status}`);
|
||||||
stdout: 'inherit',
|
|
||||||
stderr: 'inherit',
|
|
||||||
});
|
|
||||||
await command.output();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'status': {
|
case 'logs':
|
||||||
const status = await onebox.daemon.getServiceStatus();
|
await systemd.showLogs();
|
||||||
logger.info(`Daemon status: ${status}`);
|
break;
|
||||||
|
|
||||||
|
case 'start-daemon': {
|
||||||
|
// This is what systemd's ExecStart calls — full init + daemon loop
|
||||||
|
const onebox = new Onebox();
|
||||||
|
await onebox.init();
|
||||||
|
await onebox.daemon.start();
|
||||||
|
// start() blocks (keepAlive loop) until SIGTERM/SIGINT
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
logger.error(`Unknown daemon subcommand: ${subcommand}`);
|
logger.error(`Unknown systemd subcommand: ${subcommand}`);
|
||||||
|
logger.info('Available: enable, disable, start, stop, status, logs');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -506,11 +522,12 @@ Commands:
|
|||||||
nginx test
|
nginx test
|
||||||
nginx status
|
nginx status
|
||||||
|
|
||||||
daemon install
|
systemd enable Install and enable systemd service
|
||||||
daemon start
|
systemd disable Stop, disable, and remove systemd service
|
||||||
daemon stop
|
systemd start Start onebox via systemctl
|
||||||
daemon logs
|
systemd stop Stop onebox via systemctl
|
||||||
daemon status
|
systemd status Show systemd service status
|
||||||
|
systemd logs Follow service logs (journalctl)
|
||||||
|
|
||||||
config show
|
config show
|
||||||
config set <key> <value>
|
config set <key> <value>
|
||||||
@@ -530,15 +547,15 @@ Development Workflow:
|
|||||||
onebox service add ... # In another terminal
|
onebox service add ... # In another terminal
|
||||||
|
|
||||||
Production Workflow:
|
Production Workflow:
|
||||||
onebox daemon install # Install systemd service
|
onebox systemd enable # Install and enable systemd service
|
||||||
onebox daemon start # Start daemon
|
onebox systemd start # Start via systemctl
|
||||||
onebox service add ... # CLI uses daemon
|
onebox service add ... # CLI manages services
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
onebox server --ephemeral # Start dev server
|
onebox server --ephemeral # Start dev server
|
||||||
onebox service add myapp --image nginx:latest --domain app.example.com --port 80
|
onebox service add myapp --image nginx:latest --domain app.example.com --port 80
|
||||||
onebox registry add --url registry.example.com --username user --password pass
|
onebox registry add --url registry.example.com --username user --password pass
|
||||||
onebox daemon install
|
onebox systemd enable
|
||||||
onebox daemon start
|
onebox systemd start
|
||||||
`);
|
`);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ export { OneboxReverseProxy } from './classes/reverseproxy.ts';
|
|||||||
export { OneboxDnsManager } from './classes/dns.ts';
|
export { OneboxDnsManager } from './classes/dns.ts';
|
||||||
export { OneboxSslManager } from './classes/ssl.ts';
|
export { OneboxSslManager } from './classes/ssl.ts';
|
||||||
export { OneboxDaemon } from './classes/daemon.ts';
|
export { OneboxDaemon } from './classes/daemon.ts';
|
||||||
|
export { OneboxSystemd } from './classes/systemd.ts';
|
||||||
export { OneboxHttpServer } from './classes/httpserver.ts';
|
export { OneboxHttpServer } from './classes/httpserver.ts';
|
||||||
export { OneboxApiClient } from './classes/apiclient.ts';
|
export { OneboxApiClient } from './classes/apiclient.ts';
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ export class OpsServer {
|
|||||||
public schedulesHandler!: handlers.SchedulesHandler;
|
public schedulesHandler!: handlers.SchedulesHandler;
|
||||||
public settingsHandler!: handlers.SettingsHandler;
|
public settingsHandler!: handlers.SettingsHandler;
|
||||||
public logsHandler!: handlers.LogsHandler;
|
public logsHandler!: handlers.LogsHandler;
|
||||||
|
public workspaceHandler!: handlers.WorkspaceHandler;
|
||||||
|
|
||||||
constructor(oneboxRef: Onebox) {
|
constructor(oneboxRef: Onebox) {
|
||||||
this.oneboxRef = oneboxRef;
|
this.oneboxRef = oneboxRef;
|
||||||
@@ -63,6 +64,7 @@ export class OpsServer {
|
|||||||
this.schedulesHandler = new handlers.SchedulesHandler(this);
|
this.schedulesHandler = new handlers.SchedulesHandler(this);
|
||||||
this.settingsHandler = new handlers.SettingsHandler(this);
|
this.settingsHandler = new handlers.SettingsHandler(this);
|
||||||
this.logsHandler = new handlers.LogsHandler(this);
|
this.logsHandler = new handlers.LogsHandler(this);
|
||||||
|
this.workspaceHandler = new handlers.WorkspaceHandler(this);
|
||||||
|
|
||||||
logger.success('OpsServer TypedRequest handlers initialized');
|
logger.success('OpsServer TypedRequest handlers initialized');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,3 +11,4 @@ export * from './backups.handler.ts';
|
|||||||
export * from './schedules.handler.ts';
|
export * from './schedules.handler.ts';
|
||||||
export * from './settings.handler.ts';
|
export * from './settings.handler.ts';
|
||||||
export * from './logs.handler.ts';
|
export * from './logs.handler.ts';
|
||||||
|
export * from './workspace.handler.ts';
|
||||||
|
|||||||
@@ -6,10 +6,128 @@ import { requireValidIdentity } from '../helpers/guards.ts';
|
|||||||
|
|
||||||
export class PlatformHandler {
|
export class PlatformHandler {
|
||||||
public typedrouter = new plugins.typedrequest.TypedRouter();
|
public typedrouter = new plugins.typedrequest.TypedRouter();
|
||||||
|
private activeLogStreams = new Map<string, boolean>();
|
||||||
|
|
||||||
constructor(private opsServerRef: OpsServer) {
|
constructor(private opsServerRef: OpsServer) {
|
||||||
this.opsServerRef.typedrouter.addTypedRouter(this.typedrouter);
|
this.opsServerRef.typedrouter.addTypedRouter(this.typedrouter);
|
||||||
this.registerHandlers();
|
this.registerHandlers();
|
||||||
|
this.startLogStreaming();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Start streaming logs from all running containers (platform + user services)
|
||||||
|
* and push new entries to connected dashboard clients via TypedSocket
|
||||||
|
*/
|
||||||
|
private async startLogStreaming(): Promise<void> {
|
||||||
|
const checkAndStream = async () => {
|
||||||
|
// Stream platform service containers
|
||||||
|
const platformServices = this.opsServerRef.oneboxRef.database.getAllPlatformServices();
|
||||||
|
for (const service of platformServices) {
|
||||||
|
if (service.status !== 'running' || !service.containerId) continue;
|
||||||
|
const key = `platform:${service.type}`;
|
||||||
|
if (this.activeLogStreams.has(key)) continue;
|
||||||
|
|
||||||
|
this.activeLogStreams.set(key, true);
|
||||||
|
logger.info(`Starting log stream for platform service: ${service.type}`);
|
||||||
|
|
||||||
|
try {
|
||||||
|
await this.opsServerRef.oneboxRef.docker.streamContainerLogs(
|
||||||
|
service.containerId,
|
||||||
|
(line: string, isError: boolean) => {
|
||||||
|
this.pushPlatformLogToClients(service.type as interfaces.data.TPlatformServiceType, line, isError);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
} catch (err) {
|
||||||
|
logger.warn(`Log stream failed for ${service.type}: ${(err as Error).message}`);
|
||||||
|
this.activeLogStreams.delete(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Stream user service containers
|
||||||
|
const userServices = this.opsServerRef.oneboxRef.services.listServices();
|
||||||
|
for (const service of userServices) {
|
||||||
|
if (service.status !== 'running' || !service.containerID) continue;
|
||||||
|
const key = `service:${service.name}`;
|
||||||
|
if (this.activeLogStreams.has(key)) continue;
|
||||||
|
|
||||||
|
this.activeLogStreams.set(key, true);
|
||||||
|
logger.info(`Starting log stream for user service: ${service.name}`);
|
||||||
|
|
||||||
|
try {
|
||||||
|
await this.opsServerRef.oneboxRef.docker.streamContainerLogs(
|
||||||
|
service.containerID,
|
||||||
|
(line: string, isError: boolean) => {
|
||||||
|
this.pushServiceLogToClients(service.name, line, isError);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
} catch (err) {
|
||||||
|
logger.warn(`Log stream failed for ${service.name}: ${(err as Error).message}`);
|
||||||
|
this.activeLogStreams.delete(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Initial check after a short delay (let services start first)
|
||||||
|
setTimeout(() => checkAndStream(), 5000);
|
||||||
|
// Re-check periodically for newly started services
|
||||||
|
setInterval(() => checkAndStream(), 15000);
|
||||||
|
}
|
||||||
|
|
||||||
|
private parseLogLine(line: string, isError: boolean): { timestamp: string; level: string; message: string } {
|
||||||
|
const tsMatch = line.match(/^(\d{4}-\d{2}-\d{2}T[\d:.]+Z?)\s+(.*)/);
|
||||||
|
const timestamp = tsMatch ? tsMatch[1] : new Date().toISOString();
|
||||||
|
const message = tsMatch ? tsMatch[2] : line;
|
||||||
|
const msgLower = message.toLowerCase();
|
||||||
|
const level = isError || msgLower.includes('error') || msgLower.includes('fatal')
|
||||||
|
? 'error'
|
||||||
|
: msgLower.includes('warn')
|
||||||
|
? 'warn'
|
||||||
|
: 'info';
|
||||||
|
return { timestamp, level, message };
|
||||||
|
}
|
||||||
|
|
||||||
|
private pushPlatformLogToClients(
|
||||||
|
serviceType: interfaces.data.TPlatformServiceType,
|
||||||
|
line: string,
|
||||||
|
isError: boolean,
|
||||||
|
): void {
|
||||||
|
const typedsocket = (this.opsServerRef.server as any)?.typedserver?.typedsocket;
|
||||||
|
if (!typedsocket) return;
|
||||||
|
|
||||||
|
const entry = this.parseLogLine(line, isError);
|
||||||
|
|
||||||
|
typedsocket.findAllTargetConnectionsByTag('role', 'ops_dashboard')
|
||||||
|
.then((connections: any[]) => {
|
||||||
|
for (const conn of connections) {
|
||||||
|
typedsocket.createTypedRequest<interfaces.requests.IReq_PushPlatformServiceLog>(
|
||||||
|
'pushPlatformServiceLog',
|
||||||
|
conn,
|
||||||
|
).fire({ serviceType, entry }).catch(() => {});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
}
|
||||||
|
|
||||||
|
private pushServiceLogToClients(
|
||||||
|
serviceName: string,
|
||||||
|
line: string,
|
||||||
|
isError: boolean,
|
||||||
|
): void {
|
||||||
|
const typedsocket = (this.opsServerRef.server as any)?.typedserver?.typedsocket;
|
||||||
|
if (!typedsocket) return;
|
||||||
|
|
||||||
|
const entry = this.parseLogLine(line, isError);
|
||||||
|
|
||||||
|
typedsocket.findAllTargetConnectionsByTag('role', 'ops_dashboard')
|
||||||
|
.then((connections: any[]) => {
|
||||||
|
for (const conn of connections) {
|
||||||
|
typedsocket.createTypedRequest<interfaces.requests.IReq_PushServiceLog>(
|
||||||
|
'pushServiceLog',
|
||||||
|
conn,
|
||||||
|
).fire({ serviceName, entry }).catch(() => {});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
}
|
}
|
||||||
|
|
||||||
private registerHandlers(): void {
|
private registerHandlers(): void {
|
||||||
@@ -165,5 +283,47 @@ export class PlatformHandler {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Get platform service logs
|
||||||
|
this.typedrouter.addTypedHandler(
|
||||||
|
new plugins.typedrequest.TypedHandler<interfaces.requests.IReq_GetPlatformServiceLogs>(
|
||||||
|
'getPlatformServiceLogs',
|
||||||
|
async (dataArg) => {
|
||||||
|
await requireValidIdentity(this.opsServerRef.adminHandler, dataArg);
|
||||||
|
const service = this.opsServerRef.oneboxRef.database.getPlatformServiceByType(dataArg.serviceType);
|
||||||
|
if (!service || !service.containerId) {
|
||||||
|
throw new plugins.typedrequest.TypedResponseError('Platform service has no container');
|
||||||
|
}
|
||||||
|
|
||||||
|
const tail = dataArg.tail || 100;
|
||||||
|
const rawLogs = await this.opsServerRef.oneboxRef.docker.getContainerLogs(service.containerId, tail);
|
||||||
|
|
||||||
|
// Parse raw log output into structured entries
|
||||||
|
const logLines = (rawLogs.stdout + rawLogs.stderr)
|
||||||
|
.split('\n')
|
||||||
|
.filter((line: string) => line.trim());
|
||||||
|
|
||||||
|
const logs = logLines.map((line: string, index: number) => {
|
||||||
|
// Try to parse Docker timestamp from beginning of line
|
||||||
|
const tsMatch = line.match(/^(\d{4}-\d{2}-\d{2}T[\d:.]+Z?)\s+(.*)/);
|
||||||
|
const timestamp = tsMatch ? new Date(tsMatch[1]).getTime() : Date.now();
|
||||||
|
const message = tsMatch ? tsMatch[2] : line;
|
||||||
|
const msgLower = message.toLowerCase();
|
||||||
|
const isError = msgLower.includes('error') || msgLower.includes('fatal');
|
||||||
|
const isWarn = msgLower.includes('warn');
|
||||||
|
return {
|
||||||
|
id: index,
|
||||||
|
serviceId: 0,
|
||||||
|
timestamp,
|
||||||
|
message,
|
||||||
|
level: (isError ? 'error' : isWarn ? 'warn' : 'info') as 'info' | 'warn' | 'error' | 'debug',
|
||||||
|
source: 'stdout' as const,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
return { logs };
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
181
ts/opsserver/handlers/workspace.handler.ts
Normal file
181
ts/opsserver/handlers/workspace.handler.ts
Normal file
@@ -0,0 +1,181 @@
|
|||||||
|
import * as plugins from '../../plugins.ts';
|
||||||
|
import { logger } from '../../logging.ts';
|
||||||
|
import type { OpsServer } from '../classes.opsserver.ts';
|
||||||
|
import * as interfaces from '../../../ts_interfaces/index.ts';
|
||||||
|
import { requireValidIdentity } from '../helpers/guards.ts';
|
||||||
|
import { getErrorMessage } from '../../utils/error.ts';
|
||||||
|
|
||||||
|
export class WorkspaceHandler {
|
||||||
|
public typedrouter = new plugins.typedrequest.TypedRouter();
|
||||||
|
|
||||||
|
constructor(private opsServerRef: OpsServer) {
|
||||||
|
this.opsServerRef.typedrouter.addTypedRouter(this.typedrouter);
|
||||||
|
this.registerHandlers();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resolve a service name to a container ID (handling Swarm service IDs)
|
||||||
|
*/
|
||||||
|
private async resolveContainerId(serviceName: string): Promise<string> {
|
||||||
|
const service = this.opsServerRef.oneboxRef.services.getService(serviceName);
|
||||||
|
if (!service || !service.containerID) {
|
||||||
|
throw new plugins.typedrequest.TypedResponseError(`Service not found or has no container: ${serviceName}`);
|
||||||
|
}
|
||||||
|
return service.containerID;
|
||||||
|
}
|
||||||
|
|
||||||
|
private registerHandlers(): void {
|
||||||
|
// Read file from container
|
||||||
|
this.typedrouter.addTypedHandler(
|
||||||
|
new plugins.typedrequest.TypedHandler<interfaces.requests.IReq_WorkspaceReadFile>(
|
||||||
|
'workspaceReadFile',
|
||||||
|
async (dataArg) => {
|
||||||
|
await requireValidIdentity(this.opsServerRef.adminHandler, dataArg);
|
||||||
|
const containerId = await this.resolveContainerId(dataArg.serviceName);
|
||||||
|
const result = await this.opsServerRef.oneboxRef.docker.execInContainer(
|
||||||
|
containerId,
|
||||||
|
['cat', dataArg.path],
|
||||||
|
);
|
||||||
|
if (result.exitCode !== 0) {
|
||||||
|
throw new plugins.typedrequest.TypedResponseError(`Failed to read file: ${result.stderr || 'File not found'}`);
|
||||||
|
}
|
||||||
|
return { content: result.stdout };
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
// Write file to container
|
||||||
|
this.typedrouter.addTypedHandler(
|
||||||
|
new plugins.typedrequest.TypedHandler<interfaces.requests.IReq_WorkspaceWriteFile>(
|
||||||
|
'workspaceWriteFile',
|
||||||
|
async (dataArg) => {
|
||||||
|
await requireValidIdentity(this.opsServerRef.adminHandler, dataArg);
|
||||||
|
const containerId = await this.resolveContainerId(dataArg.serviceName);
|
||||||
|
// Use sh -c with printf to write content (handles special characters)
|
||||||
|
const escaped = dataArg.content.replace(/'/g, "'\\''");
|
||||||
|
const result = await this.opsServerRef.oneboxRef.docker.execInContainer(
|
||||||
|
containerId,
|
||||||
|
['sh', '-c', `printf '%s' '${escaped}' > ${dataArg.path}`],
|
||||||
|
);
|
||||||
|
if (result.exitCode !== 0) {
|
||||||
|
throw new plugins.typedrequest.TypedResponseError(`Failed to write file: ${result.stderr}`);
|
||||||
|
}
|
||||||
|
return {};
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
// Read directory from container
|
||||||
|
this.typedrouter.addTypedHandler(
|
||||||
|
new plugins.typedrequest.TypedHandler<interfaces.requests.IReq_WorkspaceReadDir>(
|
||||||
|
'workspaceReadDir',
|
||||||
|
async (dataArg) => {
|
||||||
|
await requireValidIdentity(this.opsServerRef.adminHandler, dataArg);
|
||||||
|
const containerId = await this.resolveContainerId(dataArg.serviceName);
|
||||||
|
// Use ls with -1 -F to get entries with type indicators (/ for dirs)
|
||||||
|
const result = await this.opsServerRef.oneboxRef.docker.execInContainer(
|
||||||
|
containerId,
|
||||||
|
['ls', '-1', '-F', dataArg.path],
|
||||||
|
);
|
||||||
|
if (result.exitCode !== 0) {
|
||||||
|
throw new plugins.typedrequest.TypedResponseError(`Failed to read directory: ${result.stderr}`);
|
||||||
|
}
|
||||||
|
const entries = result.stdout
|
||||||
|
.split('\n')
|
||||||
|
.filter((line) => line.trim())
|
||||||
|
.map((line) => {
|
||||||
|
const isDir = line.endsWith('/');
|
||||||
|
const name = isDir ? line.slice(0, -1) : line.replace(/[*@=|]$/, '');
|
||||||
|
const basePath = dataArg.path.endsWith('/') ? dataArg.path : dataArg.path + '/';
|
||||||
|
return {
|
||||||
|
type: (isDir ? 'directory' : 'file') as 'file' | 'directory',
|
||||||
|
name,
|
||||||
|
path: basePath + name,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
return { entries };
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
// Create directory in container
|
||||||
|
this.typedrouter.addTypedHandler(
|
||||||
|
new plugins.typedrequest.TypedHandler<interfaces.requests.IReq_WorkspaceMkdir>(
|
||||||
|
'workspaceMkdir',
|
||||||
|
async (dataArg) => {
|
||||||
|
await requireValidIdentity(this.opsServerRef.adminHandler, dataArg);
|
||||||
|
const containerId = await this.resolveContainerId(dataArg.serviceName);
|
||||||
|
const result = await this.opsServerRef.oneboxRef.docker.execInContainer(
|
||||||
|
containerId,
|
||||||
|
['mkdir', '-p', dataArg.path],
|
||||||
|
);
|
||||||
|
if (result.exitCode !== 0) {
|
||||||
|
throw new plugins.typedrequest.TypedResponseError(`Failed to create directory: ${result.stderr}`);
|
||||||
|
}
|
||||||
|
return {};
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
// Remove file/directory from container
|
||||||
|
this.typedrouter.addTypedHandler(
|
||||||
|
new plugins.typedrequest.TypedHandler<interfaces.requests.IReq_WorkspaceRm>(
|
||||||
|
'workspaceRm',
|
||||||
|
async (dataArg) => {
|
||||||
|
await requireValidIdentity(this.opsServerRef.adminHandler, dataArg);
|
||||||
|
const containerId = await this.resolveContainerId(dataArg.serviceName);
|
||||||
|
const args = dataArg.recursive ? ['rm', '-rf', dataArg.path] : ['rm', '-f', dataArg.path];
|
||||||
|
const result = await this.opsServerRef.oneboxRef.docker.execInContainer(
|
||||||
|
containerId,
|
||||||
|
args,
|
||||||
|
);
|
||||||
|
if (result.exitCode !== 0) {
|
||||||
|
throw new plugins.typedrequest.TypedResponseError(`Failed to remove: ${result.stderr}`);
|
||||||
|
}
|
||||||
|
return {};
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
// Check if path exists in container
|
||||||
|
this.typedrouter.addTypedHandler(
|
||||||
|
new plugins.typedrequest.TypedHandler<interfaces.requests.IReq_WorkspaceExists>(
|
||||||
|
'workspaceExists',
|
||||||
|
async (dataArg) => {
|
||||||
|
await requireValidIdentity(this.opsServerRef.adminHandler, dataArg);
|
||||||
|
const containerId = await this.resolveContainerId(dataArg.serviceName);
|
||||||
|
const result = await this.opsServerRef.oneboxRef.docker.execInContainer(
|
||||||
|
containerId,
|
||||||
|
['test', '-e', dataArg.path],
|
||||||
|
);
|
||||||
|
return { exists: result.exitCode === 0 };
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
// Execute a command in the container (non-interactive)
|
||||||
|
this.typedrouter.addTypedHandler(
|
||||||
|
new plugins.typedrequest.TypedHandler<interfaces.requests.IReq_WorkspaceExec>(
|
||||||
|
'workspaceExec',
|
||||||
|
async (dataArg) => {
|
||||||
|
await requireValidIdentity(this.opsServerRef.adminHandler, dataArg);
|
||||||
|
const containerId = await this.resolveContainerId(dataArg.serviceName);
|
||||||
|
const cmd = dataArg.args
|
||||||
|
? [dataArg.command, ...dataArg.args]
|
||||||
|
: [dataArg.command];
|
||||||
|
const result = await this.opsServerRef.oneboxRef.docker.execInContainer(
|
||||||
|
containerId,
|
||||||
|
cmd,
|
||||||
|
);
|
||||||
|
return {
|
||||||
|
stdout: result.stdout,
|
||||||
|
stderr: result.stderr,
|
||||||
|
exitCode: result.exitCode,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
logger.info('Workspace handler registered');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,10 +17,6 @@ export { path, fs, http, encoding };
|
|||||||
import { Database } from '@db/sqlite';
|
import { Database } from '@db/sqlite';
|
||||||
export const sqlite = { DB: Database };
|
export const sqlite = { DB: Database };
|
||||||
|
|
||||||
// Systemd Daemon Integration
|
|
||||||
import * as smartdaemon from '@push.rocks/smartdaemon';
|
|
||||||
export { smartdaemon };
|
|
||||||
|
|
||||||
// Docker API Client
|
// Docker API Client
|
||||||
import { DockerHost } from '@apiclient.xyz/docker';
|
import { DockerHost } from '@apiclient.xyz/docker';
|
||||||
export const docker = { Docker: DockerHost };
|
export const docker = { Docker: DockerHost };
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -8,6 +8,11 @@ export interface ISystemStatus {
|
|||||||
docker: {
|
docker: {
|
||||||
running: boolean;
|
running: boolean;
|
||||||
version: unknown;
|
version: unknown;
|
||||||
|
cpuUsage: number;
|
||||||
|
memoryUsage: number;
|
||||||
|
memoryTotal: number;
|
||||||
|
networkIn: number;
|
||||||
|
networkOut: number;
|
||||||
};
|
};
|
||||||
reverseProxy: {
|
reverseProxy: {
|
||||||
http: { running: boolean; port: number };
|
http: { running: boolean; port: number };
|
||||||
|
|||||||
@@ -11,3 +11,4 @@ export * from './backups.ts';
|
|||||||
export * from './backup-schedules.ts';
|
export * from './backup-schedules.ts';
|
||||||
export * from './settings.ts';
|
export * from './settings.ts';
|
||||||
export * from './logs.ts';
|
export * from './logs.ts';
|
||||||
|
export * from './workspace.ts';
|
||||||
|
|||||||
@@ -69,3 +69,34 @@ export interface IReq_GetPlatformServiceStats extends plugins.typedrequestInterf
|
|||||||
stats: data.IContainerStats;
|
stats: data.IContainerStats;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface IReq_GetPlatformServiceLogs extends plugins.typedrequestInterfaces.implementsTR<
|
||||||
|
plugins.typedrequestInterfaces.ITypedRequest,
|
||||||
|
IReq_GetPlatformServiceLogs
|
||||||
|
> {
|
||||||
|
method: 'getPlatformServiceLogs';
|
||||||
|
request: {
|
||||||
|
identity: data.IIdentity;
|
||||||
|
serviceType: data.TPlatformServiceType;
|
||||||
|
tail?: number;
|
||||||
|
};
|
||||||
|
response: {
|
||||||
|
logs: data.ILogEntry[];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IReq_PushPlatformServiceLog extends plugins.typedrequestInterfaces.implementsTR<
|
||||||
|
plugins.typedrequestInterfaces.ITypedRequest,
|
||||||
|
IReq_PushPlatformServiceLog
|
||||||
|
> {
|
||||||
|
method: 'pushPlatformServiceLog';
|
||||||
|
request: {
|
||||||
|
serviceType: data.TPlatformServiceType;
|
||||||
|
entry: {
|
||||||
|
timestamp: string;
|
||||||
|
level: string;
|
||||||
|
message: string;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
response: {};
|
||||||
|
}
|
||||||
|
|||||||
@@ -212,3 +212,19 @@ export interface IReq_GetServiceBackupSchedules extends plugins.typedrequestInte
|
|||||||
schedules: data.IBackupSchedule[];
|
schedules: data.IBackupSchedule[];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface IReq_PushServiceLog extends plugins.typedrequestInterfaces.implementsTR<
|
||||||
|
plugins.typedrequestInterfaces.ITypedRequest,
|
||||||
|
IReq_PushServiceLog
|
||||||
|
> {
|
||||||
|
method: 'pushServiceLog';
|
||||||
|
request: {
|
||||||
|
serviceName: string;
|
||||||
|
entry: {
|
||||||
|
timestamp: string;
|
||||||
|
level: string;
|
||||||
|
message: string;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
response: {};
|
||||||
|
}
|
||||||
|
|||||||
106
ts_interfaces/requests/workspace.ts
Normal file
106
ts_interfaces/requests/workspace.ts
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
import * as plugins from '../plugins.ts';
|
||||||
|
import * as data from '../data/index.ts';
|
||||||
|
|
||||||
|
export interface IReq_WorkspaceReadFile extends plugins.typedrequestInterfaces.implementsTR<
|
||||||
|
plugins.typedrequestInterfaces.ITypedRequest,
|
||||||
|
IReq_WorkspaceReadFile
|
||||||
|
> {
|
||||||
|
method: 'workspaceReadFile';
|
||||||
|
request: {
|
||||||
|
identity: data.IIdentity;
|
||||||
|
serviceName: string;
|
||||||
|
path: string;
|
||||||
|
};
|
||||||
|
response: {
|
||||||
|
content: string;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IReq_WorkspaceWriteFile extends plugins.typedrequestInterfaces.implementsTR<
|
||||||
|
plugins.typedrequestInterfaces.ITypedRequest,
|
||||||
|
IReq_WorkspaceWriteFile
|
||||||
|
> {
|
||||||
|
method: 'workspaceWriteFile';
|
||||||
|
request: {
|
||||||
|
identity: data.IIdentity;
|
||||||
|
serviceName: string;
|
||||||
|
path: string;
|
||||||
|
content: string;
|
||||||
|
};
|
||||||
|
response: {};
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IReq_WorkspaceReadDir extends plugins.typedrequestInterfaces.implementsTR<
|
||||||
|
plugins.typedrequestInterfaces.ITypedRequest,
|
||||||
|
IReq_WorkspaceReadDir
|
||||||
|
> {
|
||||||
|
method: 'workspaceReadDir';
|
||||||
|
request: {
|
||||||
|
identity: data.IIdentity;
|
||||||
|
serviceName: string;
|
||||||
|
path: string;
|
||||||
|
};
|
||||||
|
response: {
|
||||||
|
entries: Array<{ type: 'file' | 'directory'; name: string; path: string }>;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IReq_WorkspaceMkdir extends plugins.typedrequestInterfaces.implementsTR<
|
||||||
|
plugins.typedrequestInterfaces.ITypedRequest,
|
||||||
|
IReq_WorkspaceMkdir
|
||||||
|
> {
|
||||||
|
method: 'workspaceMkdir';
|
||||||
|
request: {
|
||||||
|
identity: data.IIdentity;
|
||||||
|
serviceName: string;
|
||||||
|
path: string;
|
||||||
|
};
|
||||||
|
response: {};
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IReq_WorkspaceRm extends plugins.typedrequestInterfaces.implementsTR<
|
||||||
|
plugins.typedrequestInterfaces.ITypedRequest,
|
||||||
|
IReq_WorkspaceRm
|
||||||
|
> {
|
||||||
|
method: 'workspaceRm';
|
||||||
|
request: {
|
||||||
|
identity: data.IIdentity;
|
||||||
|
serviceName: string;
|
||||||
|
path: string;
|
||||||
|
recursive?: boolean;
|
||||||
|
};
|
||||||
|
response: {};
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IReq_WorkspaceExists extends plugins.typedrequestInterfaces.implementsTR<
|
||||||
|
plugins.typedrequestInterfaces.ITypedRequest,
|
||||||
|
IReq_WorkspaceExists
|
||||||
|
> {
|
||||||
|
method: 'workspaceExists';
|
||||||
|
request: {
|
||||||
|
identity: data.IIdentity;
|
||||||
|
serviceName: string;
|
||||||
|
path: string;
|
||||||
|
};
|
||||||
|
response: {
|
||||||
|
exists: boolean;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IReq_WorkspaceExec extends plugins.typedrequestInterfaces.implementsTR<
|
||||||
|
plugins.typedrequestInterfaces.ITypedRequest,
|
||||||
|
IReq_WorkspaceExec
|
||||||
|
> {
|
||||||
|
method: 'workspaceExec';
|
||||||
|
request: {
|
||||||
|
identity: data.IIdentity;
|
||||||
|
serviceName: string;
|
||||||
|
command: string;
|
||||||
|
args?: string[];
|
||||||
|
};
|
||||||
|
response: {
|
||||||
|
stdout: string;
|
||||||
|
stderr: string;
|
||||||
|
exitCode: number;
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@serve.zone/onebox',
|
name: '@serve.zone/onebox',
|
||||||
version: '1.13.14',
|
version: '1.22.2',
|
||||||
description: 'Self-hosted container platform with automatic SSL and DNS - a mini Heroku for single servers'
|
description: 'Self-hosted container platform with automatic SSL and DNS - a mini Heroku for single servers'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ export interface IServicesState {
|
|||||||
currentServiceStats: interfaces.data.IContainerStats | null;
|
currentServiceStats: interfaces.data.IContainerStats | null;
|
||||||
platformServices: interfaces.data.IPlatformService[];
|
platformServices: interfaces.data.IPlatformService[];
|
||||||
currentPlatformService: interfaces.data.IPlatformService | null;
|
currentPlatformService: interfaces.data.IPlatformService | null;
|
||||||
|
currentPlatformServiceStats: interfaces.data.IContainerStats | null;
|
||||||
|
currentPlatformServiceLogs: interfaces.data.ILogEntry[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface INetworkState {
|
export interface INetworkState {
|
||||||
@@ -56,6 +58,7 @@ export interface IUiState {
|
|||||||
activeView: string;
|
activeView: string;
|
||||||
autoRefresh: boolean;
|
autoRefresh: boolean;
|
||||||
refreshInterval: number;
|
refreshInterval: number;
|
||||||
|
pendingAppTemplate?: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
@@ -88,6 +91,8 @@ export const servicesStatePart = await appState.getStatePart<IServicesState>(
|
|||||||
currentServiceStats: null,
|
currentServiceStats: null,
|
||||||
platformServices: [],
|
platformServices: [],
|
||||||
currentPlatformService: null,
|
currentPlatformService: null,
|
||||||
|
currentPlatformServiceStats: null,
|
||||||
|
currentPlatformServiceLogs: [],
|
||||||
},
|
},
|
||||||
'soft',
|
'soft',
|
||||||
);
|
);
|
||||||
@@ -476,6 +481,46 @@ export const stopPlatformServiceAction = servicesStatePart.createAction<{
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const fetchPlatformServiceStatsAction = servicesStatePart.createAction<{
|
||||||
|
serviceType: interfaces.data.TPlatformServiceType;
|
||||||
|
}>(async (statePartArg, dataArg) => {
|
||||||
|
const context = getActionContext();
|
||||||
|
try {
|
||||||
|
const typedRequest = new plugins.domtools.plugins.typedrequest.TypedRequest<
|
||||||
|
interfaces.requests.IReq_GetPlatformServiceStats
|
||||||
|
>('/typedrequest', 'getPlatformServiceStats');
|
||||||
|
const response = await typedRequest.fire({
|
||||||
|
identity: context.identity!,
|
||||||
|
serviceType: dataArg.serviceType,
|
||||||
|
});
|
||||||
|
return { ...statePartArg.getState(), currentPlatformServiceStats: response.stats };
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Failed to fetch platform service stats:', err);
|
||||||
|
return { ...statePartArg.getState(), currentPlatformServiceStats: null };
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export const fetchPlatformServiceLogsAction = servicesStatePart.createAction<{
|
||||||
|
serviceType: interfaces.data.TPlatformServiceType;
|
||||||
|
tail?: number;
|
||||||
|
}>(async (statePartArg, dataArg) => {
|
||||||
|
const context = getActionContext();
|
||||||
|
try {
|
||||||
|
const typedRequest = new plugins.domtools.plugins.typedrequest.TypedRequest<
|
||||||
|
interfaces.requests.IReq_GetPlatformServiceLogs
|
||||||
|
>('/typedrequest', 'getPlatformServiceLogs');
|
||||||
|
const response = await typedRequest.fire({
|
||||||
|
identity: context.identity!,
|
||||||
|
serviceType: dataArg.serviceType,
|
||||||
|
tail: dataArg.tail || 100,
|
||||||
|
});
|
||||||
|
return { ...statePartArg.getState(), currentPlatformServiceLogs: response.logs };
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Failed to fetch platform service logs:', err);
|
||||||
|
return { ...statePartArg.getState(), currentPlatformServiceLogs: [] };
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// Network Actions
|
// Network Actions
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
@@ -917,3 +962,104 @@ const startAutoRefresh = () => {
|
|||||||
uiStatePart.select((s) => s).subscribe(() => startAutoRefresh());
|
uiStatePart.select((s) => s).subscribe(() => startAutoRefresh());
|
||||||
loginStatePart.select((s) => s).subscribe(() => startAutoRefresh());
|
loginStatePart.select((s) => s).subscribe(() => startAutoRefresh());
|
||||||
startAutoRefresh();
|
startAutoRefresh();
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// TypedSocket — real-time server push (logs, events)
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
let socketClient: InstanceType<typeof plugins.typedsocket.TypedSocket> | null = null;
|
||||||
|
const socketRouter = new plugins.domtools.plugins.typedrequest.TypedRouter();
|
||||||
|
|
||||||
|
// Handle server-pushed platform service log entries
|
||||||
|
socketRouter.addTypedHandler(
|
||||||
|
new plugins.domtools.plugins.typedrequest.TypedHandler<interfaces.requests.IReq_PushPlatformServiceLog>(
|
||||||
|
'pushPlatformServiceLog',
|
||||||
|
async (dataArg) => {
|
||||||
|
const state = servicesStatePart.getState();
|
||||||
|
const entry: interfaces.data.ILogEntry = {
|
||||||
|
id: state.currentPlatformServiceLogs.length,
|
||||||
|
serviceId: 0,
|
||||||
|
timestamp: new Date(dataArg.entry.timestamp).getTime(),
|
||||||
|
message: dataArg.entry.message,
|
||||||
|
level: dataArg.entry.level as 'info' | 'warn' | 'error' | 'debug',
|
||||||
|
source: 'stdout',
|
||||||
|
};
|
||||||
|
const updated = [...state.currentPlatformServiceLogs, entry];
|
||||||
|
// Cap at 2000 entries
|
||||||
|
if (updated.length > 2000) {
|
||||||
|
updated.splice(0, updated.length - 2000);
|
||||||
|
}
|
||||||
|
servicesStatePart.setState({
|
||||||
|
...state,
|
||||||
|
currentPlatformServiceLogs: updated,
|
||||||
|
});
|
||||||
|
return {};
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
// Handle server-pushed user service log entries
|
||||||
|
socketRouter.addTypedHandler(
|
||||||
|
new plugins.domtools.plugins.typedrequest.TypedHandler<interfaces.requests.IReq_PushServiceLog>(
|
||||||
|
'pushServiceLog',
|
||||||
|
async (dataArg) => {
|
||||||
|
const state = servicesStatePart.getState();
|
||||||
|
// Only append if we're currently viewing this service
|
||||||
|
if (!state.currentService || state.currentService.name !== dataArg.serviceName) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
const entry: interfaces.data.ILogEntry = {
|
||||||
|
id: state.currentServiceLogs.length,
|
||||||
|
serviceId: 0,
|
||||||
|
timestamp: new Date(dataArg.entry.timestamp).getTime(),
|
||||||
|
message: dataArg.entry.message,
|
||||||
|
level: dataArg.entry.level as 'info' | 'warn' | 'error' | 'debug',
|
||||||
|
source: 'stdout',
|
||||||
|
};
|
||||||
|
const updated = [...state.currentServiceLogs, entry];
|
||||||
|
if (updated.length > 2000) {
|
||||||
|
updated.splice(0, updated.length - 2000);
|
||||||
|
}
|
||||||
|
servicesStatePart.setState({
|
||||||
|
...state,
|
||||||
|
currentServiceLogs: updated,
|
||||||
|
});
|
||||||
|
return {};
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
async function connectSocket() {
|
||||||
|
if (socketClient) return;
|
||||||
|
try {
|
||||||
|
socketClient = await plugins.typedsocket.TypedSocket.createClient(
|
||||||
|
socketRouter,
|
||||||
|
plugins.typedsocket.TypedSocket.useWindowLocationOriginUrl(),
|
||||||
|
);
|
||||||
|
await socketClient.setTag('role', 'ops_dashboard');
|
||||||
|
console.log('TypedSocket dashboard connection established');
|
||||||
|
} catch (err) {
|
||||||
|
console.error('TypedSocket connection failed:', err);
|
||||||
|
socketClient = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function disconnectSocket() {
|
||||||
|
if (socketClient) {
|
||||||
|
try {
|
||||||
|
await socketClient.disconnect();
|
||||||
|
} catch {
|
||||||
|
// ignore disconnect errors
|
||||||
|
}
|
||||||
|
socketClient = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Connect socket when logged in, disconnect when logged out
|
||||||
|
loginStatePart.select((s) => s).subscribe((loginState) => {
|
||||||
|
if (loginState.isLoggedIn) {
|
||||||
|
connectSocket();
|
||||||
|
} else {
|
||||||
|
disconnectSocket();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|||||||
@@ -37,15 +37,16 @@ export class ObAppShell extends DeesElement {
|
|||||||
accessor loginError: string = '';
|
accessor loginError: string = '';
|
||||||
|
|
||||||
private viewTabs = [
|
private viewTabs = [
|
||||||
{ name: 'Dashboard', element: (async () => (await import('./ob-view-dashboard.js')).ObViewDashboard)() },
|
{ name: 'Dashboard', iconName: 'lucide:layoutDashboard', element: (async () => (await import('./ob-view-dashboard.js')).ObViewDashboard)() },
|
||||||
{ name: 'Services', element: (async () => (await import('./ob-view-services.js')).ObViewServices)() },
|
{ name: 'App Store', iconName: 'lucide:store', element: (async () => (await import('./ob-view-appstore.js')).ObViewAppStore)() },
|
||||||
{ name: 'Network', element: (async () => (await import('./ob-view-network.js')).ObViewNetwork)() },
|
{ name: 'Services', iconName: 'lucide:boxes', element: (async () => (await import('./ob-view-services.js')).ObViewServices)() },
|
||||||
{ name: 'Registries', element: (async () => (await import('./ob-view-registries.js')).ObViewRegistries)() },
|
{ name: 'Network', iconName: 'lucide:network', element: (async () => (await import('./ob-view-network.js')).ObViewNetwork)() },
|
||||||
{ name: 'Tokens', element: (async () => (await import('./ob-view-tokens.js')).ObViewTokens)() },
|
{ name: 'Registries', iconName: 'lucide:package', element: (async () => (await import('./ob-view-registries.js')).ObViewRegistries)() },
|
||||||
{ name: 'Settings', element: (async () => (await import('./ob-view-settings.js')).ObViewSettings)() },
|
{ name: 'Tokens', iconName: 'lucide:key', element: (async () => (await import('./ob-view-tokens.js')).ObViewTokens)() },
|
||||||
|
{ name: 'Settings', iconName: 'lucide:settings', element: (async () => (await import('./ob-view-settings.js')).ObViewSettings)() },
|
||||||
];
|
];
|
||||||
|
|
||||||
private resolvedViewTabs: Array<{ name: string; element: any }> = [];
|
private resolvedViewTabs: Array<{ name: string; iconName?: string; element: any }> = [];
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
@@ -104,6 +105,7 @@ export class ObAppShell extends DeesElement {
|
|||||||
this.resolvedViewTabs = await Promise.all(
|
this.resolvedViewTabs = await Promise.all(
|
||||||
this.viewTabs.map(async (tab) => ({
|
this.viewTabs.map(async (tab) => ({
|
||||||
name: tab.name,
|
name: tab.name,
|
||||||
|
iconName: tab.iconName,
|
||||||
element: await tab.element,
|
element: await tab.element,
|
||||||
})),
|
})),
|
||||||
);
|
);
|
||||||
|
|||||||
224
ts_web/elements/ob-view-appstore.ts
Normal file
224
ts_web/elements/ob-view-appstore.ts
Normal file
@@ -0,0 +1,224 @@
|
|||||||
|
import * as plugins from '../plugins.js';
|
||||||
|
import * as shared from './shared/index.js';
|
||||||
|
import * as appstate from '../appstate.js';
|
||||||
|
import * as interfaces from '../../ts_interfaces/index.js';
|
||||||
|
import {
|
||||||
|
DeesElement,
|
||||||
|
customElement,
|
||||||
|
html,
|
||||||
|
state,
|
||||||
|
css,
|
||||||
|
cssManager,
|
||||||
|
type TemplateResult,
|
||||||
|
} from '@design.estate/dees-element';
|
||||||
|
|
||||||
|
// App template definitions — curated Docker apps
|
||||||
|
const appTemplates = [
|
||||||
|
{
|
||||||
|
id: 'nginx',
|
||||||
|
name: 'Nginx',
|
||||||
|
description: 'High-performance web server and reverse proxy. Lightweight, fast, and battle-tested.',
|
||||||
|
category: 'Web Server',
|
||||||
|
iconName: 'globe',
|
||||||
|
image: 'nginx:alpine',
|
||||||
|
port: 80,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'wordpress',
|
||||||
|
name: 'WordPress',
|
||||||
|
description: 'The world\'s most popular content management system. Powers over 40% of the web.',
|
||||||
|
category: 'CMS',
|
||||||
|
iconName: 'file-text',
|
||||||
|
image: 'wordpress:latest',
|
||||||
|
port: 80,
|
||||||
|
enableMongoDB: false,
|
||||||
|
envVars: [
|
||||||
|
{ key: 'WORDPRESS_DB_HOST', value: '', description: 'Database host', required: true },
|
||||||
|
{ key: 'WORDPRESS_DB_USER', value: 'wordpress', description: 'Database user' },
|
||||||
|
{ key: 'WORDPRESS_DB_PASSWORD', value: '', description: 'Database password', required: true },
|
||||||
|
{ key: 'WORDPRESS_DB_NAME', value: 'wordpress', description: 'Database name' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'ghost',
|
||||||
|
name: 'Ghost',
|
||||||
|
description: 'Modern publishing platform for creating professional blogs and newsletters.',
|
||||||
|
category: 'CMS',
|
||||||
|
iconName: 'book-open',
|
||||||
|
image: 'ghost:latest',
|
||||||
|
port: 2368,
|
||||||
|
envVars: [
|
||||||
|
{ key: 'database__client', value: 'sqlite3', description: 'Database client (sqlite3 for standalone)' },
|
||||||
|
{ key: 'database__connection__filename', value: '/var/lib/ghost/content/data/ghost.db', description: 'SQLite database path' },
|
||||||
|
{ key: 'url', value: 'http://localhost:2368', description: 'Public URL of the blog' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'gitea',
|
||||||
|
name: 'Gitea',
|
||||||
|
description: 'Lightweight self-hosted Git service. Easy to install and maintain.',
|
||||||
|
category: 'Dev Tools',
|
||||||
|
iconName: 'git-branch',
|
||||||
|
image: 'gitea/gitea:latest',
|
||||||
|
port: 3000,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'nextcloud',
|
||||||
|
name: 'Nextcloud',
|
||||||
|
description: 'Self-hosted file sync and share platform. Your own private cloud.',
|
||||||
|
category: 'Storage',
|
||||||
|
iconName: 'package',
|
||||||
|
image: 'nextcloud:latest',
|
||||||
|
port: 80,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'grafana',
|
||||||
|
name: 'Grafana',
|
||||||
|
description: 'Open-source observability platform for metrics, logs, and traces visualization.',
|
||||||
|
category: 'Monitoring',
|
||||||
|
iconName: 'monitor',
|
||||||
|
image: 'grafana/grafana:latest',
|
||||||
|
port: 3000,
|
||||||
|
envVars: [
|
||||||
|
{ key: 'GF_SECURITY_ADMIN_PASSWORD', value: 'admin', description: 'Admin password' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'uptime-kuma',
|
||||||
|
name: 'Uptime Kuma',
|
||||||
|
description: 'Self-hosted monitoring tool. Beautiful UI for tracking uptime of services.',
|
||||||
|
category: 'Monitoring',
|
||||||
|
iconName: 'monitor',
|
||||||
|
image: 'louislam/uptime-kuma:latest',
|
||||||
|
port: 3001,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'plausible',
|
||||||
|
name: 'Plausible Analytics',
|
||||||
|
description: 'Privacy-friendly web analytics. No cookies, GDPR compliant by design.',
|
||||||
|
category: 'Analytics',
|
||||||
|
iconName: 'monitor',
|
||||||
|
image: 'plausible/analytics:latest',
|
||||||
|
port: 8000,
|
||||||
|
enableClickHouse: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'vaultwarden',
|
||||||
|
name: 'Vaultwarden',
|
||||||
|
description: 'Lightweight Bitwarden-compatible password manager server.',
|
||||||
|
category: 'Security',
|
||||||
|
iconName: 'shield',
|
||||||
|
image: 'vaultwarden/server:latest',
|
||||||
|
port: 80,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'n8n',
|
||||||
|
name: 'N8N',
|
||||||
|
description: 'Workflow automation tool. Connect anything to everything with a visual editor.',
|
||||||
|
category: 'Automation',
|
||||||
|
iconName: 'server',
|
||||||
|
image: 'n8nio/n8n:latest',
|
||||||
|
port: 5678,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'mattermost',
|
||||||
|
name: 'Mattermost',
|
||||||
|
description: 'Open-source Slack alternative for team communication and collaboration.',
|
||||||
|
category: 'Communication',
|
||||||
|
iconName: 'mail',
|
||||||
|
image: 'mattermost/mattermost-team-edition:latest',
|
||||||
|
port: 8065,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'portainer',
|
||||||
|
name: 'Portainer',
|
||||||
|
description: 'Docker management UI. Monitor and manage containers from a web interface.',
|
||||||
|
category: 'Dev Tools',
|
||||||
|
iconName: 'package',
|
||||||
|
image: 'portainer/portainer-ce:latest',
|
||||||
|
port: 9000,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'redis',
|
||||||
|
name: 'Redis',
|
||||||
|
description: 'In-memory data store used as database, cache, and message broker.',
|
||||||
|
category: 'Database',
|
||||||
|
iconName: 'database',
|
||||||
|
image: 'redis:alpine',
|
||||||
|
port: 6379,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'postgres',
|
||||||
|
name: 'PostgreSQL',
|
||||||
|
description: 'Advanced open-source relational database. Reliable and feature-rich.',
|
||||||
|
category: 'Database',
|
||||||
|
iconName: 'database',
|
||||||
|
image: 'postgres:16-alpine',
|
||||||
|
port: 5432,
|
||||||
|
envVars: [
|
||||||
|
{ key: 'POSTGRES_PASSWORD', value: '', description: 'Superuser password', required: true },
|
||||||
|
{ key: 'POSTGRES_USER', value: 'postgres', description: 'Superuser name' },
|
||||||
|
{ key: 'POSTGRES_DB', value: 'postgres', description: 'Default database name' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'mariadb',
|
||||||
|
name: 'MariaDB',
|
||||||
|
description: 'Community-developed fork of MySQL. Drop-in replacement with enhanced features.',
|
||||||
|
category: 'Database',
|
||||||
|
iconName: 'database',
|
||||||
|
image: 'mariadb:latest',
|
||||||
|
port: 3306,
|
||||||
|
envVars: [
|
||||||
|
{ key: 'MARIADB_ROOT_PASSWORD', value: '', description: 'Root password', required: true },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'adminer',
|
||||||
|
name: 'Adminer',
|
||||||
|
description: 'Database management tool in a single PHP file. Supports MySQL, PostgreSQL, SQLite.',
|
||||||
|
category: 'Dev Tools',
|
||||||
|
iconName: 'database',
|
||||||
|
image: 'adminer:latest',
|
||||||
|
port: 8080,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
@customElement('ob-view-appstore')
|
||||||
|
export class ObViewAppStore extends DeesElement {
|
||||||
|
public static styles = [
|
||||||
|
cssManager.defaultStyles,
|
||||||
|
shared.viewHostCss,
|
||||||
|
css``,
|
||||||
|
];
|
||||||
|
|
||||||
|
async connectedCallback() {
|
||||||
|
super.connectedCallback();
|
||||||
|
}
|
||||||
|
|
||||||
|
public render(): TemplateResult {
|
||||||
|
return html`
|
||||||
|
<ob-sectionheading>App Store</ob-sectionheading>
|
||||||
|
<sz-app-store-view
|
||||||
|
.apps=${appTemplates}
|
||||||
|
@deploy-app=${(e: CustomEvent) => this.handleDeployApp(e)}
|
||||||
|
></sz-app-store-view>
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
|
||||||
|
private handleDeployApp(e: CustomEvent) {
|
||||||
|
const app = e.detail?.app;
|
||||||
|
if (!app) return;
|
||||||
|
|
||||||
|
// Store the template and navigate on next microtask to avoid
|
||||||
|
// destroying the current view while the event handler is still on the call stack
|
||||||
|
setTimeout(() => {
|
||||||
|
// Set both pendingAppTemplate and activeView atomically
|
||||||
|
appstate.uiStatePart.setState({
|
||||||
|
...appstate.uiStatePart.getState(),
|
||||||
|
pendingAppTemplate: app,
|
||||||
|
activeView: 'services',
|
||||||
|
});
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -24,6 +24,8 @@ export class ObViewDashboard extends DeesElement {
|
|||||||
currentServiceStats: null,
|
currentServiceStats: null,
|
||||||
platformServices: [],
|
platformServices: [],
|
||||||
currentPlatformService: null,
|
currentPlatformService: null,
|
||||||
|
currentPlatformServiceStats: null,
|
||||||
|
currentPlatformServiceLogs: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
@state()
|
@state()
|
||||||
@@ -108,8 +110,8 @@ export class ObViewDashboard extends DeesElement {
|
|||||||
cpu: status?.docker?.cpuUsage || 0,
|
cpu: status?.docker?.cpuUsage || 0,
|
||||||
memoryUsed: status?.docker?.memoryUsage || 0,
|
memoryUsed: status?.docker?.memoryUsage || 0,
|
||||||
memoryTotal: status?.docker?.memoryTotal || 0,
|
memoryTotal: status?.docker?.memoryTotal || 0,
|
||||||
networkIn: 0,
|
networkIn: status?.docker?.networkIn || 0,
|
||||||
networkOut: 0,
|
networkOut: status?.docker?.networkOut || 0,
|
||||||
topConsumers: [],
|
topConsumers: [],
|
||||||
},
|
},
|
||||||
platformServices: platformServices.map((ps) => ({
|
platformServices: platformServices.map((ps) => ({
|
||||||
@@ -149,6 +151,7 @@ export class ObViewDashboard extends DeesElement {
|
|||||||
],
|
],
|
||||||
}}
|
}}
|
||||||
@action-click=${(e: CustomEvent) => this.handleQuickAction(e)}
|
@action-click=${(e: CustomEvent) => this.handleQuickAction(e)}
|
||||||
|
@service-click=${(e: CustomEvent) => this.handlePlatformServiceClick(e)}
|
||||||
></sz-dashboard-view>
|
></sz-dashboard-view>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
@@ -161,4 +164,21 @@ export class ObViewDashboard extends DeesElement {
|
|||||||
appstate.uiStatePart.dispatchAction(appstate.setActiveViewAction, { view: 'network' });
|
appstate.uiStatePart.dispatchAction(appstate.setActiveViewAction, { view: 'network' });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private handlePlatformServiceClick(e: CustomEvent) {
|
||||||
|
// Find the platform service type from the click event
|
||||||
|
const name = e.detail?.name;
|
||||||
|
const ps = this.servicesState.platformServices.find(
|
||||||
|
(p) => p.displayName === name,
|
||||||
|
);
|
||||||
|
if (ps) {
|
||||||
|
// Navigate to services tab — the ObViewServices component will pick up the type
|
||||||
|
// Store the selected platform type so the services view can open it
|
||||||
|
appstate.servicesStatePart.setState({
|
||||||
|
...appstate.servicesStatePart.getState(),
|
||||||
|
currentPlatformService: ps,
|
||||||
|
});
|
||||||
|
appstate.uiStatePart.dispatchAction(appstate.setActiveViewAction, { view: 'services' });
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import * as plugins from '../plugins.js';
|
|||||||
import * as shared from './shared/index.js';
|
import * as shared from './shared/index.js';
|
||||||
import * as appstate from '../appstate.js';
|
import * as appstate from '../appstate.js';
|
||||||
import * as interfaces from '../../ts_interfaces/index.js';
|
import * as interfaces from '../../ts_interfaces/index.js';
|
||||||
|
import { BackendExecutionEnvironment } from '../environments/backend-environment.js';
|
||||||
import {
|
import {
|
||||||
DeesElement,
|
DeesElement,
|
||||||
customElement,
|
customElement,
|
||||||
@@ -76,20 +77,29 @@ function toServiceStats(stats: interfaces.data.IContainerStats) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseLogs(logs: any): Array<{ timestamp: string; message: string }> {
|
function parseLogs(logs: any): Array<{ timestamp: string; message: string; level?: string }> {
|
||||||
if (Array.isArray(logs)) {
|
if (Array.isArray(logs)) {
|
||||||
return logs.map((entry: any) => ({
|
return logs.map((entry: any) => {
|
||||||
timestamp: entry.timestamp ? String(entry.timestamp) : '',
|
const ts = entry.timestamp
|
||||||
message: entry.message || String(entry),
|
? (typeof entry.timestamp === 'number' ? new Date(entry.timestamp).toISOString() : String(entry.timestamp))
|
||||||
}));
|
: new Date().toISOString();
|
||||||
|
const message = entry.message || String(entry);
|
||||||
|
const level = entry.level || 'info';
|
||||||
|
return { timestamp: ts, message, level };
|
||||||
|
});
|
||||||
}
|
}
|
||||||
if (typeof logs === 'string' && logs.trim()) {
|
if (typeof logs === 'string' && logs.trim()) {
|
||||||
return logs.split('\n').filter((line: string) => line.trim()).map((line: string) => {
|
return logs.split('\n').filter((line: string) => line.trim()).map((line: string) => {
|
||||||
const match = line.match(/^(\d{4}-\d{2}-\d{2}T[\d:.]+Z?)\s+(.*)/);
|
const match = line.match(/^(\d{4}-\d{2}-\d{2}T[\d:.]+Z?)\s+(.*)/);
|
||||||
if (match) {
|
const timestamp = match ? match[1] : new Date().toISOString();
|
||||||
return { timestamp: match[1], message: match[2] };
|
const message = match ? match[2] : line;
|
||||||
}
|
const msgLower = message.toLowerCase();
|
||||||
return { timestamp: '', message: line };
|
const level = msgLower.includes('error') || msgLower.includes('fatal')
|
||||||
|
? 'error'
|
||||||
|
: msgLower.includes('warn')
|
||||||
|
? 'warn'
|
||||||
|
: 'info';
|
||||||
|
return { timestamp, message, level };
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return [];
|
return [];
|
||||||
@@ -107,6 +117,8 @@ export class ObViewServices extends DeesElement {
|
|||||||
currentServiceStats: null,
|
currentServiceStats: null,
|
||||||
platformServices: [],
|
platformServices: [],
|
||||||
currentPlatformService: null,
|
currentPlatformService: null,
|
||||||
|
currentPlatformServiceStats: null,
|
||||||
|
currentPlatformServiceLogs: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
@state()
|
@state()
|
||||||
@@ -124,6 +136,12 @@ export class ObViewServices extends DeesElement {
|
|||||||
@state()
|
@state()
|
||||||
accessor selectedPlatformType: string = '';
|
accessor selectedPlatformType: string = '';
|
||||||
|
|
||||||
|
@state()
|
||||||
|
accessor workspaceOpen: boolean = false;
|
||||||
|
|
||||||
|
@state()
|
||||||
|
accessor pendingTemplate: any = null;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
@@ -140,12 +158,56 @@ export class ObViewServices extends DeesElement {
|
|||||||
this.backupsState = newState;
|
this.backupsState = newState;
|
||||||
});
|
});
|
||||||
this.rxSubscriptions.push(backupsSub);
|
this.rxSubscriptions.push(backupsSub);
|
||||||
|
|
||||||
|
// No subscription needed — pendingAppTemplate is checked in render()
|
||||||
}
|
}
|
||||||
|
|
||||||
public static styles = [
|
public static styles = [
|
||||||
cssManager.defaultStyles,
|
cssManager.defaultStyles,
|
||||||
shared.viewHostCss,
|
shared.viewHostCss,
|
||||||
css``,
|
css`
|
||||||
|
.page-actions {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.deploy-button {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
padding: 10px 20px;
|
||||||
|
background: ${cssManager.bdTheme('#18181b', '#fafafa')};
|
||||||
|
color: ${cssManager.bdTheme('#fafafa', '#18181b')};
|
||||||
|
border: none;
|
||||||
|
border-radius: 6px;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 500;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: opacity 200ms ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.deploy-button:hover {
|
||||||
|
opacity: 0.9;
|
||||||
|
}
|
||||||
|
|
||||||
|
.deploy-button svg {
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
:host(.workspace-mode) {
|
||||||
|
max-width: none;
|
||||||
|
padding: 0;
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
:host(.workspace-mode) ob-sectionheading {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
`,
|
||||||
];
|
];
|
||||||
|
|
||||||
async connectedCallback() {
|
async connectedCallback() {
|
||||||
@@ -154,6 +216,32 @@ export class ObViewServices extends DeesElement {
|
|||||||
appstate.servicesStatePart.dispatchAction(appstate.fetchServicesAction, null),
|
appstate.servicesStatePart.dispatchAction(appstate.fetchServicesAction, null),
|
||||||
appstate.servicesStatePart.dispatchAction(appstate.fetchPlatformServicesAction, null),
|
appstate.servicesStatePart.dispatchAction(appstate.fetchPlatformServicesAction, null),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
// If a platform service was selected from the dashboard, navigate to its detail
|
||||||
|
const state = appstate.servicesStatePart.getState();
|
||||||
|
if (state.currentPlatformService) {
|
||||||
|
const type = state.currentPlatformService.type;
|
||||||
|
appstate.servicesStatePart.setState({
|
||||||
|
...appstate.servicesStatePart.getState(),
|
||||||
|
currentPlatformService: null,
|
||||||
|
});
|
||||||
|
this.navigateToPlatformDetail(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
updated(changedProperties: Map<string, any>) {
|
||||||
|
super.updated(changedProperties);
|
||||||
|
// Check for pending app template from the App Store after each update
|
||||||
|
const uiState = appstate.uiStatePart.getState();
|
||||||
|
if (uiState.pendingAppTemplate && !this.pendingTemplate) {
|
||||||
|
this.pendingTemplate = uiState.pendingAppTemplate;
|
||||||
|
appstate.uiStatePart.setState({
|
||||||
|
...appstate.uiStatePart.getState(),
|
||||||
|
pendingAppTemplate: undefined,
|
||||||
|
});
|
||||||
|
this.currentView = 'create';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public render(): TemplateResult {
|
public render(): TemplateResult {
|
||||||
@@ -178,8 +266,34 @@ export class ObViewServices extends DeesElement {
|
|||||||
domain: s.domain || null,
|
domain: s.domain || null,
|
||||||
status: mapStatus(s.status),
|
status: mapStatus(s.status),
|
||||||
}));
|
}));
|
||||||
|
const displayStatus = (status: string) => {
|
||||||
|
switch (status) {
|
||||||
|
case 'running': return 'Running';
|
||||||
|
case 'stopped': return 'Stopped';
|
||||||
|
case 'starting': return 'Starting...';
|
||||||
|
case 'stopping': return 'Stopping...';
|
||||||
|
case 'failed': return 'Failed';
|
||||||
|
case 'not-deployed': return 'Not Deployed';
|
||||||
|
default: return status;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const mappedPlatformServices = this.servicesState.platformServices.map((ps) => ({
|
||||||
|
name: ps.displayName,
|
||||||
|
status: displayStatus(ps.status),
|
||||||
|
running: ps.status === 'running',
|
||||||
|
type: ps.type,
|
||||||
|
}));
|
||||||
return html`
|
return html`
|
||||||
<ob-sectionheading>Services</ob-sectionheading>
|
<ob-sectionheading>Services</ob-sectionheading>
|
||||||
|
<div class="page-actions">
|
||||||
|
<button class="deploy-button" @click=${() => { this.currentView = 'create'; }}>
|
||||||
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||||
|
<line x1="12" y1="5" x2="12" y2="19"></line>
|
||||||
|
<line x1="5" y1="12" x2="19" y2="12"></line>
|
||||||
|
</svg>
|
||||||
|
Deploy Service
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
<sz-services-list-view
|
<sz-services-list-view
|
||||||
.services=${mappedServices}
|
.services=${mappedServices}
|
||||||
@service-click=${(e: CustomEvent) => {
|
@service-click=${(e: CustomEvent) => {
|
||||||
@@ -197,17 +311,105 @@ export class ObViewServices extends DeesElement {
|
|||||||
}}
|
}}
|
||||||
@service-action=${(e: CustomEvent) => this.handleServiceAction(e)}
|
@service-action=${(e: CustomEvent) => this.handleServiceAction(e)}
|
||||||
></sz-services-list-view>
|
></sz-services-list-view>
|
||||||
|
<ob-sectionheading style="margin-top: 32px;">Platform Services</ob-sectionheading>
|
||||||
|
<div style="max-width: 500px;">
|
||||||
|
<sz-platform-services-card
|
||||||
|
.services=${mappedPlatformServices}
|
||||||
|
@service-click=${(e: CustomEvent) => {
|
||||||
|
const type = e.detail.type || this.servicesState.platformServices.find(
|
||||||
|
(ps) => ps.displayName === e.detail.name,
|
||||||
|
)?.type;
|
||||||
|
if (type) {
|
||||||
|
this.navigateToPlatformDetail(type);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
></sz-platform-services-card>
|
||||||
|
</div>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async deployFromTemplate(template: any): Promise<void> {
|
||||||
|
const name = template.id || template.name.toLowerCase().replace(/[^a-z0-9-]/g, '-');
|
||||||
|
const envVars: Record<string, string> = {};
|
||||||
|
if (template.envVars) {
|
||||||
|
for (const ev of template.envVars) {
|
||||||
|
if (ev.key && ev.value) envVars[ev.key] = ev.value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const serviceConfig: interfaces.data.IServiceCreate = {
|
||||||
|
name,
|
||||||
|
image: template.image,
|
||||||
|
port: template.port || 80,
|
||||||
|
envVars,
|
||||||
|
enableMongoDB: template.enableMongoDB || false,
|
||||||
|
enableS3: template.enableS3 || false,
|
||||||
|
enableClickHouse: template.enableClickHouse || false,
|
||||||
|
};
|
||||||
|
await appstate.servicesStatePart.dispatchAction(appstate.createServiceAction, {
|
||||||
|
config: serviceConfig,
|
||||||
|
});
|
||||||
|
this.pendingTemplate = null;
|
||||||
|
this.currentView = 'list';
|
||||||
|
}
|
||||||
|
|
||||||
private renderCreateView(): TemplateResult {
|
private renderCreateView(): TemplateResult {
|
||||||
|
// If we have a pending app template from the App Store, show a quick-deploy confirmation
|
||||||
|
if (this.pendingTemplate) {
|
||||||
|
const t = this.pendingTemplate;
|
||||||
|
return html`
|
||||||
|
<ob-sectionheading>Deploy ${t.name}</ob-sectionheading>
|
||||||
|
<div style="max-width: 600px; margin: 0 auto;">
|
||||||
|
<div style="background: var(--ci-shade-1, #09090b); border: 1px solid var(--ci-shade-2, #27272a); border-radius: 8px; padding: 24px; margin-bottom: 16px;">
|
||||||
|
<h3 style="margin: 0 0 8px 0; font-size: 18px;">${t.name}</h3>
|
||||||
|
<p style="margin: 0 0 16px 0; color: var(--ci-shade-5, #a1a1aa); font-size: 14px;">${t.description}</p>
|
||||||
|
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 12px; font-size: 13px;">
|
||||||
|
<div><span style="color: var(--ci-shade-5, #a1a1aa);">Image:</span> <strong>${t.image}</strong></div>
|
||||||
|
<div><span style="color: var(--ci-shade-5, #a1a1aa);">Port:</span> <strong>${t.port}</strong></div>
|
||||||
|
<div><span style="color: var(--ci-shade-5, #a1a1aa);">Service Name:</span> <strong>${t.id}</strong></div>
|
||||||
|
<div><span style="color: var(--ci-shade-5, #a1a1aa);">Category:</span> <strong>${t.category}</strong></div>
|
||||||
|
</div>
|
||||||
|
${t.enableMongoDB || t.enableS3 || t.enableClickHouse ? html`
|
||||||
|
<div style="margin-top: 12px; font-size: 13px; color: var(--ci-shade-5, #a1a1aa);">
|
||||||
|
Platform Services:
|
||||||
|
${t.enableMongoDB ? html`<span style="margin-right: 8px;">MongoDB</span>` : ''}
|
||||||
|
${t.enableS3 ? html`<span style="margin-right: 8px;">S3</span>` : ''}
|
||||||
|
${t.enableClickHouse ? html`<span>ClickHouse</span>` : ''}
|
||||||
|
</div>
|
||||||
|
` : ''}
|
||||||
|
</div>
|
||||||
|
<div style="display: flex; gap: 12px; justify-content: flex-end;">
|
||||||
|
<button class="deploy-button" style="background: transparent; border: 1px solid var(--ci-shade-2, #27272a); color: inherit;" @click=${() => { this.pendingTemplate = null; this.currentView = 'list'; }}>Cancel</button>
|
||||||
|
<button class="deploy-button" @click=${() => this.deployFromTemplate(t)}>Deploy ${t.name}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
<ob-sectionheading>Create Service</ob-sectionheading>
|
<ob-sectionheading>Create Service</ob-sectionheading>
|
||||||
<sz-service-create-view
|
<sz-service-create-view
|
||||||
.registries=${[]}
|
.registries=${[]}
|
||||||
@create-service=${async (e: CustomEvent) => {
|
@create-service=${async (e: CustomEvent) => {
|
||||||
|
const formConfig = e.detail;
|
||||||
|
const serviceConfig: interfaces.data.IServiceCreate = {
|
||||||
|
name: formConfig.name,
|
||||||
|
image: formConfig.image,
|
||||||
|
port: formConfig.ports?.[0]?.containerPort
|
||||||
|
? parseInt(formConfig.ports[0].containerPort, 10)
|
||||||
|
: 80,
|
||||||
|
envVars: formConfig.envVars?.reduce(
|
||||||
|
(acc: Record<string, string>, ev: { key: string; value: string }) => {
|
||||||
|
if (ev.key) acc[ev.key] = ev.value;
|
||||||
|
return acc;
|
||||||
|
},
|
||||||
|
{} as Record<string, string>,
|
||||||
|
),
|
||||||
|
enableMongoDB: formConfig.enableMongoDB || false,
|
||||||
|
enableS3: formConfig.enableS3 || false,
|
||||||
|
enableClickHouse: formConfig.enableClickHouse || false,
|
||||||
|
};
|
||||||
await appstate.servicesStatePart.dispatchAction(appstate.createServiceAction, {
|
await appstate.servicesStatePart.dispatchAction(appstate.createServiceAction, {
|
||||||
config: e.detail,
|
config: serviceConfig,
|
||||||
});
|
});
|
||||||
this.currentView = 'list';
|
this.currentView = 'list';
|
||||||
}}
|
}}
|
||||||
@@ -236,6 +438,28 @@ export class ObViewServices extends DeesElement {
|
|||||||
this.currentView = 'list';
|
this.currentView = 'list';
|
||||||
}}
|
}}
|
||||||
@service-action=${(e: CustomEvent) => this.handleServiceAction(e)}
|
@service-action=${(e: CustomEvent) => this.handleServiceAction(e)}
|
||||||
|
@request-workspace=${async (e: CustomEvent) => {
|
||||||
|
const name = e.detail?.service?.name || this.selectedServiceName;
|
||||||
|
const identity = appstate.loginStatePart.getState().identity;
|
||||||
|
if (!name || !identity) return;
|
||||||
|
try {
|
||||||
|
const env = new BackendExecutionEnvironment(name, identity);
|
||||||
|
await env.init();
|
||||||
|
const detailView = this.shadowRoot?.querySelector('sz-service-detail-view') as any;
|
||||||
|
if (detailView) {
|
||||||
|
detailView.workspaceEnvironment = env;
|
||||||
|
}
|
||||||
|
this.workspaceOpen = true;
|
||||||
|
this.classList.add('workspace-mode');
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Failed to open workspace:', err);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
@back=${() => {
|
||||||
|
this.workspaceOpen = false;
|
||||||
|
this.classList.remove('workspace-mode');
|
||||||
|
this.currentView = 'list';
|
||||||
|
}}
|
||||||
></sz-service-detail-view>
|
></sz-service-detail-view>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
@@ -265,34 +489,117 @@ export class ObViewServices extends DeesElement {
|
|||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private navigateToPlatformDetail(type: string): void {
|
||||||
|
// Reset to list first to force fresh DOM for dees-chart-log
|
||||||
|
this.currentView = 'list';
|
||||||
|
this.selectedPlatformType = type;
|
||||||
|
|
||||||
|
// Clear previous stats/logs before fetching new ones
|
||||||
|
appstate.servicesStatePart.setState({
|
||||||
|
...appstate.servicesStatePart.getState(),
|
||||||
|
currentPlatformServiceStats: null,
|
||||||
|
currentPlatformServiceLogs: [],
|
||||||
|
});
|
||||||
|
|
||||||
|
// Fetch stats and logs for this platform service
|
||||||
|
const serviceType = type as interfaces.data.TPlatformServiceType;
|
||||||
|
appstate.servicesStatePart.dispatchAction(appstate.fetchPlatformServiceStatsAction, { serviceType });
|
||||||
|
appstate.servicesStatePart.dispatchAction(appstate.fetchPlatformServiceLogsAction, { serviceType });
|
||||||
|
|
||||||
|
// Switch to detail view on next microtask (ensures fresh DOM)
|
||||||
|
requestAnimationFrame(() => {
|
||||||
|
this.currentView = 'platform-detail';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private renderPlatformDetailView(): TemplateResult {
|
private renderPlatformDetailView(): TemplateResult {
|
||||||
const platformService = this.servicesState.platformServices.find(
|
const platformService = this.servicesState.platformServices.find(
|
||||||
(ps) => ps.type === this.selectedPlatformType,
|
(ps) => ps.type === this.selectedPlatformType,
|
||||||
);
|
);
|
||||||
|
const stats = this.servicesState.currentPlatformServiceStats;
|
||||||
|
const metrics = {
|
||||||
|
cpu: stats ? Math.round(stats.cpuPercent) : 0,
|
||||||
|
memory: stats ? Math.round(stats.memoryPercent) : 0,
|
||||||
|
storage: 0,
|
||||||
|
connections: undefined as number | undefined,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Real service info per platform type
|
||||||
|
const serviceInfo: Record<string, { host: string; port: number; version: string; config: Record<string, any> }> = {
|
||||||
|
mongodb: { host: 'onebox-mongodb', port: 27017, version: '4.4', config: { engine: 'WiredTiger', authEnabled: true } },
|
||||||
|
minio: { host: 'onebox-minio', port: 9000, version: 'latest', config: { consolePort: 9001, region: 'us-east-1' } },
|
||||||
|
clickhouse: { host: 'onebox-clickhouse', port: 8123, version: 'latest', config: { nativePort: 9000, httpPort: 8123 } },
|
||||||
|
caddy: { host: 'onebox-caddy', port: 80, version: '2-alpine', config: { httpsPort: 443, adminApi: 2019 } },
|
||||||
|
};
|
||||||
|
const info = platformService
|
||||||
|
? serviceInfo[platformService.type] || { host: 'unknown', port: 0, version: '', config: {} }
|
||||||
|
: { host: '', port: 0, version: '', config: {} };
|
||||||
|
|
||||||
|
// Map backend status to catalog-compatible status
|
||||||
|
const mapPlatformStatus = (status: string): 'running' | 'stopped' | 'error' => {
|
||||||
|
switch (status) {
|
||||||
|
case 'running': return 'running';
|
||||||
|
case 'failed': return 'error';
|
||||||
|
case 'starting':
|
||||||
|
case 'stopping':
|
||||||
|
case 'stopped':
|
||||||
|
case 'not-deployed':
|
||||||
|
default: return 'stopped';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
<ob-sectionheading>Platform Service</ob-sectionheading>
|
<ob-sectionheading>Platform Service</ob-sectionheading>
|
||||||
|
<div class="page-actions" style="justify-content: flex-start;">
|
||||||
|
<button class="deploy-button" style="background: transparent; border: 1px solid var(--ci-shade-2, #27272a); color: inherit;" @click=${() => { this.currentView = 'list'; }}>
|
||||||
|
← Back to Services
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
<sz-platform-service-detail-view
|
<sz-platform-service-detail-view
|
||||||
.service=${platformService
|
.service=${platformService
|
||||||
? {
|
? {
|
||||||
id: platformService.type,
|
id: platformService.type,
|
||||||
name: platformService.displayName,
|
name: platformService.displayName,
|
||||||
type: platformService.type,
|
type: platformService.type,
|
||||||
status: platformService.status,
|
status: mapPlatformStatus(platformService.status),
|
||||||
version: '',
|
version: info.version,
|
||||||
host: 'localhost',
|
host: info.host,
|
||||||
port: 0,
|
port: info.port,
|
||||||
config: {},
|
config: info.config,
|
||||||
|
metrics,
|
||||||
}
|
}
|
||||||
: null}
|
: null}
|
||||||
.logs=${[]}
|
.logs=${this.servicesState.currentPlatformServiceLogs.map((log) => ({
|
||||||
@start=${() => {
|
timestamp: new Date(log.timestamp).toISOString(),
|
||||||
appstate.servicesStatePart.dispatchAction(appstate.startPlatformServiceAction, {
|
level: log.level,
|
||||||
serviceType: this.selectedPlatformType as any,
|
message: log.message,
|
||||||
|
}))}
|
||||||
|
@back=${() => {
|
||||||
|
this.currentView = 'list';
|
||||||
|
}}
|
||||||
|
@start=${async () => {
|
||||||
|
await appstate.servicesStatePart.dispatchAction(appstate.startPlatformServiceAction, {
|
||||||
|
serviceType: this.selectedPlatformType as interfaces.data.TPlatformServiceType,
|
||||||
|
});
|
||||||
|
// Refresh stats after starting
|
||||||
|
appstate.servicesStatePart.dispatchAction(appstate.fetchPlatformServiceStatsAction, {
|
||||||
|
serviceType: this.selectedPlatformType as interfaces.data.TPlatformServiceType,
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
@stop=${() => {
|
@stop=${async () => {
|
||||||
appstate.servicesStatePart.dispatchAction(appstate.stopPlatformServiceAction, {
|
await appstate.servicesStatePart.dispatchAction(appstate.stopPlatformServiceAction, {
|
||||||
serviceType: this.selectedPlatformType as any,
|
serviceType: this.selectedPlatformType as interfaces.data.TPlatformServiceType,
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
@restart=${async () => {
|
||||||
|
await appstate.servicesStatePart.dispatchAction(appstate.stopPlatformServiceAction, {
|
||||||
|
serviceType: this.selectedPlatformType as interfaces.data.TPlatformServiceType,
|
||||||
|
});
|
||||||
|
await appstate.servicesStatePart.dispatchAction(appstate.startPlatformServiceAction, {
|
||||||
|
serviceType: this.selectedPlatformType as interfaces.data.TPlatformServiceType,
|
||||||
|
});
|
||||||
|
appstate.servicesStatePart.dispatchAction(appstate.fetchPlatformServiceStatsAction, {
|
||||||
|
serviceType: this.selectedPlatformType as interfaces.data.TPlatformServiceType,
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
></sz-platform-service-detail-view>
|
></sz-platform-service-detail-view>
|
||||||
|
|||||||
155
ts_web/environments/backend-environment.ts
Normal file
155
ts_web/environments/backend-environment.ts
Normal file
@@ -0,0 +1,155 @@
|
|||||||
|
/**
|
||||||
|
* BackendExecutionEnvironment — implements IExecutionEnvironment
|
||||||
|
* by routing all filesystem and process operations through the onebox API
|
||||||
|
* to Docker exec on the target container.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import * as plugins from '../plugins.js';
|
||||||
|
import * as interfaces from '../../ts_interfaces/index.js';
|
||||||
|
|
||||||
|
// Import IExecutionEnvironment type from dees-catalog
|
||||||
|
type IExecutionEnvironment = import('@design.estate/dees-catalog').IExecutionEnvironment;
|
||||||
|
type IFileEntry = import('@design.estate/dees-catalog').IFileEntry;
|
||||||
|
type IFileWatcher = import('@design.estate/dees-catalog').IFileWatcher;
|
||||||
|
type IProcessHandle = import('@design.estate/dees-catalog').IProcessHandle;
|
||||||
|
|
||||||
|
const domtools = plugins.deesElement.domtools;
|
||||||
|
|
||||||
|
export class BackendExecutionEnvironment implements IExecutionEnvironment {
|
||||||
|
readonly type = 'backend' as const;
|
||||||
|
private _ready = false;
|
||||||
|
private identity: interfaces.data.IIdentity;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private serviceName: string,
|
||||||
|
identity: interfaces.data.IIdentity,
|
||||||
|
) {
|
||||||
|
this.identity = identity;
|
||||||
|
}
|
||||||
|
|
||||||
|
get ready(): boolean {
|
||||||
|
return this._ready;
|
||||||
|
}
|
||||||
|
|
||||||
|
async init(): Promise<void> {
|
||||||
|
// Verify the container is accessible by checking if root exists
|
||||||
|
const result = await this.fireRequest<interfaces.requests.IReq_WorkspaceExists>(
|
||||||
|
'workspaceExists',
|
||||||
|
{ path: '/' },
|
||||||
|
);
|
||||||
|
if (!result.exists) {
|
||||||
|
throw new Error(`Cannot access container filesystem for service: ${this.serviceName}`);
|
||||||
|
}
|
||||||
|
this._ready = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
async destroy(): Promise<void> {
|
||||||
|
this._ready = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
async readFile(path: string): Promise<string> {
|
||||||
|
const result = await this.fireRequest<interfaces.requests.IReq_WorkspaceReadFile>(
|
||||||
|
'workspaceReadFile',
|
||||||
|
{ path },
|
||||||
|
);
|
||||||
|
return result.content;
|
||||||
|
}
|
||||||
|
|
||||||
|
async writeFile(path: string, contents: string): Promise<void> {
|
||||||
|
await this.fireRequest<interfaces.requests.IReq_WorkspaceWriteFile>(
|
||||||
|
'workspaceWriteFile',
|
||||||
|
{ path, content: contents },
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
async readDir(path: string): Promise<IFileEntry[]> {
|
||||||
|
const result = await this.fireRequest<interfaces.requests.IReq_WorkspaceReadDir>(
|
||||||
|
'workspaceReadDir',
|
||||||
|
{ path },
|
||||||
|
);
|
||||||
|
return result.entries;
|
||||||
|
}
|
||||||
|
|
||||||
|
async mkdir(path: string): Promise<void> {
|
||||||
|
await this.fireRequest<interfaces.requests.IReq_WorkspaceMkdir>(
|
||||||
|
'workspaceMkdir',
|
||||||
|
{ path },
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
async rm(path: string, options?: { recursive?: boolean }): Promise<void> {
|
||||||
|
await this.fireRequest<interfaces.requests.IReq_WorkspaceRm>(
|
||||||
|
'workspaceRm',
|
||||||
|
{ path, recursive: options?.recursive },
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
async exists(path: string): Promise<boolean> {
|
||||||
|
const result = await this.fireRequest<interfaces.requests.IReq_WorkspaceExists>(
|
||||||
|
'workspaceExists',
|
||||||
|
{ path },
|
||||||
|
);
|
||||||
|
return result.exists;
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(
|
||||||
|
_path: string,
|
||||||
|
_callback: (event: 'rename' | 'change', filename: string | null) => void,
|
||||||
|
_options?: { recursive?: boolean },
|
||||||
|
): IFileWatcher {
|
||||||
|
// Polling-based file watching — check for changes periodically
|
||||||
|
// For now, return a no-op watcher. Full implementation would poll readDir.
|
||||||
|
return { stop: () => {} };
|
||||||
|
}
|
||||||
|
|
||||||
|
async spawn(command: string, args?: string[]): Promise<IProcessHandle> {
|
||||||
|
// For interactive shell: execute the command via the workspace exec API
|
||||||
|
// and return a process handle that bridges stdin/stdout
|
||||||
|
const cmd = args ? [command, ...args] : [command];
|
||||||
|
const fullCommand = cmd.join(' ');
|
||||||
|
|
||||||
|
// Use a non-interactive exec for now — full interactive shell would need
|
||||||
|
// TypedSocket bidirectional streaming (to be implemented)
|
||||||
|
const result = await this.fireRequest<interfaces.requests.IReq_WorkspaceExec>(
|
||||||
|
'workspaceExec',
|
||||||
|
{ command: cmd[0], args: cmd.slice(1) },
|
||||||
|
);
|
||||||
|
|
||||||
|
// Create a ReadableStream from the exec output
|
||||||
|
const output = new ReadableStream<string>({
|
||||||
|
start(controller) {
|
||||||
|
if (result.stdout) controller.enqueue(result.stdout);
|
||||||
|
if (result.stderr) controller.enqueue(result.stderr);
|
||||||
|
controller.close();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// Create a writable stream (no-op for non-interactive)
|
||||||
|
const inputStream = new WritableStream<string>();
|
||||||
|
|
||||||
|
return {
|
||||||
|
output,
|
||||||
|
input: inputStream,
|
||||||
|
exit: Promise.resolve(result.exitCode),
|
||||||
|
kill: () => {},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper to fire TypedRequests to the workspace API
|
||||||
|
*/
|
||||||
|
private async fireRequest<T extends { method: string; request: any; response: any }>(
|
||||||
|
method: string,
|
||||||
|
data: Omit<T['request'], 'identity' | 'serviceName'>,
|
||||||
|
): Promise<T['response']> {
|
||||||
|
const typedRequest = new domtools.plugins.typedrequest.TypedRequest<T>(
|
||||||
|
'/typedrequest',
|
||||||
|
method,
|
||||||
|
);
|
||||||
|
return await typedRequest.fire({
|
||||||
|
identity: this.identity,
|
||||||
|
serviceName: this.serviceName,
|
||||||
|
...data,
|
||||||
|
} as T['request']);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,9 +5,13 @@ import * as deesCatalog from '@design.estate/dees-catalog';
|
|||||||
// @serve.zone scope — side-effect import registers all sz-* custom elements
|
// @serve.zone scope — side-effect import registers all sz-* custom elements
|
||||||
import '@serve.zone/catalog';
|
import '@serve.zone/catalog';
|
||||||
|
|
||||||
|
// TypedSocket for real-time server push (logs, events)
|
||||||
|
import * as typedsocket from '@api.global/typedsocket';
|
||||||
|
|
||||||
export {
|
export {
|
||||||
deesElement,
|
deesElement,
|
||||||
deesCatalog,
|
deesCatalog,
|
||||||
|
typedsocket,
|
||||||
};
|
};
|
||||||
|
|
||||||
// domtools gives us TypedRequest, smartstate, smartrouter, and other utilities
|
// domtools gives us TypedRequest, smartstate, smartrouter, and other utilities
|
||||||
|
|||||||
Reference in New Issue
Block a user