Skip to content
Snippets Groups Projects
Commit 1bb9b0da authored by Gilles Filippini's avatar Gilles Filippini
Browse files

docker: simplify duniter subcommand run

When the first argument of the entrypoint is '--' then bypass the default
configuration via environment variables and directly run duniter with the
given parameters (after removing the '--').

The affected scripts and documentation were updated.
parent 9388f18b
No related branches found
No related tags found
No related merge requests found
This commit is part of merge request !135. Comments created here will be created in the context of that merge request.
......@@ -80,3 +80,11 @@ You can pass any other option to duniter using the `command` docker-compose elem
# https://github.com/paritytech/substrate/issues/12073
- "--wasm-execution=interpreted-i-know-what-i-do"
```
# Running duniter subcommands or custom set of options
To run duniter from the command line without the default configuration detailed in the "Environment variables" section use `--` as the first argument. For example:
```
$ docker run --rm duniter/duniter-v2s:latest -- key generate
$ docker run --rm duniter/duniter-v2s:latest -- --chain gdev ...
```
#!/bin/bash
# Custom startup if a first argument is present and is equal to '--'
# then we just run duniter with the provided arguments (but the '--')
# without applying all the automated configuration below
if [ "$1" = -- ]; then
shift
exec duniter "$@"
fi
# Normal startup
function boolean () {
echo "$1" | sed -E 's/^(true|yes|1)$/true/i'
}
......
......@@ -21,7 +21,7 @@ docker image that you have chosen.
Generate a random secret phrase:
```bash
$ docker run --rm -it --entrypoint duniter duniter/duniter-v2s:TAG key generate
$ docker run --rm duniter/duniter-v2s:TAG -- key generate
Secret phrase: noble stay fury mean poverty delay stadium organ evil east vague can
Secret seed: 0xb39c31fb10c5080721738880c2ea45412cb3df33df022bf8d9a51483b3a9b7a6
Public key (hex): 0x90a0c2866034db9d05f8193a95fe5af8d5e12ab295a501c17c95cdbeaf226d62
......@@ -35,7 +35,7 @@ Keep this secret phrase **carefully**, it will be used **several** times later.
Then, generate the session keys:
```bash
$ docker run --rm -it --entrypoint duniter duniter/duniter-v2s:TAG key generate-session-keys --chain CURRENCY_local --suri "<your secret phrase>"
$ docker run --rm duniter/duniter-v2s:TAG -- key generate-session-keys --chain CURRENCY_local --suri "<your secret phrase>"
Session Keys: 0x87189d723e1b2826c243bc433c718ac26ba60526932216a09102a254d54462b890a0c2866034db9d05f8193a95fe5af8d5e12ab295a501c17c95cdbeaf226d6290a0c2866034db9d05f8193a95fe5af8d5e12ab295a501c17c95cdbeaf226d6290a0c2866034db9d05f8193a95fe5af8d5e12ab295a501c17c95cdbeaf226d62
```
......@@ -46,7 +46,7 @@ An example of genesis configuration file: `resources/gdev.json`
## 5. Generate raw spec
```docker
docker run -v $HOME/dev/duniter-v2s/resources:/var/lib/duniter/resources -e DUNITER_GENESIS_CONFIG=/var/lib/duniter/resources/gdev.json --rm -it --entrypoint duniter duniter/duniter-v2s:TAG build-spec -lerror --chain=gdev-gl --raw > name-raw.json
docker run -v $HOME/dev/duniter-v2s/resources:/var/lib/duniter/resources -e DUNITER_GENESIS_CONFIG=/var/lib/duniter/resources/gdev.json --rm duniter/duniter-v2s:TAG -- build-spec -lerror --chain=gdev-gl --raw > name-raw.json
```
```bash
......
......@@ -31,8 +31,7 @@ mkdir -p $WORK_DIR/duniter-validator/chains/$CURRENCY
# Helper to execute a duniter subcommand in docker
function duniter_tmp () {
docker rm duniter-tmp > /dev/null
OUTPUT=$(docker run --name duniter-tmp -it --entrypoint duniter duniter/duniter-v2s:$DUNITER_IMAGE_TAG "$@")
OUTPUT=$(docker run --rm --name duniter-tmp duniter/duniter-v2s:$DUNITER_IMAGE_TAG -- "$@")
echo "${OUTPUT::-1}"
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment