Skip to content

Features in support of proper packaged releases.#4

Merged
dobs merged 12 commits intomasterfrom
release-features
Apr 24, 2020
Merged

Features in support of proper packaged releases.#4
dobs merged 12 commits intomasterfrom
release-features

Conversation

@dobs
Copy link
Copy Markdown
Contributor

@dobs dobs commented Apr 23, 2020

This PR lumps together a bunch of changes in support of producing stable packages for release:

  • Release scripts for deb/rpm installs.
  • Additional features around pid tracking. This will allow us to track existing running instances of the agent, plus provide some stability for commands like pdagent server stop.
  • Config separation for production versus development. In "development" mode (the default) everything is stored in ~/.pdagent. In "production" mode things are stored under appropriate system directories (e.g. /var/.../pdagent, /etc/pdagent).

Comment thread .goreleaser.yml
Comment on lines +53 to +68
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"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread cmd/root.go
_ = viper.ReadInConfig()
}

type Defaults struct {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should extract at some point, but work for the time being.

Comment thread cmd/root.go
Secret string
}

func getDefaults() Defaults {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Comment thread pkg/common/logging.go
var BaseLogger *zap.Logger
var Logger *zap.SugaredLogger

// TODO: Eventually move configuration to config files.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Comment thread pkg/server/server.go

stop := make(chan os.Signal, 1)
signal.Notify(stop, os.Interrupt)
signal.Notify(stop, syscall.SIGINT, syscall.SIGTERM)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

syscall.SIGINT is equivalent to os.Interrupt, syscall.SIGTERM is what we'd expect to receive during a graceful shutdown.

Copy link
Copy Markdown

@blagh blagh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me 👍

@dobs dobs force-pushed the release-features branch from 950af06 to ed4b93f Compare April 24, 2020 15:19
@dobs dobs merged commit cad221c into master Apr 24, 2020
@dobs dobs deleted the release-features branch April 24, 2020 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants