-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added local type #18
base: main
Are you sure you want to change the base?
added local type #18
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,8 +85,15 @@ func (ic *InstanceClient) create() error { | |
return nil | ||
} | ||
|
||
func (ic *InstanceClient) serviceName() string { | ||
if ic.data.System.ServiceName != "" { | ||
return ic.data.System.ServiceName | ||
} | ||
return ServiceName | ||
} | ||
|
||
func (ic *InstanceClient) saveProfileScript() error { | ||
envFile := fmt.Sprintf("/etc/profile.d/%s.sh", ServiceName) | ||
envFile := fmt.Sprintf("/etc/profile.d/%s.sh", ic.serviceName()) | ||
|
||
systemEnvMap := ic.data.System.Env | ||
|
||
|
@@ -104,7 +111,7 @@ func (ic *InstanceClient) saveProfileScript() error { | |
} | ||
|
||
func (ic *InstanceClient) configureService() error { | ||
if !ic.data.System.ServiceEnabled || ic.data.Client.Type == "local" { | ||
if !ic.data.System.ServiceEnabled { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't remeber such bool There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. system service is must have; we want to maintain only the single and correct way of setting up AEM instances... maintaining variations will increase complexity There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmm if serviceEnabled = false then runServiceCommand("start") need be replaced by "sh aemw instance launch" command and the similar thing for stopping There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for non-admin usages like on local/dev machine it would be fine |
||
return nil | ||
} | ||
|
||
|
@@ -124,7 +131,7 @@ func (ic *InstanceClient) configureService() error { | |
if err != nil { | ||
return fmt.Errorf("unable to template AEM system service definition: %w", err) | ||
} | ||
serviceFile := fmt.Sprintf("/etc/systemd/system/%s.service", ServiceName) | ||
serviceFile := fmt.Sprintf("/etc/systemd/system/%s.service", ic.serviceName()) | ||
if err := ic.cl.FileWrite(serviceFile, serviceTemplated); err != nil { | ||
return fmt.Errorf("unable to write AEM system service definition '%s': %w", serviceFile, err) | ||
} | ||
|
@@ -136,14 +143,14 @@ func (ic *InstanceClient) configureService() error { | |
} | ||
|
||
func (ic *InstanceClient) runServiceAction(action string) error { | ||
if !ic.data.System.ServiceEnabled || ic.data.Client.Type == "local" { | ||
if !ic.data.System.ServiceEnabled { | ||
return nil | ||
} | ||
|
||
ic.cl.Sudo = true | ||
defer func() { ic.cl.Sudo = false }() | ||
|
||
outBytes, err := ic.cl.RunShellCommand(fmt.Sprintf("systemctl %s %s.service", action, ServiceName), ".") | ||
outBytes, err := ic.cl.RunShellCommand(fmt.Sprintf("systemctl %s %s.service", action, ic.serviceName()), ".") | ||
if err != nil { | ||
return fmt.Errorf("unable to perform AEM system service action '%s': %w", action, err) | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -102,6 +102,7 @@ type System struct { | |
WorkDir string `pulumi:"work_dir,optional"` | ||
Env map[string]string `pulumi:"env,optional"` | ||
ServiceEnabled bool `pulumi:"service_enabled,optional"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ? |
||
ServiceName string `pulumi:"service_name,optional"` | ||
ServiceConfig string `pulumi:"service_config,optional"` | ||
User string `pulumi:"user,optional"` | ||
Bootstrap *InstanceScript `pulumi:"bootstrap,optional"` | ||
|
@@ -112,6 +113,7 @@ func (m *System) Annotate(a infer.Annotator) { | |
a.Describe(&m.WorkDir, "Remote root path where provider-related files will be stored.") | ||
a.Describe(&m.Env, "Environment variables for AEM instances.") | ||
a.Describe(&m.ServiceEnabled, "Enabled the AEM system service (systemd).") | ||
a.Describe(&m.ServiceName, "Name of the AEM system service (systemd).") | ||
a.Describe(&m.ServiceConfig, "Contents of the AEM system service definition file (systemd).") | ||
a.Describe(&m.User, "System user under which AEM instance will be running. By default, the same as the user used to connect to the machine.") | ||
a.Describe(&m.Bootstrap, "Script executed once upon instance connection, often for mounting on VM data volumes from attached disks (e.g., AWS EBS, Azure Disk Storage). This script runs only once, even during instance recreation, as changes are typically persistent and system-wide. If re-execution is needed, it is recommended to set up a new machine.") | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,10 @@ public sealed class System | |
/// </summary> | ||
public readonly bool? Service_enabled; | ||
/// <summary> | ||
/// Name of the AEM system service (systemd). | ||
/// </summary> | ||
public readonly string? Service_name; | ||
/// <summary> | ||
/// System user under which AEM instance will be running. By default, the same as the user used to connect to the machine. | ||
/// </summary> | ||
public readonly string? User; | ||
|
@@ -55,6 +59,8 @@ private System( | |
|
||
bool? service_enabled, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ? |
||
|
||
string? service_name, | ||
|
||
string? user, | ||
|
||
string? work_dir) | ||
|
@@ -64,6 +70,7 @@ private System( | |
Env = env; | ||
Service_config = service_config; | ||
Service_enabled = service_enabled; | ||
Service_name = service_name; | ||
User = user; | ||
Work_dir = work_dir; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.1.2-alpha.1718453175+e73fab23 | ||
0.1.2-alpha.1718453293+5c68305a.dirty |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?