Re: Daniel Kahn Gillmor 2018-02-28 <151977883437.31585.3826803256327598913.report...@alice.fifthhorseman.net> > In particular, a user .service named "exampled" which keeps its > state in `~/.config/example`. An `exampled.service` unit might be > configured with: > > Requires=pgcluster@example.service > After=pgcluster@example.service > > So that if the user service is ever started, the cluster will be > created on demand (in `~/.config/example/data`) and the "example" > database will be ready for use (via unix-domain sockets in > `$XDG_RUNTIME_DIR/example/`) before the user service is started.
Hi Daniel, this is very interesting, especially Type=notify. I haven't yet had time to look closely at the patches - my first question would be if we could integrate the idea more tightly with the existing postgresql@ services which are already capable of launching clusters for different users (though currently hardcoded to /etc/postgresql/*). The cluster machinery itself (pg_ctlcluster and friends) can operate on different roots if PG_CLUSTER_CONF_ROOT is set. Maybe that can be incorporated to work better together. One thing I have been thinking about was to replace pg_ctlcluster with something more systemd-specific, including Type=notify operation. This looks about what you have here. Christoph