@ -1,19 +0,0 @@ | |||
# DevOps tools | |||
This folder contains tools that are used for automated testnet deployments at Tendermint. These are tools specialized for the Tendermint infrastructure. However there might be some added value for people that want to set up similar networks. Use them at your own risk. | |||
## slacknotification.py | |||
A small script that can send Slack messages. | |||
Requirements: slackclient python library | |||
Install slackclient by running as root: | |||
``` | |||
pip install slackclient | |||
``` | |||
## terraform-tendermint/ | |||
A few extensions to the terraform-digitalocean and terraform-aws configurations. This folder is not a complete Terraform configuration in itself, merely a few files that can be copied over to the other Terraform folders. It contains extensions specific to the Tendermint infrastructure, such as DNS configuration for testnet nodes. | |||
@ -1,41 +0,0 @@ | |||
import os | |||
from slackclient import SlackClient | |||
import argparse | |||
if __name__ == '__main__': | |||
parser = argparse.ArgumentParser(description="Slack notification script") | |||
parser.add_argument('--channel','-c', required=True, help="Slack channel.") | |||
parser.add_argument('--message','-m', required=True, help="The message to send.") | |||
parser.add_argument('--username', required=False, help="Username used on Slack") | |||
parser.add_argument('--api_token', required=False, help="Slack API token. Can be set in SLACK_API_TOKEN environment variable too.") | |||
parser.add_argument('--icon_emoji','-i', required=False, help="Icon for the message.") | |||
args = parser.parse_args() | |||
username = args.username | |||
api_token=args.api_token | |||
if api_token is None: | |||
api_token=os.getenv("SLACK_API_TOKEN") | |||
message = args.message | |||
channel = args.channel | |||
icon_emoji = args.icon_emoji | |||
slack_client = SlackClient(api_token) | |||
apitest = slack_client.api_call("api.test") | |||
if not apitest['ok']: | |||
raise ValueError("api.test error: {0}".format(apitest['error'])) | |||
authtest = slack_client.api_call("auth.test") | |||
if not authtest['ok']: | |||
raise ValueError("auth.test error: {0}".format(authtest['error'])) | |||
if username is None: | |||
username = authtest['user'] | |||
if icon_emoji is None: | |||
result = slack_client.api_call("chat.postMessage", channel=channel, text=message, username=username, icon_emoji=icon_emoji) | |||
else: | |||
result = slack_client.api_call("chat.postMessage", channel=channel, text=message, username=username) | |||
if not result['ok']: | |||
raise ValueError("Message error: {0}".format(result['error'])) | |||
@ -1,31 +0,0 @@ | |||
#resource "digitalocean_floating_ip" "cluster" { | |||
# droplet_id = "${element(digitalocean_droplet.cluster.*.id,count.index)}" | |||
# region = "${element(digitalocean_droplet.cluster.*.region,count.index)}" | |||
# count = "${var.servers}" | |||
#} | |||
provider "aws" { | |||
} | |||
data "aws_route53_zone" "cluster" { | |||
name = "testnets.interblock.io." | |||
} | |||
resource "aws_route53_record" "cluster-node" { | |||
zone_id = "${data.aws_route53_zone.cluster.zone_id}" | |||
name = "${var.name}-node${count.index}" | |||
type = "A" | |||
ttl = "300" | |||
records = ["${element(digitalocean_droplet.cluster.*.ipv4_address,count.index)}"] | |||
count = "${var.servers}" | |||
} | |||
resource "aws_route53_record" "cluster-regions" { | |||
zone_id = "${data.aws_route53_zone.cluster.zone_id}" | |||
name = "${var.name}-${element(digitalocean_droplet.cluster.*.region,count.index)}" | |||
type = "CNAME" | |||
ttl = "300" | |||
records = ["${element(aws_route53_record.cluster-node.*.name,count.index)}.${data.aws_route53_zone.cluster.name}"] | |||
count = "${var.servers}" | |||
} | |||
@ -1,4 +0,0 @@ | |||
#output "floating_ips" { | |||
# value = "${module.cluster.floating_ips}" | |||
#} | |||