Skip to content

Commit

Permalink
add configs for waypoint to deploy frontends
Browse files Browse the repository at this point in the history
  • Loading branch information
luke-thorne committed Sep 15, 2022
1 parent 6a4e556 commit f7e32e1
Show file tree
Hide file tree
Showing 8 changed files with 221 additions and 7 deletions.
2 changes: 1 addition & 1 deletion tools/evm-l2-withdraw/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ COPY . ./

RUN npm run build --prod

FROM nginx:1.19-alpine
FROM nginx:1.23-alpine
COPY --from=build /app/dist /usr/share/nginx/html
62 changes: 62 additions & 0 deletions tools/evm-l2-withdraw/wasp-evm-withdraw.nomad.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
job "isc-evm-withdraw-${workspace}" {
datacenters = ["hcloud"]
group "web" {
ephemeral_disk {
migrate = false
sticky = true
}

network {
port "http" {
host_network = "private"
to = 80
}
}

task "worker" {
driver = "docker"
config {
image = "${artifact.image}:${artifact.tag}"
ports = [
"http",
]
auth {
username = "${auth.username}"
password = "${auth.password}"
server_address = "${auth.server_address}"
}
}

env {
%{ for k,v in entrypoint.env ~}
${k} = "${v}"
%{ endfor ~}

// Ensure we set PORT for the URL service. This is only necessary
// if we want the URL service to function.
PORT = "$${NOMAD_ALLOC_PORT_http}"
}

service {
tags = ["http"]
port = "http"
check {
type = "http"
port = "http"
path = "/"
interval = "5s"
timeout = "2s"
}
}

resources {
memory = 256
cpu = 256
}
}
}
}
45 changes: 45 additions & 0 deletions tools/evm-l2-withdraw/waypoint.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# The name of your project. A project typically maps 1:1 to a VCS repository.
# This name must be unique for your Waypoint server. If you're running in
# local mode, this must be unique to your machine.
project = "isc"

# Labels can be specified for organizational purposes.
labels = { "team" = "isc" }

variable "ghcr" {
type = object({
username = string
password = string
server_address = string
})
}

app "evm-withdraw" {
build {
use "docker" {
disable_entrypoint = false
buildkit = true
dockerfile = "./Dockerfile"
}

registry {
use "docker" {
image = "ghcr.io/luke-thorne/evm_withdraw_frontend"
tag = gitrefpretty()
encoded_auth = base64encode(jsonencode(var.ghcr))
}
}
}

deploy {
use "nomad-jobspec" {
// Templated to perhaps bring in the artifact from a previous
// build/registry, entrypoint env vars, etc.
jobspec = templatefile("${path.app}/wasp-evm-withdraw.nomad.tpl", {
artifact = artifact
auth = var.ghcr
workspace = workspace.name
})
}
}
}
4 changes: 2 additions & 2 deletions tools/evm_deposit_frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ COPY . ./

RUN npm run build --prod

FROM nginx:1.19-alpine
COPY --from=build /app/dist /usr/share/nginx/html
FROM nginx:1.23-alpine
COPY --from=build /app/dist /usr/share/nginx/html
2 changes: 1 addition & 1 deletion tools/evm_deposit_frontend/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export const networkOptions = [
{
id: 0,
text: 'Shimmer Beta Network',
apiEndpoint: 'https://api.testnet.shimmer.network',
apiEndpoint: 'https://api.hornet.sc.testnet.shimmer.network',
faucetEndpoint: 'https://faucet.testnet.shimmer.network',
},
{
Expand Down
62 changes: 62 additions & 0 deletions tools/evm_deposit_frontend/wasp-evm-deposit.nomad.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
job "isc-evm-deposit-${workspace}" {
datacenters = ["hcloud"]
group "web" {
ephemeral_disk {
migrate = false
sticky = true
}

network {
port "http" {
host_network = "private"
to = 80
}
}

task "worker" {
driver = "docker"
config {
image = "${artifact.image}:${artifact.tag}"
ports = [
"http",
]
auth {
username = "${auth.username}"
password = "${auth.password}"
server_address = "${auth.server_address}"
}
}

env {
%{ for k,v in entrypoint.env ~}
${k} = "${v}"
%{ endfor ~}

// Ensure we set PORT for the URL service. This is only necessary
// if we want the URL service to function.
PORT = "$${NOMAD_ALLOC_PORT_http}"
}

service {
tags = ["http"]
port = "http"
check {
type = "http"
port = "http"
path = "/"
interval = "5s"
timeout = "2s"
}
}

resources {
memory = 256
cpu = 256
}
}
}
}
45 changes: 45 additions & 0 deletions tools/evm_deposit_frontend/waypoint.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# The name of your project. A project typically maps 1:1 to a VCS repository.
# This name must be unique for your Waypoint server. If you're running in
# local mode, this must be unique to your machine.
project = "isc"

# Labels can be specified for organizational purposes.
labels = { "team" = "isc" }

variable "ghcr" {
type = object({
username = string
password = string
server_address = string
})
}

app "evm-deposit" {
build {
use "docker" {
disable_entrypoint = false
buildkit = true
dockerfile = "./Dockerfile"
}

registry {
use "docker" {
image = "ghcr.io/luke-thorne/evm_deposit_frontend"
tag = gitrefpretty()
encoded_auth = base64encode(jsonencode(var.ghcr))
}
}
}

deploy {
use "nomad-jobspec" {
// Templated to perhaps bring in the artifact from a previous
// build/registry, entrypoint env vars, etc.
jobspec = templatefile("${path.app}/wasp-evm-deposit.nomad.tpl", {
artifact = artifact
auth = var.ghcr
workspace = workspace.name
})
}
}
}
6 changes: 3 additions & 3 deletions wasp.nomad.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ variable "wasp_config" {
"bindAddress": "{{ env "NOMAD_ADDR_profiling" }}"
},
"inx": {
"address": "{{ range service "inx.tangle-${workspace}-hornet" }}{{ .Address }}:{{ .Port }}{{ end }}",
"address": "{{ range service "inx.tangle-testnet-hornet" }}{{ .Address }}:{{ .Port }}{{ end }}",
"maxConnectionAttempts": 30
},
"nanomsg":{
Expand Down Expand Up @@ -116,7 +116,7 @@ job "isc-${workspace}" {
sticky = true
}

count = 5
count = 0

network {
mode = "host"
Expand Down Expand Up @@ -225,7 +225,7 @@ job "isc-${workspace}" {
sticky = true
}

count = 1
count = 4

network {
mode = "host"
Expand Down

0 comments on commit f7e32e1

Please sign in to comment.