Skip to content

Commit 586ebd5

Browse files
authored
Merge pull request #778 from input-output-hk/jpraynaud/777-mainnet-mithril-network-test
Prepare run `mainnet` Mithril test network
2 parents a555e0b + dc7c1b4 commit 586ebd5

13 files changed

+145
-15
lines changed

.github/workflows/test-docker.yml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
name: Docker images test
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
commit_sha:
7+
description: |
8+
SHA of the commit on which the mithril binaries should be obtained, a "ci.yml" workflow must have run
9+
on it else no binary would be available leading to the failure of this.
10+
11+
If not provided the last commit on the main branch will be used instead.
12+
required: false
13+
type: string
14+
cardano_bin_url:
15+
description: The url of the archive of the Cardano Node/CLI binaries
16+
required: true
17+
type: string
18+
default: https://update-cardano-mainnet.iohk.io/cardano-node-releases/cardano-node-1.35.5-linux.tar.gz
19+
dry_run:
20+
description: Dry run will not push the Docker images to the registry
21+
required: true
22+
type: boolean
23+
default: false
24+
25+
jobs:
26+
build-push-docker:
27+
runs-on: ubuntu-22.04
28+
strategy:
29+
fail-fast: false
30+
matrix:
31+
project: [ mithril-aggregator, mithril-client, mithril-signer ]
32+
33+
permissions:
34+
contents: read
35+
packages: write
36+
37+
env:
38+
REGISTRY: ghcr.io
39+
IMAGE_NAME: ${{ github.repository_owner }}/${{ matrix.project }}
40+
DOCKER_FILE: ./${{ matrix.project }}/Dockerfile.ci
41+
CONTEXT: .
42+
GITHUB_REF: ${{ github.ref}}
43+
44+
steps:
45+
- name: Prepare environment variables
46+
id: prepare
47+
shell: bash
48+
run: |
49+
if [[ -n "${{ inputs.commit_sha }}" ]]; then
50+
echo "sha=${{ inputs.commit_sha }}" >> $GITHUB_OUTPUT
51+
else
52+
echo "branch=main" >> $GITHUB_OUTPUT
53+
fi
54+
55+
- name: Checkout
56+
uses: actions/checkout@v3
57+
58+
- name: Checkout binary
59+
uses: dawidd6/action-download-artifact@v2
60+
with:
61+
name: mithril-distribution-${{ runner.os }}-${{ runner.arch }}
62+
path: ./bin
63+
commit: ${{ steps.prepare.outputs.sha }}
64+
branch: ${{ steps.prepare.outputs.branch }}
65+
workflow: ci.yml
66+
workflow_conclusion: success
67+
68+
- name: Log in to the Container registry
69+
uses: docker/login-action@v2
70+
with:
71+
registry: ${{ env.REGISTRY }}
72+
username: ${{ github.actor }}
73+
password: ${{ secrets.GITHUB_TOKEN }}
74+
75+
- name: Extract metadata (tags, labels) for Docker
76+
id: meta
77+
uses: docker/metadata-action@v4
78+
with:
79+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
80+
tags: |
81+
test
82+
type=raw,value=test-${{ github.ref_name }}-{{ steps.prepare.outputs.sha }}
83+
84+
- name: Download built artifacts (Linux-x64)
85+
uses: dawidd6/action-download-artifact@v2
86+
with:
87+
name: mithril-distribution-Linux-X64
88+
path: ${{ matrix.project }}
89+
commit: ${{ steps.prepare.outputs.sha }}
90+
workflow: ci.yml
91+
workflow_conclusion: success
92+
93+
- name: Build and push Docker image
94+
uses: docker/build-push-action@v3
95+
if: ${{ inputs.dry_run }} == 'false'
96+
with:
97+
context: ${{ env.CONTEXT }}
98+
file: ${{ env.DOCKER_FILE }}
99+
build-args: CARDANO_BIN_URL=${{ steps.inputs.cardano_bin_url }}
100+
push: true
101+
tags: ${{ steps.meta.outputs.tags }}

mithril-aggregator/Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ RUN /app/target/release/mithril-aggregator --version
3939
###############################
4040
FROM ubuntu:22.04
4141

