Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update firewall rules #1443

Merged
merged 3 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions docker/production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ services:
- --providers.docker.exposedByDefault=false
- --entrypoints.web.address=:80
- --entrypoints.websecure.address=:443
- --entrypoints.web.transport.lifeCycle.requestAcceptGraceTimeout=60s
- --entrypoints.web.proxyProtocol.trustedIPs=10.0.0.0/8
- --entrypoints.websecure.transport.lifeCycle.requestAcceptGraceTimeout=60s
- --entrypoints.websecure.proxyProtocol.trustedIPs=10.0.0.0/8
- --entryPoints.websecure.forwardedHeaders.trustedIPs=103.21.244.0/22,103.22.200.0/22,103.31.4.0/22,104.16.0.0/13,104.24.0.0/14,108.162.192.0/18,131.0.72.0/22,141.101.64.0/18,162.158.0.0/15,172.64.0.0/13,173.245.48.0/20,188.114.96.0/20,190.93.240.0/20,197.234.240.0/22,198.41.128.0/17
- --ping
- --ping.entryPoint=web
- --entrypoints.web.http.redirections.entrypoint.to=websecure
- --entrypoints.web.http.redirections.entrypoint.scheme=https
- --providers.docker.constraints=Label(`traefik.constraint-label-stack`,`appwrite`)
Expand Down
49 changes: 49 additions & 0 deletions terraform/modules/digitalocean/droplets.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ resource "digitalocean_project" "homepage" {
digitalocean_droplet.worker[*].urn,
digitalocean_droplet.nfs.urn
])

lifecycle {
ignore_changes = all
}
}

# Tags
Expand Down Expand Up @@ -93,6 +97,51 @@ resource "digitalocean_droplet" "manager" {
}
}

resource "digitalocean_loadbalancer" "public" {
name = "${var.project_name}-${var.region}-${var.environment}"
region = var.region
size_unit = 1
project_id = digitalocean_project.homepage.id
vpc_uuid = digitalocean_vpc.subnet.id
droplet_ids = digitalocean_droplet.manager.*.id

redirect_http_to_https = false
enable_backend_keepalive = true
enable_proxy_protocol = true

forwarding_rule {
entry_port = 80
entry_protocol = "http"

target_port = 80
target_protocol = "http"
}

forwarding_rule {
entry_port = 443
entry_protocol = "http2"

target_port = 443
target_protocol = "http2"

tls_passthrough = true
}

healthcheck {
port = 80
path = "/ping"
protocol = "http"
check_interval_seconds = 3
response_timeout_seconds = 3
unhealthy_threshold = 5
healthy_threshold = 5
}

firewall {
allow = ["cidr:103.21.244.0/22","cidr:103.22.200.0/22","cidr:103.31.4.0/22","cidr:104.16.0.0/13","cidr:104.24.0.0/14","cidr:108.162.192.0/18","cidr:131.0.72.0/22","cidr:141.101.64.0/18","cidr:162.158.0.0/15","cidr:172.64.0.0/13","cidr:173.245.48.0/20","cidr:188.114.96.0/20","cidr:190.93.240.0/20","cidr:197.234.240.0/22","cidr:198.41.128.0/17"]
}
}

resource "digitalocean_droplet" "worker" {
count = var.worker_count
image = var.base_image
Expand Down
Loading