feat: onboarding wizard, PWA support, Oracle Cloud free tier deploy, mode nav update

This commit is contained in:
2026-08-03 23:56:42 +01:00
parent 0c0daf947e
commit ffc9ccd77e
8 changed files with 303 additions and 3 deletions

View File

@@ -0,0 +1,98 @@
/**
* Generate a cloud-init script for Oracle Cloud Always Free tier.
* Oracle free tier: 4 ARM Ampere A1 cores, 24GB RAM, 200GB storage.
* This produces a user-data script that installs Docker + Compose,
* sets up the stack, and runs the auto-linker.
*/
export function generateOracleCloudInit(selectedApps, config, composYaml, envContent, setupScript) {
const lines = [
'#!/bin/bash',
'# StackPilot — Oracle Cloud Free Tier Deployment Script',
'# Usage: Paste this as "Cloud-Init Script" when creating your free instance.',
'# Instance shape: VM.Standard.A1.Flex (4 OCPUs, 24GB RAM)',
`# Generated: ${new Date().toISOString()}`,
'',
'set -euo pipefail',
'exec > >(tee /var/log/stackpilot-init.log) 2>&1',
'',
'echo "=== StackPilot Cloud-Init Starting ==="',
'',
'# Update system',
'apt-get update && apt-get upgrade -y',
'',
'# Install Docker',
'curl -fsSL https://get.docker.com | sh',
'systemctl enable docker && systemctl start docker',
'',
'# Install Docker Compose plugin',
'apt-get install -y docker-compose-plugin',
'',
'# Create stackpilot user',
'useradd -m -s /bin/bash -G docker stackpilot || true',
'',
'# Create directories',
`mkdir -p ${config.configPath}`,
`mkdir -p ${config.mediaPath}`,
`mkdir -p ${config.downloadsPath}`,
`chown -R stackpilot:stackpilot ${config.configPath} ${config.mediaPath} ${config.downloadsPath}`,
'',
'# Write docker-compose.yml',
'mkdir -p /home/stackpilot/stack',
'cat > /home/stackpilot/stack/docker-compose.yml << \'COMPOSE_EOF\'',
composYaml,
'COMPOSE_EOF',
'',
'# Write .env',
'cat > /home/stackpilot/stack/.env << \'ENV_EOF\'',
envContent,
'ENV_EOF',
'',
'# Write setup.sh',
'cat > /home/stackpilot/stack/setup.sh << \'SETUP_EOF\'',
setupScript,
'SETUP_EOF',
'chmod +x /home/stackpilot/stack/setup.sh',
'',
'# Set ownership',
'chown -R stackpilot:stackpilot /home/stackpilot/stack',
'',
'# Open firewall ports (Oracle Linux / Ubuntu iptables)',
'iptables -I INPUT -p tcp --match multiport --dports 80,443,8080,8096,8989,7878,9696,8112,32400 -j ACCEPT || true',
'iptables-save > /etc/iptables/rules.v4 2>/dev/null || true',
'',
'# Start the stack',
'cd /home/stackpilot/stack',
'docker compose up -d',
'',
'# Wait and run auto-linker',
'echo "Waiting 60s for services to start..."',
'sleep 60',
'su - stackpilot -c "cd /home/stackpilot/stack && ./setup.sh" || true',
'',
'# Setup auto-start on reboot',
'cat > /etc/systemd/system/stackpilot.service << \'SERVICE_EOF\'',
'[Unit]',
'Description=StackPilot Docker Stack',
'After=docker.service',
'Requires=docker.service',
'',
'[Service]',
'Type=oneshot',
'RemainAfterExit=yes',
'WorkingDirectory=/home/stackpilot/stack',
'ExecStart=/usr/bin/docker compose up -d',
'ExecStop=/usr/bin/docker compose down',
'User=stackpilot',
'',
'[Install]',
'WantedBy=multi-user.target',
'SERVICE_EOF',
'systemctl enable stackpilot.service',
'',
'echo "=== StackPilot Cloud-Init Complete ==="',
`echo "Stack is running! Services: ${selectedApps.filter(a => a.ports?.length > 0).map(a => a.name).join(', ')}"`,
'echo "Check logs: /var/log/stackpilot-init.log"',
];
return lines.join('\n');
}