42+
# Args
43+
ARG CARDANO_BIN_URL=https://update-cardano-mainnet.iohk.io/cardano-node-releases/cardano-node-1.35.5-linux.tar.gz
44+
4245
# Upgrade
4346
RUN apt-get update -y && apt-get install -y libssl-dev ca-certificates wget sqlite3 && rm -rf /var/lib/apt/lists/*
4447

@@ -56,7 +59,7 @@ WORKDIR /app/
5659
RUN chown -R appuser /app/
5760

5861
# Install cardano-cli
59-
RUN wget -nv -O cardano-bin.tar.gz https://update-cardano-mainnet.iohk.io/cardano-node-releases/cardano-node-1.35.5-linux.tar.gz
62+
RUN wget -nv -O cardano-bin.tar.gz $CARDANO_BIN_URL
6063
RUN tar xzf cardano-bin.tar.gz ./cardano-cli && mv cardano-cli /app/bin
6164
RUN /app/bin/cardano-cli --version
6265
RUN rm -f cardano-bin.tar.gz

mithril-aggregator/Dockerfile.ci

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
# on a debian-compatible x86-64 environment
44
FROM ubuntu:22.04
55

6+
# Args
7+
ARG CARDANO_BIN_URL=https://update-cardano-mainnet.iohk.io/cardano-node-releases/cardano-node-1.35.5-linux.tar.gz
8+
69
# Upgrade
710
RUN apt-get update -y && apt-get install -y libssl-dev ca-certificates wget sqlite3 && rm -rf /var/lib/apt/lists/*
811

@@ -14,7 +17,7 @@ COPY mithril-aggregator/mithril-aggregator /app/bin/mithril-aggregator
1417
COPY mithril-aggregator/config /app/config
1518

1619
# Install cardano-cli
17-
RUN wget -nv -O cardano-bin.tar.gz https://update-cardano-mainnet.iohk.io/cardano-node-releases/cardano-node-1.35.5-linux.tar.gz
20+
RUN wget -nv -O cardano-bin.tar.gz $CARDANO_BIN_URL
1821
RUN tar xzf cardano-bin.tar.gz ./cardano-cli && mv cardano-cli /app/bin
1922
RUN /app/bin/cardano-cli --version
2023
RUN rm -f cardano-bin.tar.gz

mithril-infra/assets/docker/Dockerfile.cardano

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
FROM inputoutput/cardano-node:1.35.5
1+
ARG CARDANO_IMAGE_ID
2+
FROM inputoutput/cardano-node:$CARDANO_IMAGE_ID
23

34
# Fix env file rights
45
# In order to be able to interact with the Cardano node trough its 'node.socket'

mithril-infra/assets/docker/docker-compose-aggregator.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@ version: "3.9"
22

33
services:
44
cardano-node-aggregator:
5-
image: cardano-node/1.35.5-modified
5+
image: cardano-node/${CARDANO_IMAGE_ID}-modified
66
container_name: cardano-node-aggregator
77
restart: always
88
build:
99
context: .
1010
dockerfile: Dockerfile.cardano
11+
args:
12+
CARDANO_IMAGE_ID: ${CARDANO_IMAGE_ID}
1113
user: ${CURRENT_UID}
1214
profiles:
1315
- cardano
@@ -36,7 +38,7 @@ services:
3638
]
3739

3840
mithril-aggregator:
39-
image: ghcr.io/input-output-hk/mithril-aggregator:${IMAGE_ID}
41+
image: ghcr.io/input-output-hk/mithril-aggregator:${MITHRIL_IMAGE_ID}
4042
container_name: mithril-aggregator
4143
restart: always
4244
user: ${CURRENT_UID}

mithril-infra/assets/docker/docker-compose-signer-unverified-alone.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version: "3.9"
44

55
services:
66
mithril-signer:
7-
image: ghcr.io/input-output-hk/mithril-signer:${IMAGE_ID}
7+
image: ghcr.io/input-output-hk/mithril-signer:${MITHRIL_IMAGE_ID}
88
container_name: mithril-signer-${SIGNER_ID}
99
restart: always
1010
user: ${CURRENT_UID}

mithril-infra/assets/docker/docker-compose-signer-unverified.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ version: "3.9"
44

55
services:
66
cardano-node-signer:
7-
image: cardano-node/1.35.5-modified
7+
image: cardano-node/${CARDANO_IMAGE_ID}-modified
88
container_name: cardano-node-signer-${SIGNER_ID}
99
restart: always
1010
build:
1111
context: .
1212
dockerfile: Dockerfile.cardano
13+
args:
14+
CARDANO_IMAGE_ID: ${CARDANO_IMAGE_ID}
1315
user: ${CURRENT_UID}
1416
profiles:
1517
- cardano
@@ -38,7 +40,7 @@ services:
3840
]
3941

4042
mithril-signer:
41-
image: ghcr.io/input-output-hk/mithril-signer:${IMAGE_ID}
43+
image: ghcr.io/input-output-hk/mithril-signer:${MITHRIL_IMAGE_ID}
4244
container_name: mithril-signer-${SIGNER_ID}
4345
restart: always
4446
user: ${CURRENT_UID}

mithril-infra/assets/docker/docker-compose-signer-verified.yaml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ version: "3.9"
44

55
services:
66
cardano-node-signer-relay:
7-
image: cardano-node/1.35.5-modified
7+
image: cardano-node/${CARDANO_IMAGE_ID}-modified
88
container_name: cardano-node-relay-signer-${SIGNER_ID}
99
restart: always
1010
build:
1111
context: .
1212
dockerfile: Dockerfile.cardano
13+
args:
14+
CARDANO_IMAGE_ID: ${CARDANO_IMAGE_ID}
1315
user: ${CURRENT_UID}
1416
profiles:
1517
- cardano
@@ -44,12 +46,14 @@ services:
4446
]
4547

4648
cardano-node-signer-block-producer:
47-
image: cardano-node/1.35.5-modified
49+
image: cardano-node/${CARDANO_IMAGE_ID}-modified
4850
container_name: cardano-node-block-producer-signer-${SIGNER_ID}
4951
restart: always
5052
build:
5153
context: .
5254
dockerfile: Dockerfile.cardano
55+
args:
56+
CARDANO_IMAGE_ID: ${CARDANO_IMAGE_ID}
5357
user: ${CURRENT_UID}
5458
profiles:
5559
- cardano
@@ -90,7 +94,7 @@ services:
9094
]
9195

9296
mithril-signer:
93-
image: ghcr.io/input-output-hk/mithril-signer:${IMAGE_ID}
97+
image: ghcr.io/input-output-hk/mithril-signer:${MITHRIL_IMAGE_ID}
9498
container_name: mithril-signer-${SIGNER_ID}
9599
restart: always
96100
user: ${CURRENT_UID}

mithril-infra/mithril.aggregator.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ resource "null_resource" "mithril_aggregator" {
2828
provisioner "remote-exec" {
2929
inline = [
3030
"export NETWORK=${var.cardano_network}",
31-
"export IMAGE_ID=${var.mithril_image_id}",
31+
"export CARDANO_IMAGE_ID=${var.cardano_image_id}",
32+
"export MITHRIL_IMAGE_ID=${var.mithril_image_id}",
3233
"export AGGREGATOR_HOST=${local.mithril_aggregator_host}",
3334
"export GOOGLE_APPLICATION_CREDENTIALS_JSON='${local.google_cloud_storage_credentials_json}'",
3435
"export SNAPSHOT_BUCKET_NAME='${google_storage_bucket.cloud_storage.name}'",

mithril-infra/mithril.signer.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ EOT
5757
"export SIGNER_ID=${each.key}",
5858
"export PARTY_ID=${each.value.pool_id}",
5959
"export NETWORK=${var.cardano_network}",
60-
"export IMAGE_ID=${var.mithril_image_id}",
60+
"export CARDANO_IMAGE_ID=${var.cardano_image_id}",
61+
"export MITHRIL_IMAGE_ID=${var.mithril_image_id}",
6162
"export SIGNER_HOST=${local.mithril_signers_host[each.key]}",
6263
"export SIGNER_WWW_PORT=${local.mithril_signers_www_port[each.key]}",
6364
"export SIGNER_CARDANO_RELAY_ADDR=0.0.0.0",

0 commit comments

Comments
 (0)