Features in support of proper packaged releases.#4
Conversation
| overrides: | ||
| deb: | ||
| scripts: | ||
| preinstall: "scripts/deb/preinstall.sh" | ||
| postinstall: "scripts/deb/postinstall.sh" | ||
| preremove: "scripts/deb/preremove.sh" | ||
| postremove: "scripts/deb/postremove.sh" | ||
| rpm: | ||
| scripts: | ||
| preinstall: "scripts/rpm/preinstall.sh" | ||
| postinstall: "scripts/rpm/postinstall.sh" | ||
| preremove: "scripts/rpm/preremove.sh" | ||
| postremove: "scripts/rpm/postremove.sh" |
There was a problem hiding this comment.
May do another pass to consolidate at some point since these.
They're stripped-down versions from the previous PDAgent, but since we don't need to work around Python path oddities we can probably have one set of scripts.
| _ = viper.ReadInConfig() | ||
| } | ||
|
|
||
| type Defaults struct { |
There was a problem hiding this comment.
Should extract at some point, but work for the time being.
| Secret string | ||
| } | ||
|
|
||
| func getDefaults() Defaults { |
There was a problem hiding this comment.
Another option now is to do this as part of init.
This current approach comes from me attempting to do this more dynamically, but that wasn't ideal as it's called in different contexts (e.g. init vs. Run).
| var BaseLogger *zap.Logger | ||
| var Logger *zap.SugaredLogger | ||
|
|
||
| // TODO: Eventually move configuration to config files. |
There was a problem hiding this comment.
Elaborating, we should generate some defaults during init and manage all settings from the config file.
That'd give far more control to users and give us more troubleshooting flexibility (i.e. can have users adjust logging levels as needed).
|
|
||
| stop := make(chan os.Signal, 1) | ||
| signal.Notify(stop, os.Interrupt) | ||
| signal.Notify(stop, syscall.SIGINT, syscall.SIGTERM) |
There was a problem hiding this comment.
syscall.SIGINT is equivalent to os.Interrupt, syscall.SIGTERM is what we'd expect to receive during a graceful shutdown.
This only appears to affect Redhat/CentOS but updating for both rpm and deb just for consistency.
This PR lumps together a bunch of changes in support of producing stable packages for release:
pdagent server stop.~/.pdagent. In "production" mode things are stored under appropriate system directories (e.g. /var/.../pdagent, /etc/pdagent).