Files
dokku/plugins/logs/triggers.go
Jose Diaz-Gonzalez fd85b1f605 feat: add vector integration
This currently is missing a few features:

- global sinks
- logrotation

But works fairly well otherwise.
2021-01-04 00:30:22 -05:00

42 lines
967 B
Go

package logs
import (
"fmt"
"os"
"path/filepath"
"github.com/dokku/dokku/plugins/common"
)
// TriggerInstall initializes app restart policies
func TriggerInstall() error {
if err := common.PropertySetup("logs"); err != nil {
return fmt.Errorf("Unable to install the logs plugin: %s", err.Error())
}
directory := filepath.Join(common.MustGetEnv("DOKKU_LIB_ROOT"), "data", "logs")
if err := os.MkdirAll(directory, 0755); err != nil {
return err
}
if err := common.SetPermissions(directory, 0755); err != nil {
return err
}
logDirectory := filepath.Join(common.MustGetEnv("DOKKU_LOGS_DIR"), "apps")
if err := os.MkdirAll(logDirectory, 0755); err != nil {
return err
}
if err := common.SetPermissions(logDirectory, 0755); err != nil {
return err
}
return nil
}
// TriggerPostDelete destroys the network property for a given app container
func TriggerPostDelete(appName string) error {
return common.PropertyDestroy("logs", appName)
}