Skip to content

Commit

Permalink
chore: Add online nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
gonzalezzfelipe committed Nov 5, 2024
1 parent d320bf3 commit 8aa2ff6
Show file tree
Hide file tree
Showing 7 changed files with 233 additions and 132 deletions.
24 changes: 8 additions & 16 deletions bootstrap/stage1/crd.tf
Original file line number Diff line number Diff line change
Expand Up @@ -50,40 +50,32 @@ resource "kubernetes_manifest" "customresourcedefinition_hydradoomnodes_hydra_do
"properties" = {
"spec" = {
"properties" = {
"blockfrostKey" = {
"nullable" = true
"type" = "string"
}
"commitInputs" = {
"items" = {
"type" = "string"
}
"type" = "array"
}
"networkId" = {
"format" = "uint8"
"minimum" = 0
"type" = "integer"
"format" = "uint8"
"minimum" = 0
"nullable" = true
"type" = "integer"
}
"offline" = {
"nullable" = true
"type" = "boolean"
}
"participant" = {
"type" = "string"
}
"party" = {
"type" = "string"
}
"seedInput" = {
"type" = "string"
}
"startChainFrom" = {
"nullable" = true
"type" = "string"
}
}
"required" = [
"commitInputs",
"networkId",
"participant",
"party",
"seedInput",
]
"type" = "object"
Expand Down
10 changes: 10 additions & 0 deletions bootstrap/stage2/deployment.tf
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,16 @@ resource "kubernetes_deployment_v1" "operator" {
value = var.admin_addr
}

env {
name = "HYDRA_SCRIPTS_TX_ID"
value = var.hydra_scripts_tx_id
}

env {
name = "DMTR_NODE_PORT_AUTHENTICATED_URL"
value = var.dmtr_node_port_authenticated_url
}

resources {
limits = {
cpu = var.resources.limits.cpu
Expand Down
8 changes: 8 additions & 0 deletions bootstrap/stage2/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ variable "admin_addr" {
description = "Must be consistent with admin key, calculated using cardano cli."
}

variable "hydra_scripts_tx_id" {
type = string
}

variable "dmtr_node_port_authenticated_url" {
type = string
}

variable "tolerations" {
type = list(object({
effect = string
Expand Down
2 changes: 1 addition & 1 deletion docker/dockerfile.hydra
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ WORKDIR /app
RUN apt-get update && apt-get install -y libssl-dev pkg-config git

RUN git clone https://github.com/gonzalezzfelipe/hydra-control-plane.git
RUN cd hydra-control-plane && git checkout chore/use-admin-key
RUN cd hydra-control-plane && git checkout chore/use-hydra-vk-instead-of-bytes

WORKDIR /app/hydra-control-plane
RUN cargo build --locked --release
Expand Down
11 changes: 8 additions & 3 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ pub struct Config {
pub blockfrost_key: String,
pub external_domain: String,
pub external_port: String,
pub offline_initial_utxo_address: String,
pub admin_addr: String,
pub hydra_scripts_tx_id: String,
pub dmtr_node_port_authenticated_url: String,
}

impl Config {
Expand All @@ -33,8 +35,11 @@ impl Config {
blockfrost_key: env::var("BLOCKFROST_KEY").expect("Missing BLOCKFROST_KEY env var"),
external_domain: env::var("EXTERNAL_DOMAIN").expect("Missing EXTERNAL_DOMAIN env var."),
external_port: env::var("EXTERNAL_PORT").expect("Missing EXTERNAL_PORT env var."),
offline_initial_utxo_address: env::var("OFFLINE_INITIAL_UTXO_ADDRESS")
.expect("Missing OFFLINE_INITIAL_UTXO_ADDRESS env var."),
admin_addr: env::var("ADMIN_ADDR").expect("Missing ADMIN_ADDR env var."),
hydra_scripts_tx_id: env::var("HYDRA_SCRIPTS_TX_ID")
.expect("Missing HYDRA_SCRIPTS_TX_ID env var."),
dmtr_node_port_authenticated_url: env::var("DMTR_NODE_PORT_AUTHENTICATED_URL")
.expect("Missing DMTR_NODE_PORT_AUTHENTICATED_URL env var."),
}
}
}
6 changes: 6 additions & 0 deletions src/controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ impl From<HydraDoomNodeState> for String {
pub struct K8sConstants {
pub config_dir: String,
pub secret_dir: String,
pub socat_dir: String,
pub socket_path: String,
pub initial_utxo_config_dir: String,
pub data_dir: String,
pub persistence_dir: String,
Expand All @@ -59,12 +61,16 @@ pub struct K8sConstants {
pub metrics_endpoint: String,
pub state_metric: String,
pub transactions_metric: String,
pub socat_image: String,
}
impl Default for K8sConstants {
fn default() -> Self {
Self {
config_dir: "/etc/config".to_string(),
secret_dir: "/var/secret".to_string(),
socat_dir: "/ipc".to_string(),
socat_image: "alpine/socat".to_string(),
socket_path: "/ipc/socket".to_string(),
initial_utxo_config_dir: "/etc/initial_utxo_config".to_string(),
data_dir: "/var/data".to_string(),
persistence_dir: "/var/persistence".to_string(),
Expand Down
Loading

0 comments on commit 8aa2ff6

Please sign in to comment.