Skip to content

Commit 3893d07

Browse files
authored
Merge pull request #561 from input-output-hk/jpraynaud/542-new-infra-environments
New hosted environments
2 parents d8ce216 + ed2cfd5 commit 3893d07

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1098
-20
lines changed

.github/workflows/ci.yml

Lines changed: 70 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -358,45 +358,103 @@ jobs:
358358
files: package/*
359359

360360
deploy-testing:
361+
strategy:
362+
fail-fast: false
363+
matrix:
364+
environment: [ release-preprod ]
365+
include:
366+
- environment: release-preprod
367+
environment_prefix: release
368+
cardano_network: preprod
369+
mithril_api_domain: api.mithril.network
370+
mithril_protocol_parameters: |
371+
{
372+
k = 5
373+
m = 100
374+
phi_f = 0.65
375+
}
376+
mithril_signers: |
377+
{
378+
"1" = {
379+
pool_id = "pool1zr907nmfsq5kalxdjju349nwg6f03lyfmcjfqcz52jf45gcgh03",
380+
},
381+
}
382+
terraform_backend_bucket: hydra-terraform-admin
383+
google_region: europe-west1
384+
google_zone: europe-west1-b
385+
google_machine_type: e2-highmem-2
386+
361387
runs-on: ubuntu-22.04
388+
362389
needs:
363390
- docker-mithril
391+
392+
environment: ${{ matrix.environment }}
393+
364394
env:
365-
# Contains a JSON-formatted service account key
366-
GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CREDENTIALS }}
367-
# Contains a RSA private key
368-
GCLOUD_PRIVATE_KEY: ${{ secrets.GCLOUD_PRIVATE_KEY }}
369-
GENESIS_SECRET_KEY: ${{ secrets.TEST_ONLY_GENESIS_SECRET_KEY }}
370-
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
395+
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
396+
GENESIS_SECRET_KEY: ${{ secrets.GENESIS_SECRET_KEY }}
397+
GENESIS_VERIFICATION_KEY_URL: ${{ secrets.GENESIS_VERIFICATION_KEY_URL }}
371398

372399
defaults:
373400
run:
374401
working-directory: mithril-infra
375402

376403
steps:
404+
377405
- name: Checkout sources
378406
uses: actions/checkout@v3
379407

380-
- name: Get short SHA
381-
id: slug
382-
run: echo "sha8=$(echo ${{ github.sha }} | cut -c1-7)" >> $GITHUB_OUTPUT
408+
- name: Get Docker image id
409+
run: echo "DOCKER_IMAGE_ID=${{ github.head_ref || github.ref_name }}-$(echo ${{ github.sha }} | cut -c1-7)" >> $GITHUB_ENV
410+
411+
- name: Prepare service account credentials
412+
run: |
413+
echo '${{ env.GOOGLE_APPLICATION_CREDENTIALS}}' > ./google-application-credentials.json
414+
chmod u+x ./assets/tools/google-credentials-public-key.sh
415+
./assets/tools/google-credentials-public-key.sh ./google-application-credentials.json ./assets/ssh_keys curry
416+
417+
- name: Prepare terraform variables
418+
run: |
419+
cat > ./env.variables.tfvars << EOF
420+
environment_prefix = "${{ matrix.environment_prefix }}"
421+
cardano_network = "${{ matrix.cardano_network }}"
422+
google_region = "${{ matrix.google_region }}"
423+
google_zone = "${{ matrix.google_zone }}"
424+
google_machine_type = "${{ matrix.google_machine_type }}"
425+
google_service_credentials_json_file = "./google-application-credentials.json"
426+
mithril_api_domain = "${{ matrix.mithril_api_domain }}"
427+
mithril_image_id = "${{ env.DOCKER_IMAGE_ID }}"
428+
mithril_genesis_verification_key_url = "${{ env.GENESIS_VERIFICATION_KEY_URL }}"
429+
mithril_genesis_secret_key = "${{ env.GENESIS_SECRET_KEY }}"
430+
mithril_protocol_parameters = ${{ matrix.mithril_protocol_parameters }}
431+
mithril_signers = ${{ matrix.mithril_signers }}
432+
EOF
433+
terraform fmt ./env.variables.tfvars
434+
cat ./env.variables.tfvars
383435
384436
- name: Setup Terraform
385437
uses: hashicorp/setup-terraform@v2
386438
with:
387439
terraform_wrapper: false
388440

389441
- name: Init Terraform
390-
run: terraform init
442+
run: |
443+
GOOGLE_APPLICATION_CREDENTIALS=./google-application-credentials.json terraform init -backend-config="bucket=${{ matrix.terraform_backend_bucket }}" -backend-config="prefix=terraform/mithril-${{ matrix.environment }}"
391444
392445
- name: Check Terraform
393446
run: terraform fmt -check
394447

395448
- name: Terraform Plan
396449
run: |
397-
terraform plan -var "image_id=${{ env.BRANCH_NAME }}-${{ steps.slug.outputs.sha8 }}" -var 'private_key=${{ env.GCLOUD_PRIVATE_KEY }}' -var 'google_application_credentials_json=${{ env.GOOGLE_CREDENTIALS }}' -var 'genesis_secret_key=${{ env.GENESIS_SECRET_KEY }}'
450+
GOOGLE_APPLICATION_CREDENTIALS=./google-application-credentials.json terraform plan --var-file=./env.variables.tfvars
398451
399452
- name: Terraform Apply
400453
if: github.ref == 'refs/heads/main'
401454
run: |
402-
terraform apply -auto-approve -var "image_id=${{ env.BRANCH_NAME }}-${{ steps.slug.outputs.sha8 }}" -var 'private_key=${{ env.GCLOUD_PRIVATE_KEY }}' -var 'google_application_credentials_json=${{ env.GOOGLE_CREDENTIALS }}' -var 'genesis_secret_key=${{ env.GENESIS_SECRET_KEY }}'
455+
GOOGLE_APPLICATION_CREDENTIALS=./google-application-credentials.json terraform apply -auto-approve --var-file=./env.variables.tfvars
456+
457+
- name: Cleanup
458+
run: |
459+
rm -f ./env.variables.tfvars
460+
rm -f ./google-application-credentials.json

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,7 @@ mithril-core/proptest-regressions/
1111
.DS_Store
1212
test-results.xml
1313
target/
14+
mithril-infra/.terraform*
15+
mithril-infra/terraform.tfstate*
16+
mithril-infra/*.tfvars
17+

mithril-explorer/pages/index.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
import React, { useState } from 'react';
1+
import React, { useState } from 'react';
22
import PendingCertificate from '../components/PendingCertificate';
33
import SnapshotsList from '../components/SnapshotsList';
44
import Head from "next/head";
55
import Image from "next/image";
6-
import {Form, Stack, Button, Row, Col, InputGroup} from "react-bootstrap";
6+
import { Form, Stack, Button, Row, Col, InputGroup } from "react-bootstrap";
77
import styles from "../styles/Home.module.css";
88

99
const available_aggregators = [
10+
"https://aggregator.release-preprod.api.mithril.network/aggregator",
1011
"https://aggregator.api.mithril.network/aggregator",
1112
"http://localhost:8080/aggregator"
1213
];
@@ -15,11 +16,11 @@ function IntervalSetter(props) {
1516
function handleChange(event) {
1617
props.onIntervalChange(parseInt(event.target.value));
1718
}
18-
19+
1920
function handleClick() {
2021
props.onStartStopPress(!props.isStartStopPressed);
2122
}
22-
23+
2324
return (
2425
<Form.Group as={Col} className={props.className}>
2526
<Form.Label>Update Interval:</Form.Label>
@@ -62,7 +63,7 @@ export default function Explorer() {
6263
function handleApiChange(api) {
6364
setAggregator(api);
6465
}
65-
66+
6667
function handleStartStopButtonPress(isPressed) {
6768
setAutoUpdate(isPressed);
6869
}
@@ -78,14 +79,14 @@ export default function Explorer() {
7879
<meta name="description" content="Explore a Mithril Network" />
7980
<link rel="icon" href="/explorer/favicon.ico" />
8081
</Head>
81-
82+
8283
<div className={styles.container}>
8384
<main className={styles.main}>
8485
<h1 className={styles.title}>Mithril Explorer</h1>
8586
<Stack gap={3}>
8687
<Form>
8788
<Row xs={1} sm={2}>
88-
<AggregatorSetter aggregator={aggregator} onAggregatorChange={handleApiChange} availableAggregators={available_aggregators} />
89+
<AggregatorSetter aggregator={aggregator} onAggregatorChange={handleApiChange} availableAggregators={available_aggregators} />
8990
<IntervalSetter
9091
interval={interval}
9192
onIntervalChange={handleIntervalChange}
@@ -98,7 +99,7 @@ export default function Explorer() {
9899
</Stack>
99100
</main>
100101
</div>
101-
102+
102103
<footer className={styles.footer}>
103104
<span className={styles.logo}>
104105
<Image src="/explorer/logo.png" alt="Mithril Logo" width={32} height={32} />
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)