mirror of
https://github.com/j3ssie/osmedeus.git
synced 2026-08-22 07:32:27 +02:00
- Update Next.js generated chunk hashes and build IDs reflecting latest dashboard build - Update CSS stylesheet references in workflow upload page metadata - Add comprehensive cloud setup E2E test suite (cloud_setup_test.go) with SSH password/key auth, post-command variable expansion, and Ansible integration - Fix API priority levels to include 'medium' priority in test coverage - Add agent-sdk test workflows (minimal, config, codex, multi-agent, session variants) - Update E2E test utilities with runCLIInBase helper for multi-step cloud config tests - Fix stderr/stdout capture in dependencies_target_types_test assertions
42 lines
972 B
Go
42 lines
972 B
Go
package cloud
|
|
|
|
import "strings"
|
|
|
|
// GenerateCloudInit generates the cloud-init user data script for worker VMs.
|
|
// The script installs osmedeus, sets up SSH access, and joins the worker to the master.
|
|
func GenerateCloudInit(redisURL, sshPublicKey string, setupCommands []string) string {
|
|
var sb strings.Builder
|
|
|
|
sb.WriteString(`#!/bin/bash
|
|
set -e
|
|
|
|
# Install osmedeus
|
|
curl -fsSL https://www.osmedeus.org/install.sh | bash
|
|
|
|
# Setup SSH keys
|
|
mkdir -p ~/.ssh
|
|
`)
|
|
sb.WriteString(`echo "`)
|
|
sb.WriteString(sshPublicKey)
|
|
sb.WriteString(`" >> ~/.ssh/authorized_keys
|
|
chmod 700 ~/.ssh
|
|
chmod 600 ~/.ssh/authorized_keys
|
|
`)
|
|
|
|
if redisURL != "" {
|
|
sb.WriteString("\n# Join as worker\nosmedeus worker join --redis-url ")
|
|
sb.WriteString(redisURL)
|
|
sb.WriteString(" --get-public-ip\n")
|
|
}
|
|
|
|
if len(setupCommands) > 0 {
|
|
sb.WriteString("\n# Custom setup commands\n")
|
|
for _, cmd := range setupCommands {
|
|
sb.WriteString(cmd)
|
|
sb.WriteString("\n")
|
|
}
|
|
}
|
|
|
|
return sb.String()
|
|
}
|