getting-into-consul icon indicating copy to clipboard operation
getting-into-consul copied to clipboard

Systemd file does not appear to autocreate

Open mikeobr opened this issue 3 years ago • 6 comments

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.

mikeobr avatar Feb 11 '22 18:02 mikeobr

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?

jcolemorrison avatar Feb 14 '22 17:02 jcolemorrison

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.

mikeobr avatar Feb 14 '22 18:02 mikeobr

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)

jcolemorrison avatar Feb 17 '22 22:02 jcolemorrison

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

mikeobr avatar Feb 18 '22 14:02 mikeobr

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.

jcolemorrison avatar Feb 24 '22 19:02 jcolemorrison

//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!//

HyunsGit avatar Mar 11 '22 02:03 HyunsGit