[systemd-devel] Deployment/environment names [was: Re: [PATCH 2/4] Add ENVIRONMENT to hostnamed]

Josh Triplett josh at joshtriplett.org
Tue Jul 8 15:45:50 PDT 2014


[Responding to this version because the latest thread hasn't appeared in
the mbox archives yet.  The comments apply equally well to the latest
version, "Add DEPLOYMENT to hostnamectl".]

On Tue, Jul 08, 2014 at 12:38:50AM +0000, Jóhann B. Guðmundsson wrote:
> +static bool valid_environment(const char *environment) {
> +
> +        assert(environment);
> +
> +        return nulstr_contains(
> +                        "development\0"
> +                        "staging\0"
> +                        "production\0",
> +                        environment);
> +}

Can we please *not* attempt to limit or "standardize" this particular
set of machine roles?  As already demonstrated in the previous thread,
people have all sorts of staged deployment strategies.  Furthermore,
the concept of a machine role shouldn't be limited to service deployment
strategies.

Debian has a file /etc/debian_chroot, used to describe the nature of a
chroot environment, such as "i386 cross" for a 32-bit build chroot, or
similar.  The default prompt then incorporates that string.  This seems
quite similar, and I'd love to see a standardized mechanism for that
kind of string.

Rather than limiting this list to a few specific tokens, could we just
provide a "MachineRole" or similar, which accepts a short freeform text
string?  Then, a staged deployment system could use this for
development/staging/production/validation/replication/blue/whatever,
while another type of system can use its own tokens here.

As general guidance, we could say something like "MachineRole should
consist of a space-separated series of printable tokens, such as
'production' or 'staging'.".  This also allows MachineRole to contain
something like "staging foobranch", for instance, which indicates a
staging server that's part of the experimental parallel foobranch
infrastructure.

This would still allow the role string to serve its primary functions:
querying it to check for particular values used within an organization,
or inserting it into prompts, window titles, and similar.

- Josh Triplett


More information about the systemd-devel mailing list