Consul Clustering .service Questions

Hi :wave:

I’m learning Consul, and I’ve been trying to figure out how to deploy a consul cluster with Terraform on Digitalocean.

My goal is to create secure deployment of a consul cluster and later use with a deployment of a nomad cluster and have them work together. I’ve been learning via the consul docs and a few Github repos. I’ve come across a few files that i’m not certain what they’re for and I couldn’t find them in the docs so I was wondering if someone could explain why they exist:

  • consul-server.service
  • consul-client.service

Some other parts i’m confused about are Consul Connect, I’m not really sure what this is, I think it might be a paid service provided by hashicorp that requires using kubernetes and helm, is that right?

I’ve also found that alot of consul setups include the following snippet, i’m not sure where it originates from but here it is:

if [ $1 == "server" ]; then
	systemctl enable consul-server.service
	systemctl start consul-server.service
else
	systemctl enable consul-client.service
	systemctl start consul-client.service
  	sleep 5
	consul join $3
fi

I’m not familiar with systemctl is that packaged with consul?

I’m sorry if my questions are terrible, i’m a beginner at all these things and hashicorp tools

systemctl is part of systemd, the “orchestrator” for Linux processes. In former times we had SysVinit (init scripts) to handle service/ process startup, reload, shutdown.

Your .service-files handle the startup, reload or shutdown of the processes for Consul client or server.

2 Likes

Note that you could also just have one .service file and run Consul as a client or a server depending on whether you ran it with server = true in the config.

Consul Connect allows services to communicate securely. It’s available in the open source version: https://www.consul.io/docs/connect

2 Likes

Thank you all for pointing me in the right direction!

1 Like