This repository has been archived by the owner on Nov 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: ursa gateway fly terraform (#305)
* ursa gateway fly terraform * upgarde terrform provider * use docker image
- Loading branch information
Showing
10 changed files
with
158 additions
and
22 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,4 +11,3 @@ stream_buf = 2000000 # 2mb | |
|
||
[indexer] | ||
cid_url = "https://cid.contact/cid" | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
echo | ||
echo "Building ursa-gateway node" | ||
echo | ||
|
||
docker buildx build \ | ||
--push \ | ||
--platform linux/amd64 \ | ||
--tag fleeknetwork/ursa-gateway:latest \ | ||
-f ./Dockerfile-gateway . |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# fly.toml file generated for floral-shape-3955 on 2023-02-10T17:33:22-05:00 | ||
|
||
app = "floral-shape-3955" | ||
kill_signal = "SIGINT" | ||
kill_timeout = 5 | ||
processes = [] | ||
|
||
[env] | ||
|
||
[experimental] | ||
auto_rollback = true | ||
|
||
[[services]] | ||
http_checks = [] | ||
internal_port = 8080 | ||
processes = ["app"] | ||
protocol = "tcp" | ||
script_checks = [] | ||
[services.concurrency] | ||
hard_limit = 25 | ||
soft_limit = 20 | ||
type = "connections" | ||
|
||
[[services.ports]] | ||
handlers = ["http"] | ||
port = 80 | ||
|
||
[[services.ports]] | ||
handlers = ["tls", "http"] | ||
port = 443 | ||
|
||
[[services.tcp_checks]] | ||
grace_period = "1s" | ||
interval = "15s" | ||
restart_limit = 0 | ||
timeout = "2s" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# regional k8s modules | ||
module "fly_ursa_gateway" { | ||
source = "./fly" | ||
regions = ["yyz", "yul", "ewr", "lax", "ewr", "lhr", "ams"] | ||
fly_domains = ["gateway.ursa.earth"] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
terraform { | ||
required_providers { | ||
fly = { | ||
source = "fly-apps/fly" | ||
version = "0.0.20" | ||
} | ||
} | ||
} | ||
|
||
provider "fly" { | ||
fly_http_endpoint = "api.machines.dev" | ||
} | ||
|
||
resource "fly_app" "ursa_gateway" { | ||
name = "ursa-gateway" | ||
org = "fleek-network" | ||
} | ||
|
||
resource "fly_volume" "ursa_gateway_volume" { | ||
for_each = toset(var.regions) | ||
app = fly_app.ursa_gateway.name | ||
region = each.key | ||
name = "ursa_data_${each.key}" | ||
size = 15 | ||
depends_on = [fly_app.ursa_gateway] | ||
} | ||
|
||
resource "fly_ip" "ursa_gateway_ip" { | ||
app = fly_app.ursa_gateway.name | ||
type = "v4" | ||
depends_on = [fly_app.ursa_gateway] | ||
} | ||
|
||
resource "fly_ip" "ursa_gateway_ipv6" { | ||
app = fly_app.ursa_gateway.name | ||
type = "v6" | ||
depends_on = [fly_app.ursa_gateway] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
resource "fly_machine" "ursa_gateway_machine" { | ||
for_each = toset(var.regions) | ||
app = fly_app.ursa_gateway.name | ||
region = each.key | ||
name = "ursa-gateway-${each.key}" | ||
image = "fleeknetwork/ursa-gateway:latest" | ||
services = [ | ||
{ | ||
ports = [ | ||
{ | ||
port = 443 | ||
handlers = ["tls", "http"] | ||
}, | ||
{ | ||
port = 80 | ||
handlers = ["http"] | ||
} | ||
] | ||
"protocol" : "tcp", | ||
"internal_port" : 80 | ||
}, | ||
] | ||
cpus = 4 | ||
memorymb = 8192 | ||
depends_on = [fly_app.ursa_gateway] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
################ | ||
# Project # | ||
################ | ||
|
||
variable "regions" { | ||
type = list(string) | ||
default = ["yyz", "yul", "ewr", "lax", "ewr", "lhr", "ams"] | ||
description = "Default regions for the cluster of gateway nodes" | ||
} | ||
|
||
variable "fly_domains" { | ||
type = list(string) | ||
default = ["gateway.ursa.earth"] | ||
description = "Top level domains for the cluster of gateway nodes" | ||
} |