Skip to content

Commit

Permalink
Fix agents config and add awslogs stream config
Browse files Browse the repository at this point in the history
  • Loading branch information
suizman authored and iknite committed Feb 19, 2019
1 parent d66c35e commit f9eb3ad
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 14 deletions.
27 changes: 14 additions & 13 deletions deploy/aws/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ module "leader" {
subnet_id = "${element(data.aws_subnet_ids.all.ids, 0)}"
key_name = "${aws_key_pair.qed.key_name}"
key_path = "${var.keypath}"
command = "start >> /var/tmp/qed/qed.log"

config = <<-CONFIG
---
Expand All @@ -54,6 +55,7 @@ module "follower-1" {
subnet_id = "${element(data.aws_subnet_ids.all.ids, 0)}"
key_name = "${aws_key_pair.qed.key_name}"
key_path = "${var.keypath}"
command = "start >> /var/tmp/qed/qed.log"

config = <<-CONFIG
---
Expand Down Expand Up @@ -84,6 +86,7 @@ module "follower-2" {
subnet_id = "${element(data.aws_subnet_ids.all.ids, 0)}"
key_name = "${aws_key_pair.qed.key_name}"
key_path = "${var.keypath}"
command = "start >> /var/tmp/qed/qed.log"

config = <<-CONFIG
---
Expand Down Expand Up @@ -126,7 +129,7 @@ module "agent-publisher" {
key_name = "${aws_key_pair.qed.key_name}"
key_path = "${var.keypath}"

command="agent publisher"
command = "agent publisher >> /var/tmp/qed/qed.log"
config = <<-CONFIG
---
api_key: "terraform_qed"
Expand All @@ -137,12 +140,10 @@ module "agent-publisher" {
advertise: ""
join:
- "${module.leader.private_ip[0]}:8400"
server_urls:
- "${module.leader.private_ip[0]}:8800"
alert_urls:
- "${module.inmemory-storage.private_ip}:8888"
- "http://${module.inmemory-storage.private_ip}:8888"
snapshots_store_urls:
- "${module.inmemory-storage.private_ip}:8888"
- "http://${module.inmemory-storage.private_ip}:8888"
CONFIG
}

Expand All @@ -158,7 +159,7 @@ module "agent-monitor" {
key_name = "${aws_key_pair.qed.key_name}"
key_path = "${var.keypath}"

command="agent monitor"
command="agent monitor >> /var/tmp/qed/qed.log"
config = <<-CONFIG
---
api_key: "terraform_qed"
Expand All @@ -170,11 +171,11 @@ module "agent-monitor" {
join:
- "${module.leader.private_ip[0]}:8400"
server_urls:
- "${module.leader.private_ip[0]}:8800"
- "https://${module.follower-1.private_ip[0]}:8800"
alert_urls:
- "${module.inmemory-storage.private_ip}:8888"
- "http://${module.inmemory-storage.private_ip}:8888"
snapshots_store_urls:
- "${module.inmemory-storage.private_ip}:8888"
- "http://${module.inmemory-storage.private_ip}:8888"
CONFIG
}

Expand All @@ -189,7 +190,7 @@ module "agent-auditor" {
key_name = "${aws_key_pair.qed.key_name}"
key_path = "${var.keypath}"

command="agent auditor"
command="agent auditor >> /var/tmp/qed/qed.log"
config = <<-CONFIG
---
api_key: "terraform_qed"
Expand All @@ -201,11 +202,11 @@ module "agent-auditor" {
join:
- "${module.leader.private_ip[0]}:8400"
server_urls:
- "${module.leader.private_ip[0]}:8800"
- "https://${module.follower-2.private_ip[0]}:8800"
alert_urls:
- "${module.inmemory-storage.private_ip}:8888"
- "http://${module.inmemory-storage.private_ip}:8888"
snapshots_store_urls:
- "${module.inmemory-storage.private_ip}:8888"
- "http://${module.inmemory-storage.private_ip}:8888"
CONFIG
}

Expand Down
1 change: 0 additions & 1 deletion deploy/aws/modules/prometheus/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
output "private_ip" {
value = "${aws_instance.prometheus.private_ip}"
}

output "public_ip" {
value = "${aws_instance.prometheus.public_ip}"
}
12 changes: 12 additions & 0 deletions deploy/aws/modules/qed/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,18 @@ resource "aws_instance" "qed-server" {
echo "Install and enable AWS CloudWatch"
aws configure set region eu-west-1
sudo yum install -y awslogs
sudo sed -i "s/us-east-1/eu-west-1/g" /etc/awslogs/awscli.conf
sudo cat << EOF >> /etc/awslogs/awslogs.conf
[/var/tmp/qed]
datetime_format = %b %d %H:%M:%S
file = /var/tmp/qed/qed.log
buffer_duration = 5000
log_stream_name = ${var.name}
initial_position = start_of_file
log_group_name = qed
EOF
sudo service awslogs start
while [ ! -f ${var.path}/qed ]; do
Expand Down

0 comments on commit f9eb3ad

Please sign in to comment.