@@ -39,43 +39,46 @@ For a more detailed description of different ways to use this library, read the
39
39
40
40
## Running via Docker
41
41
42
- ### Using Demeter. run
42
+ In order to run the application via Docker, you need to build the image first:
43
43
44
- The demo application can connect to a Cardano node at [ Demeter.run] ( https://demeter.run/ ) 🪄
44
+ ```
45
+ docker build -t xander .
46
+ ```
45
47
46
- First, create a Node on Demeter. Then, set your Node's url in the ` DEMETER_URL ` environment variable in the ` .env ` file.
48
+ With the image built, you can now connect to either a local Cardano node via a UNIX socket or to a node at Demeter.run.
47
49
48
- For example:
50
+ #### 1. Connecting via a local UNIX socket
49
51
50
- ``` bash
51
- DEMETER_URL=https://your-node-at.demeter.run
52
- ```
52
+ This assumes you have access to a fully synced Cardano node.
53
+
54
+ 🚨 ** Note: ** Socket files mapped via socat/ssh tunnels ** DO NOT WORK ** when using containers on OS X.
53
55
54
- Then, run the application using Docker Compose:
56
+ Run the previously built Docker image with the ` -v ` argument, which mounts the path of your local socket path to
57
+ the container's default socket path (` /tmp/cardano-node.socket ` ):
55
58
56
- ``` bash
57
- docker compose up --build
59
+ ```
60
+ docker run --rm \
61
+ -v /your/local/node.socket:/tmp/cardano-node.socket \
62
+ xander elixir run.exs
58
63
```
59
64
60
- #### Via local UNIX socket
65
+ #### 2. Connecting to a node at Demeter.run
61
66
62
- 🚨 ** Note: ** Socket files mapped via socat/ssh tunnels ** DO NOT WORK ** when using containers on OS X.
67
+ The demo application can connect to a Cardano node at [ Demeter.run ] ( https://demeter.run/ ) 🪄
63
68
64
- Uncomment the ` volumes ` section in the ` compose.yml ` file to mount the local UNIX socket to the container 's socket path .
69
+ First, create a Node on Demeter and grab the Node 's URL .
65
70
66
- ``` yml
67
- volumes :
68
- - /path/to/node.socket:/tmp/cardano-node.socket
69
- ` ` `
71
+ Then, run the Docker image with the ` DEMETER_URL ` environment variable set to your Node's URL:
70
72
71
- Then, run the application using Docker Compose:
72
73
``` bash
73
- docker compose up --build
74
+ docker run --rm \
75
+ -e DEMETER_URL=https://your-node-at.demeter.run \
76
+ xander elixir run_with_demeter.exs
74
77
```
75
78
76
79
## Running natively with an Elixir local dev environment
77
80
78
- #### Via local UNIX socket
81
+ #### a) Via local UNIX socket
79
82
80
83
Run the following command using your own Cardano node's socket path:
81
84
@@ -107,10 +110,16 @@ socat UNIX-LISTEN:/tmp/cardano_node.socket,reuseaddr,fork TCP:localhost:3002
107
110
ssh -N -L 3002:localhost:3002 user@remote-server-ip
108
111
```
109
112
110
- #### Using Demeter.run
113
+ 4 . Run the example script:
114
+
115
+ ``` bash
116
+ CARDANO_NODE_PATH=/tmp/cardano_node.socket elixir run.exs
117
+ ```
118
+
119
+ #### b) Using Demeter.run
111
120
112
121
To connect to a node at Demeter.run, set ` DEMETER_URL ` to your Node Demeter URL.
113
122
114
123
``` bash
115
- DEMETER_URL=https://your-node-at.demeter.run mix query_current_era
124
+ DEMETER_URL=https://your-node-at.demeter.run elixir run_with_demeter.exs
116
125
```
0 commit comments