This file contains hidden or 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
func (p *http2clientConnPool) getClientConn(req *Request, addr string, dialOnMiss bool) (*http2ClientConn, error) { | |
// more codes | |
p.mu.Lock() | |
for _, cc := range p.conns[addr] { | |
if st := cc.idleState(); st.canTakeNewRequest { | |
p.mu.Unlock() | |
return cc, nil | |
} | |
} | |
// more codes |
This file contains hidden or 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": "2012-10-17", | |
"Statement": [ | |
{ | |
"Sid": "AddPerm", | |
"Effect": "Allow", | |
"Principal": "*", | |
"Action": "s3:GetObject", | |
"Resource": "arn:aws:s3:::api-doc.domain-a.com/*", | |
"Condition": { |
This file contains hidden or 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
addEventListener('fetch', event => { | |
event.respondWith(handleRequest(event.request)); | |
}) | |
async function handleRequest(request) { | |
return fetch( | |
"http://api-doc.domain-a.com.s3-website-ap-northeast-1.amazonaws.com" | |
+ new URL(request.url).pathname, | |
request); | |
} |
This file contains hidden or 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_ecs_cluster" "cluster" { | |
name = "stateful-fargate" | |
setting { | |
name = "containerInsights" | |
value = "enabled" | |
} | |
tags = { | |
Name = "stateful-fargate" |
This file contains hidden or 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
module "container_definition" { | |
source = "github.com/cloudposse/terraform-aws-ecs-container-definition?ref=0.23.0" | |
container_name = "filebrowser" | |
container_image = "david7482/filebrowser" | |
essential = "true" | |
port_mappings = [ | |
{ | |
protocol = "tcp" |
This file contains hidden or 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_efs_file_system" "efs" { | |
tags = { | |
Name = "filebrowser" | |
} | |
} | |
resource "aws_efs_mount_target" "mount" { | |
file_system_id = aws_efs_file_system.efs.id | |
// create efs mount targets for each AZ |
This file contains hidden or 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_route53_record" "website" { | |
zone_id = data.aws_route53_zone.main.zone_id | |
name = var.fqdn | |
type = "A" | |
alias { | |
evaluate_target_health = false | |
name = aws_cloudfront_distribution.website.domain_name | |
zone_id = aws_cloudfront_distribution.website.hosted_zone_id | |
} |
This file contains hidden or 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_cloudfront_origin_access_identity" "origin_access_identity" { | |
comment = var.website_name | |
} | |
resource "aws_cloudfront_distribution" "website" { | |
enabled = true | |
is_ipv6_enabled = true | |
comment = var.website_name | |
default_root_object = var.index_document | |
price_class = var.cloudfront_price_class |
This file contains hidden or 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" "cert" { | |
provider = aws.us-east-1 | |
domain_name = var.fqdn | |
validation_method = "DNS" | |
} | |
resource "aws_route53_record" "cert_validation" { | |
provider = aws.us-east-1 | |
name = tolist(aws_acm_certificate.cert.domain_validation_options)[0].resource_record_name | |
records = [tolist(aws_acm_certificate.cert.domain_validation_options)[0].resource_record_value] |
This file contains hidden or 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_s3_bucket" "log" { | |
bucket = "${var.website_name}-log" | |
acl = "log-delivery-write" | |
lifecycle_rule { | |
enabled = true | |
expiration { | |
days = 30 | |
} | |
} |
NewerOlder