feat: manage vector container via compose

Using compose instead of manual docker calls allows folks to customize the vector container by using a custom compose.yml template file. This opens us up to more customizations while aligning container management with how we do other external containers (such as for the proxy plugins).

Refs #5784
This commit is contained in:
Jose Diaz-Gonzalez
2024-01-26 06:45:24 -05:00
parent 3dc917253b
commit c49322bd34
7 changed files with 210 additions and 86 deletions

View File

@@ -107,20 +107,9 @@ func CommandVectorStart(vectorImage string) error {
vectorImage = common.PropertyGetDefault("logs", "--global", "vector-image", VectorImage)
}
if common.ContainerExists(vectorContainerName) {
if common.ContainerIsRunning(vectorContainerName) {
common.LogVerbose("Vector container is running")
return nil
}
common.LogVerbose("Starting vector container")
if !common.ContainerStart(vectorContainerName) {
return errors.New("Unable to start vector container")
}
} else {
if err := startVectorContainer(vectorImage); err != nil {
return err
}
common.LogVerbose("Starting vector container")
if err := startVectorContainer(vectorImage); err != nil {
return err
}
common.LogVerbose("Waiting for 10 seconds")
@@ -134,6 +123,6 @@ func CommandVectorStart(vectorImage string) error {
// CommandVectorStop stops and removes an existing vector container
func CommandVectorStop() error {
common.LogInfo2Quiet("Stopping and removing vector container")
return killVectorContainer()
common.LogInfo2Quiet("Stopping and removing vector container")
return stopVectorContainer()
}