Initial commit: Onebox v1.0.0

- Complete Deno-based architecture following nupst/spark patterns
- SQLite database with full schema
- Docker container management
- Service orchestration (Docker + Nginx + DNS + SSL)
- Registry authentication
- Nginx reverse proxy configuration
- Cloudflare DNS integration
- Let's Encrypt SSL automation
- Background daemon with metrics collection
- HTTP API server
- Comprehensive CLI
- Cross-platform compilation setup
- NPM distribution wrapper
- Shell installer script

Core features:
- Deploy containers with single command
- Automatic domain configuration
- Automatic SSL certificates
- Multi-registry support
- Metrics and logging
- Systemd integration

Ready for Angular UI implementation and testing.
This commit is contained in:
2025-10-28 13:05:42 +00:00
commit 246a6073e0
29 changed files with 5227 additions and 0 deletions

70
bin/onebox-wrapper.js Normal file
View File

@@ -0,0 +1,70 @@
#!/usr/bin/env node
/**
* NPM wrapper for Onebox binary
*/
import { spawn } from 'child_process';
import { platform, arch } from 'os';
import { join, dirname } from 'path';
import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
// Detect platform and architecture
const platformMap = {
'linux': 'linux',
'darwin': 'macos',
'win32': 'windows',
};
const archMap = {
'x64': 'x64',
'arm64': 'arm64',
};
const currentPlatform = platformMap[platform()];
const currentArch = archMap[arch()];
if (!currentPlatform || !currentArch) {
console.error(`Unsupported platform: ${platform()} ${arch()}`);
process.exit(1);
}
// Build binary name
const binaryName = `onebox-${currentPlatform}-${currentArch}${currentPlatform === 'windows' ? '.exe' : ''}`;
const binaryPath = join(__dirname, '..', 'dist', 'binaries', binaryName);
// Spawn the binary
const child = spawn(binaryPath, process.argv.slice(2), {
stdio: 'inherit',
windowsHide: true,
});
// Forward signals
const signals = ['SIGINT', 'SIGTERM', 'SIGHUP'];
signals.forEach(signal => {
process.on(signal, () => {
if (!child.killed) {
child.kill(signal);
}
});
});
// Forward exit code
child.on('exit', (code, signal) => {
if (signal) {
process.kill(process.pid, signal);
} else {
process.exit(code || 0);
}
});
child.on('error', (error) => {
console.error(`Failed to start onebox: ${error.message}`);
console.error(`Binary path: ${binaryPath}`);
console.error('Make sure the binary was downloaded correctly.');
console.error('Try running: npm install -g @serve.zone/onebox');
process.exit(1);
});