Skip to content

Commit

Permalink
Add dev phase deploy scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
kanshi committed Sep 27, 2023
1 parent f80b37c commit 24b6390
Show file tree
Hide file tree
Showing 3 changed files with 146 additions and 1 deletion.
74 changes: 74 additions & 0 deletions operations/deploy-distribution-dev.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
job "deploy-distribution-dev" {
datacenters = ["ator-fin"]
type = "batch"

reschedule {
attempts = 0
}

task "deploy-distribution-task" {
driver = "docker"

config {
network_mode = "host"
image = "ghcr.io/ator-development/smart-contracts:0.1.2"
entrypoint = ["npm"]
command = "run"
args = ["deploy"]
volumes = [
"local/distribution-init-state.json:/usr/src/app/smartweave/dist/contracts/distribution-init-state.json"
]
}

vault {
policies = ["distribution-dev"]
}

template {
data = <<EOH
{{with secret "kv/distribution/dev"}}
DEPLOYER_PRIVATE_KEY="{{.Data.data.DISTRIBUTION_OWNER_KEY}}"
CONSUL_TOKEN="{{.Data.data.CONSUL_TOKEN}}"
{{end}}
EOH
destination = "secrets/file.env"
env = true
}

template {
data = <<EOH
{{with secret "kv/distribution/dev"}}
{
"claimable":{},
"owner":"{{.Data.data.DISTRIBUTION_OWNER_ADDRESS}}",
"pendingDistributions":{},
"previousDistributions":{},
"tokensDistributedPerSecond":"62800000000000000"
}
{{end}}
EOH
destination = "local/distribution-init-state.json"
env = false
}

env {
PHASE="dev"
CONSUL_IP="127.0.0.1"
CONSUL_PORT="8500"
CONSUL_KEY="smart-contracts/dev/distribution-address"
CONTRACT_SRC="../dist/contracts/distribution.js"
INIT_STATE="../dist/contracts/distribution-init-state.json"
}

restart {
attempts = 0
mode = "fail"
}

resources {
cpu = 4096
memory = 4096
}
}
}
71 changes: 71 additions & 0 deletions operations/deploy-relay-registry-dev.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
job "deploy-relay-registry-dev" {
datacenters = ["ator-fin"]
type = "batch"

reschedule {
attempts = 0
}

task "deploy-relay-registry-task" {
driver = "docker"

config {
network_mode = "host"
image = "ghcr.io/ator-development/smart-contracts:0.1.2"
entrypoint = ["npm"]
command = "run"
args = ["deploy"]
volumes = [
"local/relay-registry-init-state.json:/usr/src/app/smartweave/dist/contracts/relay-registry-init-state.json"
]
}

vault {
policies = ["relay-registry-dev"]
}

template {
data = <<EOH
{{with secret "kv/relay-registry/dev"}}
DEPLOYER_PRIVATE_KEY="{{.Data.data.RELAY_REGISTRY_OWNER_KEY}}"
CONSUL_TOKEN="{{.Data.data.CONSUL_TOKEN}}"
{{end}}
EOH
destination = "secrets/file.env"
env = true
}

template {
data = <<EOH
{{with secret "kv/relay-registry/dev"}}
{
"claimable":{},
"owner":"{{.Data.data.RELAY_REGISTRY_OWNER_ADDRESS}}",
"verified":{}
}
{{end}}
EOH
destination = "local/relay-registry-init-state.json"
env = false
}

env {
PHASE="dev"
CONSUL_IP="127.0.0.1"
CONSUL_PORT="8500"
CONSUL_KEY="smart-contracts/dev/relay-registry-address"
CONTRACT_SRC="../dist/contracts/relay-registry.js"
INIT_STATE="../dist/contracts/relay-registry-init-state.json"
}

restart {
attempts = 0
mode = "fail"
}

resources {
cpu = 4096
memory = 4096
}
}
}
2 changes: 1 addition & 1 deletion smartweave/scripts/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const deployerPrivateKey = process.env.DEPLOYER_PRIVATE_KEY
|| HardhatKeys.owner.key

const consulKey = process.env.CONSUL_KEY
|| 'smart-contracts/stage/test-deploy'
|| 'dummy-path'

const consulToken = process.env.CONSUL_TOKEN
|| 'no-token'
Expand Down

0 comments on commit 24b6390

Please sign in to comment.