Skip to content

Commit

Permalink
Fix: inmemory-storage deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
suizman authored and iknite committed Feb 19, 2019
1 parent 7f6d34c commit 936dbd4
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 7 deletions.
4 changes: 4 additions & 0 deletions deploy/aws/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,10 @@ module "prometheus" {
scrape_interval: 10s
static_configs:
- targets: ['${module.riot.private_ip}:9100']
- job_name: 'inmemory-storage'
scrape_interval: 10s
static_configs:
- targets: ['${module.inmemory-storage.private_ip}:18888']
CONFIG
}

Expand Down
2 changes: 2 additions & 0 deletions deploy/aws/modules/inmemory_storage/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@

mkdir -p ./data

export GOOS=linux
export GOARCH=amd64
go build -o ./data/storage ../../../../tests/gossip/test_service.go
22 changes: 17 additions & 5 deletions deploy/aws/modules/inmemory_storage/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,28 @@ resource "aws_instance" "inmemory-storage" {
}
}

provisioner "file" {
source = "./config_files/node_exporter"
destination = "${var.path}/node_exporter"

connection {
user = "ec2-user"
private_key = "${file("${var.key_path}")}"
}
}

user_data = <<-DATA
#!/bin/bash
while [ ! -f ${var.path}/storage ]; do
sleep 1 # INFO: wait until binary is complete
while [ ! -f ${var.path}/storage ] || \
[ ! -f ${var.path}/node_exporter ] || \
[ `lsof ${var.path}/* | wc -l` -gt 0 ]; do
sleep 1
done
sleep 1
while [ `lsof ${var.path}/storage | wc -l` -gt 0 ]; do
sleep 1 # INFO: prevents Error of `text file busy`
done
chmod +x ${var.path}/node_exporter
${var.path}/node_exporter &
chmod +x ${var.path}/storage
${var.path}/storage
Expand Down
7 changes: 5 additions & 2 deletions deploy/aws/modules/riot/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,11 @@ resource "aws_instance" "riot" {
user_data = <<-DATA
#!/bin/bash
while [ ! -f ${var.path}/riot ]; do
sleep 1 # INFO: wait until binary is complete
while [ ! -f ${var.path}/riot ] || \
[ ! -f ${var.path}/node_exporter ] || \
[ `lsof ${var.path}/* | wc -l` -gt 0 ]; do
sleep 1
done
sleep 1
Expand Down

0 comments on commit 936dbd4

Please sign in to comment.