@@ -16,7 +16,6 @@ import (
1616 "github.com/spf13/cobra"
1717 "github.com/uptrace/opentelemetry-go-extra/otelzap"
1818 "go.uber.org/zap"
19- "gopkg.in/yaml.v3"
2019)
2120
2221func init () {
@@ -36,8 +35,18 @@ var CreateHecateCmd = &cobra.Command{
3635 Short : "Deploy Hecate reverse proxy framework" ,
3736 Long : `Deploy Hecate reverse proxy framework using Docker Compose.
3837
39- MODE 1: YAML Configuration (Recommended)
40- Deploy from a simple YAML config file that defines your apps and their backends.
38+ MODE 1: Interactive Wizard (Default - Human-Centric)
39+ Run without any flags to start an interactive wizard that guides you through:
40+ - Adding apps and their domains
41+ - Configuring backends (upstream services)
42+ - Optional SSO integration via Authentik
43+ - WebRTC/TCP port forwarding setup
44+
45+ eos create hecate # Interactive wizard (recommended)
46+
47+ MODE 2: YAML Configuration (For Automation)
48+ Deploy from a YAML config file that defines your apps and backends.
49+ Useful for scripted deployments or complex multi-service setups.
4150
4251 Example config.yaml:
4352 apps:
@@ -52,22 +61,18 @@ MODE 1: YAML Configuration (Recommended)
5261 authentik:
5362 domain: hera.cybermonkey.dev
5463
55- eos create hecate --config config.yaml
56-
57- MODE 2: Interactive Wizard
58- Interactive setup that guides you through configuration.
59-
60- eos create hecate
64+ eos create hecate --config config.yaml # Deploy from YAML
6165
6266The deployment creates configuration files at /opt/hecate/:
6367- docker-compose.yml - Container orchestration
6468- Caddyfile - Caddy reverse proxy configuration
65- - .env - Environment variables (if Authentik is configured )
69+ - .env - Environment variables (includes Authentik bootstrap credentials )
6670
6771Examples:
72+ eos create hecate # Interactive wizard (starts automatically)
6873 eos create hecate --config example.yaml # Deploy from YAML config
6974 eos create hecate --config example.yaml --output /opt/hecate # Custom output dir
70- eos create hecate # Interactive wizard
75+ eos create config -- hecate # Generate YAML config only (no deployment)
7176 eos create hecate --help # Show this help message` ,
7277 RunE : eos .Wrap (func (rc * eos_io.RuntimeContext , cmd * cobra.Command , args []string ) error {
7378 log := otelzap .Ctx (rc .Ctx )
@@ -95,6 +100,7 @@ Examples:
95100 }
96101
97102 var config * hecate.YAMLHecateConfig
103+ var tempConfigPath string
98104
99105 // Check if config file was provided (YAML override)
100106 if configFile != "" {
@@ -108,52 +114,36 @@ Examples:
108114 return fmt .Errorf ("failed to load YAML config: %w" , err )
109115 }
110116 } else {
111- // No YAML file provided - try loading from Consul KV
112- log .Info ("No config file provided, checking Consul KV" )
113-
114- configStorage , err := hecate .NewConfigStorage (rc )
115- if err != nil {
116- return fmt .Errorf ("failed to initialize Consul storage: %w\n \n " +
117- "Either:\n " +
118- " 1. Provide a YAML config file: eos create hecate --config hecate-config.yaml\n " +
119- " 2. Generate config first: eos create config --hecate\n " +
120- " 3. Ensure Consul is running and accessible" , err )
121- }
122-
123- rawConfig , err := configStorage .LoadConfig (rc )
124- if err != nil {
125- return fmt .Errorf ("failed to load config from Consul KV: %w" , err )
126- }
127-
128- if rawConfig == nil || len (rawConfig .Apps ) == 0 {
129- return fmt .Errorf ("no configuration found in Consul KV\n \n " +
130- "Please run one of:\n " +
131- " 1. Generate config: eos create config --hecate\n " +
132- " 2. Provide YAML file: eos create hecate --config hecate-config.yaml" )
133- }
117+ // No YAML file provided - run interactive wizard
118+ log .Info ("No config file provided, starting interactive wizard" )
119+
120+ // Generate temporary config file path
121+ tempConfigPath = "/tmp/hecate-config-wizard.yaml"
122+ defer func () {
123+ if tempConfigPath != "" {
124+ _ = os .Remove (tempConfigPath )
125+ }
126+ }()
134127
135- log .Info ("Configuration loaded from Consul KV" ,
136- zap .Int ("app_count" , len (rawConfig .Apps )))
128+ // Run interactive config generator (same as 'eos create config --hecate')
129+ log .Info ("terminal prompt: " )
130+ log .Info ("terminal prompt: No configuration file provided." )
131+ log .Info ("terminal prompt: Starting interactive wizard to configure Hecate..." )
132+ log .Info ("terminal prompt: " )
137133
138- // Convert RawYAMLConfig to parsed YAMLHecateConfig
139- // We need to create a temporary YAML file to reuse LoadYAMLConfig
140- // Or we can parse it directly here
141- tempYAMLPath := "/tmp/hecate-config-from-consul.yaml"
142- yamlData , err := yaml .Marshal (rawConfig )
143- if err != nil {
144- return fmt .Errorf ("failed to marshal config: %w" , err )
145- }
146- if err := os .WriteFile (tempYAMLPath , yamlData , 0644 ); err != nil {
147- return fmt .Errorf ("failed to write temp config: %w" , err )
134+ if err := hecate .GenerateConfigFile (rc , tempConfigPath , true ); err != nil {
135+ return fmt .Errorf ("interactive configuration failed: %w" , err )
148136 }
149- defer func () { _ = os .Remove (tempYAMLPath ) }()
150137
151- config , err = hecate .LoadYAMLConfig (rc , tempYAMLPath )
138+ // Load the generated config
139+ config , err = hecate .LoadYAMLConfig (rc , tempConfigPath )
152140 if err != nil {
153- return fmt .Errorf ("failed to parse config from Consul : %w" , err )
141+ return fmt .Errorf ("failed to load generated config : %w" , err )
154142 }
155143
156- log .Info ("terminal prompt: Using configuration from Consul KV" )
144+ log .Info ("terminal prompt: " )
145+ log .Info ("terminal prompt: Configuration complete! Proceeding with deployment..." )
146+ log .Info ("terminal prompt: " )
157147 }
158148
159149 // Display detected apps
0 commit comments