Question about Terrafrom Template 'systemctl enable', missing call to dgraph-zero?

Not sure whether to file this under issues (I normally would) but it doesn’t fit the issue template so I’ll write my question here for now.

Question is related to the terraform cloud-init user_data file found here:
https://github.com/dgraph-io/dgraph/blob/master/contrib/config/terraform/aws/standalone/templates/setup.tmpl

Is there are reason that there isn’t a systemctl enable --now dgraph-zero here?

I’m not particularaly familiar with systemctl nor cloud-init in general so I was a little curious as to whether this is a simple ommision or if this is very much purposeful.

I’m even more confused as the server seems to be working but I assume that shouldn’t be the case without at least a single zero service running?

PS:
Very much enjoyed watching the dgraph conference last week. Had it on in the background in the (home) office for us all to watch throughout :slight_smile:

On further investigation, it is not needed explicitly because systemctl is smart enough to launch the dgraph-zero service because the dgraph service depends on it as shown here?

Here are the docs on systemctl which are applicable: https://www.freedesktop.org/software/systemd/man/systemd.unit.html#Requires=

The important bit being:

If this unit gets activated, the units listed (under Requires=) will be activated as well.

1 Like

In this particular implementation, where a zero node and an alpha node live on the same server (3 x alpha + zero), the dependency chain should work (i.e. requires=). This would not work naturally in an alternative configuration where each zero and each alpha live on a separate server (3 x alpha, 3 x zero), so each of the units would need to be enabled.

2 Likes