getting-into-consul
getting-into-consul copied to clipboard
Systemd file does not appear to autocreate
Hello! I've been following along the youtube tutorial, thanks for creating it, it's a great resource.
I started to take a crack at deploying the project myself, and ran into an issue where the systemd file does not get created automatically. I know in the recording you were surprised it was even there, is it supposed to be autocreated? What specifically creates the file?
Details: I'm using the existing configuration (AMI, ec2 instance type, etc) at part-1, but just not having the service start up correctly. Not sure if the project should manually be creating the file.
Hi @mikeobr, thanks for reaching out! Which systemd file? All of them or one for the server or just the ones for the services on the clients?
Specifically for part-1, the server and client. From the client.sh
# Install Consul. This creates...
# 1 - a default /etc/consul.d/consul.hcl
# 2 - a default systemd consul.service file
However I didn't see a default systemd consul.service file created and the sudo systemctl start consul
failed. After I followed the manual steps to touch + fill out the consul.service file, then I was able to start consul.
Interesting...perhaps its the results of the consul upgrade, but, at least when part-1 was done, installing consul would result in the service file being generated. That said, I recently stood things up without this issue, so just to double check, were there any other things changed in your deployment? (i.e. AMI)
No changes outside the provider to target my aws account's role. This was only for part-1 IAC, I jumped to part-4 and it works there since it's creating the systemd files: https://github.com/jcolemorrison/getting-into-consul/blob/part-4/scripts/client-api.sh#L70
Ah I see. THANK YOU for pointing this out @mikeobr. I'll edit part-1 so that it reflects this. Also, apologies for the delayed response, somehow this got lost in my notifications.
//Hey, I realized in part 1 for ec2.tf,//
tags = merge( { "Name" = "${var.main_project_tag}-server" }, { "Project" = var.main_project_tag } )
user_data = base64encode(templatefile("${path.module}/scripts/server.sh", {
# for injecting variables
})) }
//it is missing the tags. I thought the server was missing the tags, that's why the server.sh script didn't work properly(?)//
tags = merge( { "Name" = "${var.main_project_tag}-server" }, { "Project" = var.main_project_tag } )
user_data = base64encode(templatefile("${path.module}/scripts/server.sh", {
PROJECT_TAG = "Project"
PROJECT_VALUE = var.main_project_tag
})) }
//By adding the project_tag & project_value, the services works perfectly fine regardless of consul version. It would be lovely if you could double check this part. Thank you for the content!//