Skip to content

Commit

Permalink
Convert demo to a tutorial
Browse files Browse the repository at this point in the history
Also remove --profile from docker compose demo setup.
  • Loading branch information
ch1bo committed May 8, 2024
1 parent 0db5268 commit 1a3a9d9
Show file tree
Hide file tree
Showing 10 changed files with 101 additions and 173 deletions.
12 changes: 0 additions & 12 deletions demo/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ services:
build:
context: ../
target: hydra-node
profiles:
- hydra-node
volumes:
- .:/keys:ro
- ./devnet:/devnet
Expand Down Expand Up @@ -64,8 +62,6 @@ services:
build:
context: ../
target: hydra-node
profiles:
- hydra-node
volumes:
- .:/keys:ro
- ./devnet:/devnet
Expand Down Expand Up @@ -101,8 +97,6 @@ services:
build:
context: ../
target: hydra-node
profiles:
- hydra-node
volumes:
- .:/keys:ro
- ./devnet:/devnet
Expand Down Expand Up @@ -137,8 +131,6 @@ services:
build:
context: ../
target: hydra-tui
profiles:
- tui
command:
[ "--connect", "172.16.238.10:4001"
, "--node-socket", "/devnet/node.socket"
Expand All @@ -156,8 +148,6 @@ services:
build:
context: ../
target: hydra-tui
profiles:
- tui
command:
[ "--connect", "172.16.238.20:4001"
, "--node-socket", "/devnet/node.socket"
Expand All @@ -175,8 +165,6 @@ services:
build:
context: ../
target: hydra-tui
profiles:
- tui
command:
[ "--connect", "172.16.238.30:4001"
, "--node-socket", "/devnet/node.socket"
Expand Down
10 changes: 5 additions & 5 deletions demo/run-docker.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
#
# Prepare environment to run the demo cluster, then launches docker-compose demo.
# If there's already a demo running, bail out.
# Prepare environment to run the demo cluster, then launches docker compose
# demo. If there's already a demo running, bail out.
set -e

SCRIPT_DIR=$(dirname $(realpath $0))
Expand All @@ -25,7 +25,7 @@ fi
"${SCRIPT_DIR}/prepare-devnet.sh"
${DOCKER_COMPOSE_CMD} up -d cardano-node
"${SCRIPT_DIR}/seed-devnet.sh"
${DOCKER_COMPOSE_CMD} --profile hydra-node up -d
echo >&2 -e "\n# Launch TUI on hydra-node-1: ${DOCKER_COMPOSE_CMD} --profile tui run hydra-tui-1"
${DOCKER_COMPOSE_CMD} up -d hydra-node-{1,2,3}
echo >&2 -e "\n# Launch TUI on hydra-node-1: ${DOCKER_COMPOSE_CMD} run hydra-tui-1"
echo >&2 -e "\n# Stop the demo: ${DOCKER_COMPOSE_CMD} down\n"
${DOCKER_COMPOSE_CMD} --profile tui run hydra-tui-1
${DOCKER_COMPOSE_CMD} run hydra-tui-1
4 changes: 0 additions & 4 deletions docs/docs/getting-started/demo/_category_.json

This file was deleted.

29 changes: 0 additions & 29 deletions docs/docs/getting-started/demo/index.md

This file was deleted.

89 changes: 0 additions & 89 deletions docs/docs/getting-started/demo/with-docker.md

This file was deleted.

Binary file added docs/docs/open-head.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
sidebar_position: 3
---

# Without Docker
# Quickstart without Docker

```mdx-code-block
import TerminalWindow from '@site/src/components/TerminalWindow';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
```
Expand All @@ -29,12 +28,10 @@ All further commands are written as if executed from the `demo` folder in the pr
Allowing the `demo/.envrc` will ensure you have the nix shell environment available whenever you are in the `demo/` directory. To use this, opt-in via `direnv allow` after `cd demo`.
:::

## Setting-up The Chain
## Set up the devnet

First, let's prepare and start an ad-hoc, single `cardano-node` devnet using our configuration. Note that this will create a `devnet` directory in your current working directory:

<TerminalWindow>

```
./prepare-devnet.sh
cd devnet
Expand All @@ -48,24 +45,16 @@ cardano-node run \
--shelley-vrf-key vrf.skey
```

</TerminalWindow>

## Seeding The Network

From the `demo` folder you can use the `seed-devnet.sh` script by passing it the path/command to a cardano-cli and hydra-node executable to use, instead of having it using the Docker container. For example:

<TerminalWindow>

```
export CARDANO_NODE_SOCKET_PATH=devnet/node.socket
./seed-devnet.sh $(which cardano-cli) $(which hydra-node)
```

</TerminalWindow>

Note, should you want to use `cabal`, pass the invocation for example like this `"cabal exec hydra-node --"`.

## Setting-up The Hydra Network
## Start Hydra nodes

Then, in 3 different terminals, start 3 Hydra nodes from the `demo/` directory:

Expand All @@ -78,7 +67,6 @@ If you don't see any connected peers in the tui it probably means that your syst
<Tabs>
<TabItem value="Alice">
<TerminalWindow>
```
source .env && hydra-node \
Expand All @@ -98,11 +86,9 @@ source .env && hydra-node \
--persistence-dir devnet/persistence/alice
```
</TerminalWindow>
</TabItem>
<TabItem value="Bob">
<TerminalWindow>
```
source .env && hydra-node \
Expand All @@ -122,11 +108,9 @@ source .env && hydra-node \
--persistence-dir devnet/persistence/bob
```
</TerminalWindow>
</TabItem>
<TabItem value="Carol">
<TerminalWindow>
```
source .env && hydra-node \
Expand All @@ -146,7 +130,6 @@ source .env && hydra-node \
--persistence-dir devnet/persistence/carol
```
</TerminalWindow>
</TabItem>
Expand All @@ -155,15 +138,14 @@ source .env && hydra-node \

If things go well, the nodes should start logging once connected to the chain.

## Running The Clients
## Run Hydra clients

Connect to the nodes using hydra-tui.

````mdx-code-block
<Tabs>
<TabItem value="Alice">
<TerminalWindow>
```
hydra-tui \
Expand All @@ -173,11 +155,9 @@ hydra-tui \
--node-socket devnet/node.socket
```
</TerminalWindow>
</TabItem>
<TabItem value="Bob">
<TerminalWindow>
```
hydra-tui \
Expand All @@ -187,11 +167,9 @@ hydra-tui \
--node-socket devnet/node.socket
```
</TerminalWindow>
</TabItem>
<TabItem value="Carol">
<TerminalWindow>
```
hydra-tui \
Expand All @@ -201,7 +179,6 @@ hydra-tui \
--node-socket devnet/node.socket
```
</TerminalWindow>
</TabItem>
</Tabs>
Expand Down

0 comments on commit 1a3a9d9

Please sign in to comment.