-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from cardano-scaling/multi-version-explorer-de…
…ployment Multi version explorer deployment
- Loading branch information
Showing
6 changed files
with
242 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
# This workflow builds docker images on 'master' and for all release tags. The | ||
# 'latest' docker tag on the registry will always point to the latest pushed | ||
# version, likely the one built from 'master', so referring to the versioned | ||
# images is suggested. | ||
name: Docker | ||
|
||
# Limit concurrent runs of this workflow within a single PR | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
on: | ||
push: | ||
branches: [ "master" ] | ||
tags: [ "*.*.*" ] | ||
workflow_dispatch: | ||
inputs: | ||
ref_name: | ||
type: string | ||
description: 'Point-in-time to build the custom docker images' | ||
required: true | ||
default: "master" | ||
|
||
permissions: | ||
packages: write | ||
|
||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: 📥 Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.inputs.ref_name || '' }} | ||
|
||
- name: 🐳 Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: ❄ Prepare nix | ||
uses: cachix/install-nix-action@v30 | ||
with: | ||
extra_nix_config: | | ||
accept-flake-config = true | ||
log-lines = 1000 | ||
- name: ❄ Cachix cache of nix derivations | ||
uses: cachix/cachix-action@v15 | ||
with: | ||
name: cardano-scaling | ||
authToken: '${{ secrets.CACHIX_CARDANO_SCALING_AUTH_TOKEN }}' | ||
|
||
- name: 🔨 Build image using nix | ||
run: | | ||
IMAGE_NAME=ghcr.io/${{github.repository_owner}}/hydra-explorer | ||
echo "IMAGE_NAME=${IMAGE_NAME}" >> $GITHUB_ENV | ||
nix build .#docker | ||
./result | docker load | ||
# Determine whether we are building a tag and if yes, set a VERSION_NAME | ||
BUILDING_TAG=${{github.ref_type == 'tag'}} | ||
[[ ${BUILDING_TAG} = true ]] && \ | ||
VERSION_NAME=${{github.ref_name}} | ||
# Use 'FROM' instruction to use docker build with --label | ||
echo "FROM hydra-explorer" | docker build \ | ||
--label org.opencontainers.image.source=${{github.repositoryUrl}} \ | ||
--label org.opencontainers.image.licenses=Apache-2.0 \ | ||
--label org.opencontainers.image.created=$(date -Is) \ | ||
--label org.opencontainers.image.revision=${{github.sha}} \ | ||
--label org.opencontainers.image.version=${VERSION_NAME:-unstable} \ | ||
--tag ${IMAGE_NAME}:unstable - | ||
# Also tag with semver and 'latest' if we are building a tag | ||
[[ ${BUILDING_TAG} = true ]] && \ | ||
docker tag ${IMAGE_NAME}:unstable ${IMAGE_NAME}:${{github.ref_name}} | ||
[[ ${BUILDING_TAG} = true ]] && \ | ||
docker tag ${IMAGE_NAME}:unstable ${IMAGE_NAME}:latest | ||
# Tag image with workflow dispatch ref_name | ||
[[ ${{github.event_name == 'workflow_dispatch'}} = true ]] && \ | ||
docker tag ${IMAGE_NAME}:unstable ${IMAGE_NAME}:${{github.event.inputs.ref_name}} | ||
docker images | ||
docker inspect ${IMAGE_NAME}:unstable | ||
- name: 📤 Push to registry | ||
run: | | ||
docker push -a ${IMAGE_NAME} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# Hydra explorer instance with it's chain observers as it is deployed to | ||
# explorer.hydra.family | ||
version: "3.9" | ||
|
||
networks: | ||
hydra-explorer: | ||
driver: bridge | ||
|
||
services: | ||
hydra-explorer: | ||
image: ghcr.io/cardano-scaling/hydra-explorer:unstable | ||
ports: | ||
- "80:8000" | ||
command: | ||
[ "--client-port", "8000" | ||
, "--observer-port", "8001" # not bound to host | ||
] | ||
networks: | ||
- hydra-explorer | ||
restart: always | ||
|
||
# List of hydra-chain-observers | ||
|
||
hydra-chain-observer-preview-unstable: | ||
image: ghcr.io/cardano-scaling/hydra-chain-observer:unstable | ||
volumes: | ||
- "/data/cardano/preview:/data" | ||
command: | ||
[ "--node-socket", "/data/node.socket" | ||
, "--testnet-magic", "2" | ||
# NOTE: Block in which 0.20.0 scripts were published | ||
, "--start-chain-from", "71938562.2c5fc734343ad1bf8ce2df999421cca15dffdd2b8e1909dad7127b9eaacf8b9c" | ||
# NOTE: Reachable via hydra-explorer network | ||
, "--explorer", "http://hydra-explorer:8001" | ||
] | ||
networks: | ||
- hydra-explorer | ||
restart: always | ||
|
||
hydra-chain-observer-preprod-unstable: | ||
image: ghcr.io/cardano-scaling/hydra-chain-observer:unstable | ||
volumes: | ||
- "/data/cardano/preprod:/data" | ||
command: | ||
[ "--node-socket", "/data/node.socket" | ||
, "--testnet-magic", "1" | ||
# NOTE: Block in which 0.20.0 scripts were published | ||
, "--start-chain-from", "82913877.aa62d900ecbd6a073e1b5bb8c014413365c26a3675bd81dc567013340bf94ec3" | ||
# NOTE: Reachable via hydra-explorer network | ||
, "--explorer", "http://hydra-explorer:8001" | ||
] | ||
networks: | ||
- hydra-explorer | ||
restart: always | ||
|
||
# One cardano node per network | ||
|
||
cardano-node-preview: | ||
image: ghcr.io/intersectmbo/cardano-node:10.1.4 | ||
volumes: | ||
- /data/cardano/preview:/data | ||
environment: | ||
- CARDANO_CONFIG=/data/config.json | ||
- CARDANO_TOPOLOGY=/data/topology.json | ||
- CARDANO_DATABASE_PATH=/data/db | ||
- CARDANO_SOCKET_PATH=/data/node.socket # used by cardano-node | ||
- CARDANO_NODE_SOCKET_PATH=/data/node.socket # used by cardano-cli | ||
- CARDANO_LOG_DIR=/data/logs | ||
command: | ||
[ "run" ] | ||
restart: always | ||
|
||
cardano-node-preprod: | ||
image: ghcr.io/intersectmbo/cardano-node:10.1.4 | ||
volumes: | ||
- /data/cardano/preprod:/data | ||
environment: | ||
- CARDANO_CONFIG=/data/config.json | ||
- CARDANO_TOPOLOGY=/data/topology.json | ||
- CARDANO_DATABASE_PATH=/data/db | ||
- CARDANO_SOCKET_PATH=/data/node.socket # used by cardano-node | ||
- CARDANO_NODE_SOCKET_PATH=/data/node.socket # used by cardano-cli | ||
- CARDANO_LOG_DIR=/data/logs | ||
command: | ||
[ "run" ] | ||
restart: always |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters