Compare commits
4 Commits
0.1.0-alph
...
0.2.0
Author | SHA1 | Date | |
---|---|---|---|
bd81739d29 | |||
173e324bf3 | |||
f907ef83cf | |||
39031e23df |
11
Dockerfile
11
Dockerfile
@ -8,13 +8,8 @@ RUN nimble build -y
|
|||||||
|
|
||||||
FROM alpine
|
FROM alpine
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
RUN apk -v --update add --no-cache pcre
|
||||||
|
|
||||||
RUN apk add --no-cache \
|
RUN mkdir -p /data
|
||||||
python3 \
|
|
||||||
py3-pip \
|
|
||||||
&& pip3 install --upgrade pip \
|
|
||||||
&& pip3 install --no-cache-dir awscli \
|
|
||||||
&& rm -rf /var/cache/apk/*
|
|
||||||
|
|
||||||
COPY --from=build /toclerbe/toclerbe /
|
COPY --from=build /toclerbe/toclerbe /
|
||||||
CMD ["/toclerbe", "/toclerbe/data/urls.txt"]
|
CMD ["/toclerbe", "/data/urls.txt"]
|
||||||
|
5
Makefile
5
Makefile
@ -22,10 +22,11 @@ build-image: $(SOURCES)
|
|||||||
push-image: build-image
|
push-image: build-image
|
||||||
docker push $(ECR_ACCOUNT_URL)/toclerbe:$(VERSION)
|
docker push $(ECR_ACCOUNT_URL)/toclerbe:$(VERSION)
|
||||||
|
|
||||||
serve-docker: build-image start-postgres
|
serve-docker: build-image
|
||||||
docker run \
|
docker run \
|
||||||
|
-v "data:/data" \
|
||||||
-e TOCLERBE_PORT=80 \
|
-e TOCLERBE_PORT=80 \
|
||||||
-e TOCLERBE_API_KEYS=qwertyasdfgh
|
-e TOCLERBE_API_KEYS=qwertyasdfgh \
|
||||||
-e "ISSUER=$(ISSUER)" \
|
-e "ISSUER=$(ISSUER)" \
|
||||||
-p 127.0.0.1:$(PORT):80/tcp \
|
-p 127.0.0.1:$(PORT):80/tcp \
|
||||||
$(ECR_ACCOUNT_URL)/toclerbe:$(VERSION)
|
$(ECR_ACCOUNT_URL)/toclerbe:$(VERSION)
|
||||||
|
@ -2,6 +2,13 @@ resource "aws_secretsmanager_secret" "toclerbe" {
|
|||||||
name = "${var.app_name}-config"
|
name = "${var.app_name}-config"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resource "aws_efs_mount_target" "ortis" {
|
||||||
|
file_system_id = data.terraform_remote_state.jdbsoft.outputs.sobeck-efs.id
|
||||||
|
subnet_id = data.terraform_remote_state.jdbsoft.outputs.aws_subnet_private2.id
|
||||||
|
security_groups = [ data.terraform_remote_state.jdbsoft.outputs.aws_security_group_private_traffic.id ]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
resource "aws_ecs_task_definition" "toclerbe" {
|
resource "aws_ecs_task_definition" "toclerbe" {
|
||||||
family = var.app_name
|
family = var.app_name
|
||||||
network_mode = "bridge"
|
network_mode = "bridge"
|
||||||
@ -24,7 +31,7 @@ resource "aws_ecs_task_definition" "toclerbe" {
|
|||||||
]
|
]
|
||||||
mountPoints = [
|
mountPoints = [
|
||||||
{
|
{
|
||||||
containerPath = "/toclerbe/data"
|
containerPath = "/data"
|
||||||
sourceVolume = "efs-toclerbe-data"
|
sourceVolume = "efs-toclerbe-data"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -39,3 +39,8 @@ resource "aws_lb_listener_rule" "toclerbe" {
|
|||||||
Name = "${var.app_domain} HTTPS"
|
Name = "${var.app_domain} HTTPS"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resource "aws_lb_listener_certificate" "toclerbe" {
|
||||||
|
listener_arn = data.terraform_remote_state.jdbsoft.outputs.aws_lb_listener_https.arn
|
||||||
|
certificate_arn = data.terraform_remote_state.jdbsoft.outputs.aws_acm_certificate_clerbe_arn
|
||||||
|
}
|
||||||
|
52
operations/terraform/route53.tf
Normal file
52
operations/terraform/route53.tf
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
resource "aws_route53_zone" "clerbe" {
|
||||||
|
name = "cler.be"
|
||||||
|
comment = "Short domain for JDB Software services."
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
|
// Routes and certificates defined on cler.be
|
||||||
|
// ===========================================================================
|
||||||
|
|
||||||
|
resource "aws_route53_record" "to_clerbe" {
|
||||||
|
name = "to.cler.be"
|
||||||
|
type = "A"
|
||||||
|
zone_id = aws_route53_zone.clerbe.id
|
||||||
|
|
||||||
|
alias {
|
||||||
|
evaluate_target_health = true
|
||||||
|
name = data.terraform_remote_state.jdbsoft.outputs.aws_lb_jdbsoft.dns_name
|
||||||
|
zone_id = data.terraform_remote_state.jdbsoft.outputs.aws_lb_jdbsoft.zone_id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "aws_acm_certificate" "clerbe" {
|
||||||
|
domain_name = "*.cler.be"
|
||||||
|
subject_alternative_names = [ "cler.be" ]
|
||||||
|
validation_method = "DNS"
|
||||||
|
|
||||||
|
lifecycle {
|
||||||
|
create_before_destroy = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "aws_route53_record" "clerbe_cert_validation" {
|
||||||
|
for_each = {
|
||||||
|
for dvo in aws_acm_certificate.clerbe.domain_validation_options: dvo.domain_name => {
|
||||||
|
name = dvo.resource_record_name
|
||||||
|
type = dvo.resource_record_type
|
||||||
|
record = dvo.resource_record_value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
allow_overwrite = true
|
||||||
|
name = each.value.name
|
||||||
|
records = [ each.value.record ]
|
||||||
|
ttl = 300
|
||||||
|
type = each.value.type
|
||||||
|
zone_id = aws_route53_zone.clerbe.zone_id
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "aws_acm_certificate_validation" "clerbe" {
|
||||||
|
certificate_arn = aws_acm_certificate.clerbe.arn
|
||||||
|
validation_record_fqdns = [for record in aws_route53_record.clerbe_cert_validation : record.fqdn]
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
const TOCLERBE_VERSION* = "0.1.0"
|
const TOCLERBE_VERSION* = "0.2.0"
|
||||||
|
|
||||||
const USAGE* = """
|
const USAGE* = """
|
||||||
Usage:
|
Usage:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Package
|
# Package
|
||||||
|
|
||||||
version = "0.1.0"
|
version = "0.2.0"
|
||||||
author = "Jonathan Bernard"
|
author = "Jonathan Bernard"
|
||||||
description = "Jonathan's custom URL shortener/bookmark service."
|
description = "Jonathan's custom URL shortener/bookmark service."
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
Reference in New Issue
Block a user