This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"variables": { | |
"name": "redash", | |
"ami_name": "redash", | |
"redash_version": "7.0.0", | |
"account_id": null | |
}, | |
"builders": [ | |
{ | |
"type": "amazon-ebs", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '2' | |
x-redash-service: &redash-service | |
# Get the latest image available from https://hub.docker.com/r/redash/redash/tags | |
image: redash/redash:7.0.0.b18042 | |
# Load ENV vars as file | |
env_file: /opt/redash/env | |
restart: always | |
services: | |
server: | |
<<: *redash-service |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -eux | |
REDASH_BASE_PATH=/opt/redash | |
create_directories() { | |
if [[ ! -e $REDASH_BASE_PATH ]]; then | |
sudo mkdir -p $REDASH_BASE_PATH | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
echo 'Cleaning up after bootstrapping...' | |
rm -rf /tmp/* | |
cat /dev/null > ~/.bash_history | |
history -c | |
exit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|- packer/ | |
| | - redash.json | |
| | /packer-redash/ | |
| | | /files/ | |
| | | | - docker-compose.yml | |
| | | | |
| | | /shell/ | |
| | | | - bootstrap.sh | |
| | | | - cleanup.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* subnet group used by rds */ | |
resource "aws_db_subnet_group" "rds_subnet_group" { | |
name = "redash-rds-subnet-group" | |
description = "Redash RDS subnet group" | |
subnet_ids = ["${var.rds_subnet_ids}"] | |
tags { | |
Environment = "${var.environment}" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "aws_elasticache_subnet_group" "redis_subnet_group" { | |
name = "redash-redis-subnet-group" | |
description = "Redash Redis subnet group" | |
subnet_ids = ["${var.redis_subnet_ids}"] | |
} | |
resource "aws_elasticache_cluster" "redis" { | |
cluster_id = "redash-redis-cluster" | |
engine = "redis" | |
node_type = "${var.redis_instance_class}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "aws_acm_certificate" "ssl_cert" { | |
domain_name = "redash.${var.main_domain}" | |
validation_method = "DNS" | |
} | |
resource "aws_route53_record" "cert_validation_dns_record" { | |
name = "${aws_acm_certificate.ssl_cert.domain_validation_options.0.resource_record_name}" | |
type = "CNAME" | |
zone_id = "${var.main_domain_zone_id}" | |
records = ["${aws_acm_certificate.ssl_cert.domain_validation_options.0.resource_record_value}"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "aws_elb" "redash_service_elb" { | |
name = "redash-service-lb" | |
subnets = ["${var.loadbalancer_subnets}"] | |
security_groups = ["${aws_security_group.redash_service_loadbalancer_sg.id}"] | |
instances = ["${aws_instance.redash_service_ec2.id}"] | |
listener { | |
instance_port = 80 | |
instance_protocol = "http" | |
lb_port = 443 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Security Group for EC2 resources allowing only traffic from ELB | |
resource "aws_security_group" "redash_service_instances_sg" { | |
name = "redash-service-instances-sg" | |
description = "Redash Serving instancs Security Group" | |
vpc_id = "${var.vpc_id}" | |
ingress { | |
from_port = 80 | |
to_port = 80 | |
protocol = "tcp" |
OlderNewer