Skip to content

Commit

Permalink
feat: initial import from cardano-up/packages
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Gianelloni <[email protected]>
  • Loading branch information
wolf31o2 committed Jul 14, 2024
1 parent 6562357 commit 2e9d87b
Show file tree
Hide file tree
Showing 24 changed files with 793 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
16 changes: 16 additions & 0 deletions .github/workflows/conventional-commits.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# The below is pulled from upstream and slightly modified
# https://github.com/webiny/action-conventional-commits/blob/master/README.md#usage

name: Conventional Commits

on:
pull_request:

jobs:
build:
name: Conventional Commits
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: webiny/[email protected]
21 changes: 21 additions & 0 deletions .github/workflows/package-validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: package-validate

on:
push:
tags:
- v*
branches:
- main
pull_request:

jobs:
validate:
name: Validate packages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
set -e
curl -sLo cardano-up $(curl -s https://api.github.com/repos/blinklabs-io/cardano-up/releases/latest | grep "browser_download_url.*linux-amd64" | cut -d: -f2,3 | tr -d \")
chmod +x cardano-up
- run: ./cardano-up validate -D
18 changes: 18 additions & 0 deletions packages/cardano-cli/cardano-cli-8.20.3.0.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: cardano-cli
version: 8.20.3.0
description: CLI software for interfacing with Cardano node by Input Output Global
installSteps:
- docker:
containerName: cardano-cli
image: ghcr.io/blinklabs-io/cardano-cli:8.20.3.0
pullOnly: true
- file:
binary: true
filename: cardano-cli
source: files/cardano-cli.sh.gotmpl
tags:
- docker
- linux
- darwin
- amd64
- arm64
18 changes: 18 additions & 0 deletions packages/cardano-cli/cardano-cli-8.24.0.0.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: cardano-cli
version: 8.24.0.0
description: CLI software for interfacing with Cardano node by Input Output Global
installSteps:
- docker:
containerName: cardano-cli
image: ghcr.io/blinklabs-io/cardano-cli:8.24.0.0
pullOnly: true
- file:
binary: true
filename: cardano-cli
source: files/cardano-cli.sh.gotmpl
tags:
- docker
- linux
- darwin
- amd64
- arm64
18 changes: 18 additions & 0 deletions packages/cardano-cli/cardano-cli-9.0.0.0.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: cardano-cli
version: 9.0.0.0
description: CLI software for interfacing with Cardano node by Input Output Global
installSteps:
- docker:
containerName: cardano-cli
image: ghcr.io/blinklabs-io/cardano-cli:9.0.0.0
pullOnly: true
- file:
binary: true
filename: cardano-cli
source: files/cardano-cli.sh.gotmpl
tags:
- docker
- linux
- darwin
- amd64
- arm64
55 changes: 55 additions & 0 deletions packages/cardano-cli/files/cardano-cli.sh.gotmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/bin/bash

declare -a valid_paths=(
"/Users"
"/Volumes"
"/private"
"/tmp"
"/var/folders"
)

_args=()

# Remap absolute paths to /host in the container
while [[ $# -gt 0 ]]; do
_arg=$1
if [[ $_arg =~ ^/ ]]; then
_arg="/host${_arg}"
fi
_args+=( $_arg )
shift
done

_docker_args=()

if [[ $CARDANO_NODE_SOCKET_PATH ]]; then
# Use the host socket path if specified
if [[ ! -e $CARDANO_NODE_SOCKET_PATH ]]; then
echo "Specified CARDANO_NODE_SOCKET_PATH '${CARDANO_NODE_SOCKET_PATH}' does not exist!"
exit 1
fi
_docker_args+=( "-v" "${CARDANO_NODE_SOCKET_PATH}:/ipc/node.socket" )
else
# Use the default context node socket if no socket path is provided
_docker_args+=( "-v" "{{ .Paths.ContextDir }}/node-ipc:/ipc" )
fi

if [[ $(uname -s) == Darwin ]]; then
for _path in "${_darwin_allowed_paths[@]}"; do
_docker_args+=( "-v" "${_path}:/host${_path}" )
done
else
_docker_args+=( "-v" "/:/host" )
fi

# Run cardano-cli via Docker
# We map the host filesystem and node socket into the container
docker run \
-ti \
--rm \
-u $(id -u):$(id -g) \
-w /host$(pwd) \
-e CARDANO_NODE_SOCKET_PATH=/ipc/node.socket \
"${_docker_args[@]}" \
ghcr.io/blinklabs-io/cardano-cli:{{ .Package.Version }} \
"${_args[@]}"
24 changes: 24 additions & 0 deletions packages/cardano-config/cardano-config-20240515.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: cardano-config
version: 20240515
description: Configuration files for the Cardano node by Input Output Global
installSteps:
- docker:
containerName: cardano-configs
image: ghcr.io/blinklabs-io/cardano-configs:20240515-1
pullOnly: true
outputs:
- name: base
description: Path to the Cardano Node configuration files
value: '{{ .Paths.ContextDir }}/config'
postInstallScript: |
set -e
mkdir -p {{ .Paths.ContextDir }}/config
docker create --name {{ .Package.Name }}-{{ .Package.ShortName }} ghcr.io/blinklabs-io/cardano-configs:20240515-1 bash
docker cp {{ .Package.Name }}-{{ .Package.ShortName }}:/config/{{ .Context.Network }}/ {{ .Paths.ContextDir }}/config/
docker rm {{ .Package.Name }}-{{ .Package.ShortName }}
tags:
- docker
- linux
- darwin
- amd64
- arm64
24 changes: 24 additions & 0 deletions packages/cardano-config/cardano-config-20240702.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: cardano-config
version: 20240702
description: Configuration files for the Cardano node by Input Output Global
installSteps:
- docker:
containerName: cardano-configs
image: ghcr.io/blinklabs-io/cardano-configs:20240702-1
pullOnly: true
outputs:
- name: base
description: Path to the Cardano Node configuration files
value: '{{ .Paths.ContextDir }}/config'
postInstallScript: |
set -e
mkdir -p {{ .Paths.ContextDir }}/config
docker create --name {{ .Package.Name }}-{{ .Package.ShortName }} ghcr.io/blinklabs-io/cardano-configs:20240702-1 bash
docker cp {{ .Package.Name }}-{{ .Package.ShortName }}:/config/{{ .Context.Network }}/ {{ .Paths.ContextDir }}/config/
docker rm {{ .Package.Name }}-{{ .Package.ShortName }}
tags:
- docker
- linux
- darwin
- amd64
- arm64
33 changes: 33 additions & 0 deletions packages/cardano-node-api/cardano-node-api-0.1.2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: cardano-node-api
version: 0.1.2
description: Multi-protocol API for interfacing with a local Cardano node
dependencies:
- cardano-config >= 20240515
- cardano-node >= 8.7.3
installSteps:
- docker:
containerName: cardano-node-api
image: ghcr.io/blinklabs-io/cardano-node-api:0.1.2
env:
CARDANO_NETWORK: '{{ .Context.Network }}'
CARDANO_NODE_SOCKET_PATH: /ipc/node.socket
binds:
- '{{ .Paths.ContextDir }}/node-ipc:/ipc'
- '{{ .Paths.ContextDir }}/config/{{ .Context.Network }}:/opt/cardano/config'
ports:
- "8080"
- "9090"
pullOnly: false
outputs:
- name: grpc
description: Cardano Node API gRPC service
value: 'http://localhost:{{ index (index .Ports "cardano-node-api") "8080" }}'
- name: rest
description: Cardano Node API REST service
value: 'localhost:{{ index (index .Ports "cardano-node-api") "9090" }}'
tags:
- docker
- linux
- darwin
- amd64
- arm64
33 changes: 33 additions & 0 deletions packages/cardano-node-api/cardano-node-api-0.2.0.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: cardano-node-api
version: 0.2.0
description: Multi-protocol API for interfacing with a local Cardano node
dependencies:
- cardano-config >= 20240515
- cardano-node >= 8.7.3
installSteps:
- docker:
containerName: cardano-node-api
image: ghcr.io/blinklabs-io/cardano-node-api:0.2.0
env:
CARDANO_NETWORK: '{{ .Context.Network }}'
CARDANO_NODE_SOCKET_PATH: /ipc/node.socket
binds:
- '{{ .Paths.ContextDir }}/node-ipc:/ipc'
- '{{ .Paths.ContextDir }}/config/{{ .Context.Network }}:/opt/cardano/config'
ports:
- "8080"
- "9090"
pullOnly: false
outputs:
- name: grpc
description: Cardano Node API gRPC service
value: 'http://localhost:{{ index (index .Ports "cardano-node-api") "8080" }}'
- name: rest
description: Cardano Node API REST service
value: 'localhost:{{ index (index .Ports "cardano-node-api") "9090" }}'
tags:
- docker
- linux
- darwin
- amd64
- arm64
49 changes: 49 additions & 0 deletions packages/cardano-node/cardano-node-8.9.3.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: cardano-node
version: 8.9.3
description: Cardano node software by Input Output Global
dependencies:
- cardano-config = 20240515
- cardano-cli >= 8.20
- mithril-client >= 0.8
installSteps:
- docker:
containerName: cardano-node
image: ghcr.io/blinklabs-io/cardano-node:8.9.3
env:
CARDANO_NODE_SOCKET_PATH: /ipc/node.socket
NETWORK: '{{ .Context.Network }}'
RESTORE_NETWORK: 'false'
binds:
- '{{ .Paths.ContextDir }}/config:/opt/cardano/config'
- '{{ .Paths.ContextDir }}/node-ipc:/ipc'
- '{{ .Paths.DataDir }}/data:/data'
ports:
- "3001"
- "12788"
- "12798"
pullOnly: false
- file:
binary: true
filename: nview
source: files/nview.sh.gotmpl
- file:
binary: true
filename: txtop
source: files/txtop.sh.gotmpl
outputs:
- name: port
description: Ouroboros Node-to-Node service
value: '{{ index (index .Ports "cardano-node") "3001" }}'
- name: socket_path
description: Path to the Cardano Node UNIX socket
value: '{{ .Paths.ContextDir }}/node-ipc/node.socket'
preInstallScript: |
set -e
test -e {{ .Paths.DataDir }}/data/db/protocolMagicId && exit 0
mithril-client cardano-db download --download-dir {{ .Paths.DataDir }}/data latest
tags:
- docker
- linux
- darwin
- amd64
- arm64
49 changes: 49 additions & 0 deletions packages/cardano-node/cardano-node-8.9.4.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: cardano-node
version: 8.9.4
description: Cardano node software by Input Output Global
dependencies:
- cardano-config = 20240515
- cardano-cli >= 8.20
- mithril-client >= 0.8
installSteps:
- docker:
containerName: cardano-node
image: ghcr.io/blinklabs-io/cardano-node:8.9.4
env:
CARDANO_NODE_SOCKET_PATH: /ipc/node.socket
NETWORK: '{{ .Context.Network }}'
RESTORE_NETWORK: 'false'
binds:
- '{{ .Paths.ContextDir }}/config:/opt/cardano/config'
- '{{ .Paths.ContextDir }}/node-ipc:/ipc'
- '{{ .Paths.DataDir }}/data:/data'
ports:
- "3001"
- "12788"
- "12798"
pullOnly: false
- file:
binary: true
filename: nview
source: files/nview.sh.gotmpl
- file:
binary: true
filename: txtop
source: files/txtop.sh.gotmpl
outputs:
- name: port
description: Ouroboros Node-to-Node service
value: '{{ index (index .Ports "cardano-node") "3001" }}'
- name: socket_path
description: Path to the Cardano Node UNIX socket
value: '{{ .Paths.ContextDir }}/node-ipc/node.socket'
preInstallScript: |
set -e
test -e {{ .Paths.DataDir }}/data/db/protocolMagicId && exit 0
mithril-client cardano-db download --download-dir {{ .Paths.DataDir }}/data latest
tags:
- docker
- linux
- darwin
- amd64
- arm64
Loading

0 comments on commit 2e9d87b

Please sign in to comment.