-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[installer] Update the installer (#23902)
* * Add experiment unit file * Setup and start the updater experiment * * Point unit files to the bootstraped version of the updater * Use the helper to setcap on the newly installed helper, with some validation * Activate datadog-updater unit file on bootstrap * Add file header * WIP * Cleanup installer systemd units * Fix the helper script * Fix installer helper setcap command * Rename updater to installer * Remove untrue commit * Add the installer bootstrap in rpm * Remove systemd startup from postinst * Remove /usr/lib/systemd/system package file * Fix linter + windows * Fix fucntion comment * Bootsrap datadog oci latest * add windows shims * Fix updater helper permissions on install * fix windows lint * * Fix updater helper permission check * Fix systemdpath used by updater helper * Add more error messages * check file mode correctly * fix error * Enable installer unit before starting it * fix rpmSystemdPath * Invert systemd path search * Print ls output in e2e tests * skip TestInstallerUnitLoaded on rpm
- Loading branch information
1 parent
42daab7
commit 2be60ca
Showing
17 changed files
with
267 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
omnibus/config/templates/installer/datadog-installer-exp.service.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
[Unit] | ||
Description=Datadog Installer Experiment | ||
After=network.target | ||
OnFailure=datadog-installer.service | ||
Conflicts=datadog-installer.service | ||
JobTimeoutSec=3000 #50 minutes | ||
|
||
[Service] | ||
Type=oneshot | ||
PIDFile=<%= installer_dir %>/run/installer.pid | ||
User=dd-installer | ||
EnvironmentFile=-<%= etc_dir %>/environment | ||
ExecStart=<%= installer_dir %>/bin/installer/installer run -p <%= installer_dir %>/run/installer.pid | ||
ExecStart=<%= installer_dir %>/bin/installer/installer run -p <%= installer_dir %>/run/installer.pid | ||
ExecStart=<%= installer_dir %>/bin/installer/installer run -p <%= installer_dir %>/run/installer.pid | ||
ExecStart=/bin/false | ||
ExecStop=/bin/false | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
5 changes: 3 additions & 2 deletions
5
omnibus/config/templates/installer/datadog-installer.service.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// Unless explicitly stated otherwise all files in this repository are licensed | ||
// under the Apache License Version 2.0. | ||
// This product includes software developed at Datadog (https://www.datadoghq.com/). | ||
// Copyright 2016-present Datadog, Inc. | ||
|
||
//go:build !windows | ||
|
||
package service | ||
|
||
import "github.com/DataDog/datadog-agent/pkg/util/log" | ||
|
||
const ( | ||
installerUnit = "datadog-installer.service" | ||
installerUnitExp = "datadog-installer-exp.service" | ||
) | ||
|
||
var installerUnits = []string{installerUnit, installerUnitExp} | ||
|
||
// SetupInstallerUnit installs and starts the installer systemd units | ||
func SetupInstallerUnit() (err error) { | ||
defer func() { | ||
if err != nil { | ||
log.Errorf("Failed to setup installer units: %s, reverting", err) | ||
} | ||
}() | ||
|
||
for _, unit := range installerUnits { | ||
if err = loadUnit(unit); err != nil { | ||
return err | ||
} | ||
} | ||
|
||
if err = systemdReload(); err != nil { | ||
return err | ||
} | ||
|
||
if err = enableUnit(installerUnit); err != nil { | ||
return err | ||
} | ||
|
||
if err = startUnit(installerUnit); err != nil { | ||
return err | ||
} | ||
return nil | ||
} | ||
|
||
// RemoveInstallerUnit removes the installer systemd units | ||
func RemoveInstallerUnit() { | ||
var err error | ||
for _, unit := range installerUnits { | ||
if err = disableUnit(unit); err != nil { | ||
log.Warnf("Failed to disable %s: %s", unit, err) | ||
} | ||
if err = removeUnit(unit); err != nil { | ||
log.Warnf("Failed to stop %s: %s", unit, err) | ||
} | ||
} | ||
} | ||
|
||
// StartInstallerExperiment installs the experimental systemd units for the installer | ||
func StartInstallerExperiment() error { | ||
return startUnit(installerUnitExp) | ||
} | ||
|
||
// StopInstallerExperiment installs the stable systemd units for the installer | ||
func StopInstallerExperiment() error { | ||
return startUnit(installerUnit) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Unless explicitly stated otherwise all files in this repository are licensed | ||
// under the Apache License Version 2.0. | ||
// This product includes software developed at Datadog (https://www.datadoghq.com/). | ||
// Copyright 2016-present Datadog, Inc. | ||
|
||
//go:build windows | ||
|
||
package service | ||
|
||
// SetupInstallerUnit noop | ||
func SetupInstallerUnit() (err error) { | ||
return nil | ||
} | ||
|
||
// RemoveInstallerUnit noop | ||
func RemoveInstallerUnit() { | ||
} | ||
|
||
// StartInstallerExperiment noop | ||
func StartInstallerExperiment() error { | ||
return nil | ||
} | ||
|
||
// StopInstallerExperiment noop | ||
func StopInstallerExperiment() error { | ||
return nil | ||
} |
Oops, something went wrong.