Skip to content
Permalink
Browse files

feat(ci, examples, script): address review comments

Remove unnecessary dependencies and lines, don't discaed STDERR when creating accounts, fix
redundant expressions of building release binaries.

Signed-off-by: Taiga Nakayama <dora@dora-gt.jp>
  • Loading branch information
dora-gt committed Nov 11, 2019
1 parent 2a36d46 commit d6f5c748e0610e2ff7ee7446591ef20e900f3b63
@@ -61,11 +61,7 @@ jobs:
command: |
# install system dependeicies
sudo apt-get update
sudo apt-get install -y curl jq redis-server redis-tools lsof libssl-dev
# install rust components
cargo install cargo-audit
rustup component add clippy
sudo apt-get install -y redis-server redis-tools lsof libssl-dev
# install nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
@@ -99,7 +95,9 @@ jobs:
- checkout
- run:
# builds release profile images to be released
# consider parallelizing
name: Build Docker Images
no_output_timeout: 15m
command: |
if [ "${CIRCLE_BRANCH}" = "master" ] || [[ "${CIRCLE_TAG}" =~ ^ilp-node- ]]; then
export DOCKER_IMAGE_TAG=$(./.circleci/release/get_docker_image_tag.sh ilp-node ${CIRCLE_TAG})
@@ -162,15 +160,15 @@ jobs:
- run:
name: Install Rust
command: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain 1.38.0
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable
- run:
# Builds release profile binaries
# The artifact is stored in release-builds directory, which is persistent
name: Build binary
command: |
crate_name=$(./.circleci/release/get_crate_name.sh ${CIRCLE_TAG})
printf "Building crate_name: %s, tag: %s\n" "${crate_name}" "${CIRCLE_TAG}"
./.circleci/release/build.sh x86_64-apple-darwin ${crate_name}
cargo build --release --package "${crate_name}" --bin "${crate_name}" --target x86_64-apple-darwin
mkdir -p /tmp/release-builds/x86_64-apple-darwin
cp target/x86_64-apple-darwin/release/${crate_name} /tmp/release-builds/x86_64-apple-darwin/${crate_name}
- persist_to_workspace:
@@ -193,10 +191,6 @@ jobs:
- run:
name: Install Dependencies
command: |
# install system dependeicies
sudo apt-get update
sudo apt-get install -y curl jq
# install nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
export NVM_DIR="/home/circleci/.nvm"

This file was deleted.

@@ -25,11 +25,11 @@ fi
docker run -dt --name builder "${docker_image_name}"

docker cp ./Cargo.toml builder:/usr/src/Cargo.toml
docker cp ./Cargo.lock builder:/usr/src/Cargo.lock
docker cp ./crates builder:/usr/src/crates
docker cp ./.circleci/release/build.sh builder:/usr/src/build.sh

# "--workdir" requires API version 1.35, but the Docker daemon API version of CircleCI is 1.32
echo "cd /usr/src/; ./build.sh x86_64-unknown-linux-musl \"${crate_name}\"" | docker exec -i builder /bin/bash
docker exec builder "/bin/bash" "-c" "cd /usr/src && cargo build --release --package \"${crate_name}\" --bin \"${crate_name}\" --target x86_64-unknown-linux-musl"
docker cp "builder:/usr/src/target/x86_64-unknown-linux-musl/release/${crate_name}" "${artifacts_path}"

docker stop builder
@@ -3,6 +3,7 @@ FROM clux/muslrust:stable as rust

WORKDIR /usr/src
COPY ./Cargo.toml /usr/src/Cargo.toml
COPY ./Cargo.lock /usr/src/Cargo.lock
COPY ./crates /usr/src/crates

# TODO: investigate using a method like https://whitfin.io/speeding-up-rust-docker-builds/
@@ -96,7 +96,7 @@ First of all, we have to prepare `interledger.rs`. You can either:
1. Download compiled binaries
1. Compile from the source code

Compiling the source code relatively slow, so we recommend downloading the pre-built binaries unless you want to modify some part of the code.
Compiling the source code is relatively slow, so we recommend downloading the pre-built binaries unless you want to modify some part of the code.

#### Download Compiled Binaries

@@ -173,6 +173,9 @@ if [ ${SOURCE_MODE} -eq 1 ]; then
-->
```bash
# These aliases make our command invocations more natural
# Be aware that we are using `--` to differentiate arguments for `cargo` from `ilp-node` or `ilp-cli`.
# Arguments before `--` are used for `cargo`, after are used for `ilp-node`.
alias ilp-node="cargo run --quiet --bin ilp-node --"
alias ilp-cli="cargo run --quiet --bin ilp-cli --"
@@ -371,8 +374,6 @@ printf "\nStarting nodes...\n"
# Note that the configuration options can be passed as environment variables
# or saved to a YAML, JSON or TOML file and passed to the node as a positional argument.
# You can also pass it from STDIN.
# Be aware that we are using `--` to differentiate arguments for `cargo` from `ilp-node`.
# Arguments before `--` are used for `cargo`, after are used for `ilp-node`.
# Start Alice's node
ilp-node \
@@ -424,7 +425,7 @@ ilp-cli accounts create alice \
--max-packet-amount 100 \
--ilp-over-http-incoming-token in_alice \
--ilp-over-http-url http://localhost:7770/ilp \
--settle-to 0 > logs/account-alice-alice.log
--settle-to 0 &> logs/account-alice-alice.log
printf "Adding Bob's Account...\n"
ilp-cli --node http://localhost:8770 accounts create bob \
@@ -435,7 +436,7 @@ ilp-cli --node http://localhost:8770 accounts create bob \
--max-packet-amount 100 \
--ilp-over-http-incoming-token in_bob \
--ilp-over-http-url http://localhost:8770/ilp \
--settle-to 0 > logs/account-bob-bob.log
--settle-to 0 &> logs/account-bob-bob.log
printf "Adding Bob's account on Alice's node...\n"
ilp-cli accounts create bob \
@@ -450,7 +451,7 @@ ilp-cli accounts create bob \
--settle-threshold 500 \
--min-balance -1000 \
--settle-to 0 \
--routing-relation Peer > logs/account-alice-bob.log &
--routing-relation Peer &> logs/account-alice-bob.log &
printf "Adding Alice's account on Bob's node...\n"
ilp-cli --node http://localhost:8770 accounts create alice \
@@ -465,7 +466,7 @@ ilp-cli --node http://localhost:8770 accounts create alice \
--ilp-over-http-url http://localhost:7770/ilp \
--settle-threshold 500 \
--settle-to 0 \
--routing-relation Peer > logs/account-bob-alice.log &
--routing-relation Peer &> logs/account-bob-alice.log &
sleep 2
```
@@ -111,12 +111,12 @@ done

### 1. Prepare interledger.rs

First of all, we have to prepare `interledger.rs`. You could either:
First of all, we have to prepare `interledger.rs`. You can either:

1. Download compiled binaries
1. Compile from the source code

If you would like to play more deeply with interledger.rs, compiling from the source is considerable. It would take less time to download compiled binaries otherwise.
Compiling the source code is relatively slow, so we recommend downloading the pre-built binaries unless you want to modify some part of the code.

#### Download Compiled Binaries

@@ -193,6 +193,9 @@ if [ ${SOURCE_MODE} -eq 1 ]; then
-->
```bash
# These aliases make our command invocations more natural
# Be aware that we are using `--` to differentiate arguments for `cargo` from `ilp-node` or `ilp-cli`.
# Arguments before `--` are used for `cargo`, after are used for `ilp-node`.
alias ilp-node="cargo run --quiet --bin ilp-node --"
alias ilp-cli="cargo run --quiet --bin ilp-cli --"
@@ -425,8 +428,6 @@ printf "\nStarting nodes...\n"
# Note that the configuration options can be passed as environment variables
# or saved to a YAML, JSON or TOML file and passed to the node as a positional argument.
# You can also pass it from STDIN.
# Be aware that we are using `--` to differentiate arguments for `cargo` from `ilp-node`.
# Arguments before `--` are used for `cargo`, after are used for `ilp-node`.
# Start Alice's node
ilp-node \
@@ -492,7 +493,7 @@ ilp-cli accounts create alice \
--max-packet-amount 100 \
--ilp-over-http-incoming-token alice_password \
--ilp-over-http-url http://localhost:7770/ilp \
--settle-to 0 > logs/account-alice-alice.log 2>/dev/null
--settle-to 0 &> logs/account-alice-alice.log
printf "Adding Charlie's Account...\n"
ilp-cli --node http://localhost:9770 accounts create charlie \
@@ -503,7 +504,7 @@ ilp-cli --node http://localhost:9770 accounts create charlie \
--max-packet-amount 100 \
--ilp-over-http-incoming-token charlie_password \
--ilp-over-http-url http://localhost:9770/ilp \
--settle-to 0 > logs/account-charlie-charlie.log 2>/dev/null
--settle-to 0 &> logs/account-charlie-charlie.log
printf "Adding Bob's account on Alice's node (ETH Peer relation)...\n"
ilp-cli accounts create bob \
@@ -518,7 +519,7 @@ ilp-cli accounts create bob \
--settle-threshold 500 \
--min-balance -1000 \
--settle-to 0 \
--routing-relation Peer > logs/account-alice-bob.log 2>/dev/null &
--routing-relation Peer &> logs/account-alice-bob.log &
printf "Adding Alice's account on Bob's node (ETH Peer relation)...\n"
ilp-cli --node http://localhost:8770 accounts create alice \
@@ -534,7 +535,7 @@ ilp-cli --node http://localhost:8770 accounts create alice \
--settle-threshold 500 \
--min-balance -1000 \
--settle-to 0 \
--routing-relation Peer > logs/account-bob-alice.log 2>/dev/null
--routing-relation Peer &> logs/account-bob-alice.log
printf "Adding Charlie's account on Bob's node (XRP Child relation)...\n"
ilp-cli --node http://localhost:8770 accounts create charlie \
@@ -550,7 +551,7 @@ ilp-cli --node http://localhost:8770 accounts create charlie \
--settle-threshold 500 \
--min-balance -1000 \
--settle-to 0 \
--routing-relation Child > logs/account-bob-charlie.log 2>/dev/null &
--routing-relation Child &> logs/account-bob-charlie.log &
# We have to wait here to ensure that the parent account is created because
# the child account tries to acquire its ILP address from the parent account.
@@ -570,7 +571,7 @@ ilp-cli --node http://localhost:9770 accounts create bob \
--settle-threshold 500 \
--min-balance -1000 \
--settle-to 0 \
--routing-relation Parent > logs/account-charlie-bob.log 2>/dev/null
--routing-relation Parent &> logs/account-charlie-bob.log
sleep 2
```
@@ -589,7 +590,7 @@ ilp-cli --node http://localhost:8770 rates set-all \
--auth hi_bob \
--pair ETH 1 \
--pair XRP 1 \
&>/dev/null
>/dev/null
```

### 8. Sending a Payment
@@ -72,12 +72,12 @@ done

### 1. Prepare interledger.rs

First of all, we have to prepare `interledger.rs`. You could either:
First of all, we have to prepare `interledger.rs`. You can either:

1. Download compiled binaries
1. Compile from the source code

If you would like to play more deeply with interledger.rs, compiling from the source is considerable. It would take less time to download compiled binaries otherwise.
Compiling the source code is relatively slow, so we recommend downloading the pre-built binaries unless you want to modify some part of the code.

#### Download Compiled Binaries

@@ -154,6 +154,9 @@ if [ ${SOURCE_MODE} -eq 1 ]; then
-->
```bash
# These aliases make our command invocations more natural
# Be aware that we are using `--` to differentiate arguments for `cargo` from `ilp-node` or `ilp-cli`.
# Arguments before `--` are used for `cargo`, after are used for `ilp-node`.
alias ilp-node="cargo run --quiet --bin ilp-node --"
alias ilp-cli="cargo run --quiet --bin ilp-cli --"
@@ -207,8 +210,7 @@ export RUST_LOG=interledger=debug
# Note that the configuration options can be passed as environment variables
# or saved to a YAML, JSON or TOML file and passed to the node as a positional argument.
# You can also pass it from STDIN.
# Be aware that we are using `--` to differentiate arguments for `cargo` from `ilp-node`.
# Arguments before `--` are used for `cargo`, after are used for `ilp-node`.
ilp-node \
--ilp_address example.node_a \
--secret_seed 8852500887504328225458511465394229327394647958135038836332350604 \
@@ -264,7 +266,7 @@ ilp-cli accounts create alice \
--asset-code ABC \
--asset-scale 9 \
--ilp-over-http-incoming-token alice-password \
>logs/account-node_a-alice.log 2>/dev/null
&>logs/account-node_a-alice.log
printf "Creating Node B's account on Node A...\n"
ilp-cli accounts create node_b \
@@ -273,7 +275,7 @@ ilp-cli accounts create node_b \
--ilp-address example.node_b \
--ilp-over-http-outgoing-token node_a:node_a-password \
--ilp-over-http-url 'http://localhost:8770/ilp' \
>logs/account-node_a-node_b.log 2>/dev/null
&>logs/account-node_a-node_b.log
# Insert accounts on Node B
# One account represents Bob and the other represents Node A's account with Node B
@@ -283,15 +285,15 @@ ilp-cli --node http://localhost:8770 accounts create bob \
--auth admin-b \
--asset-code ABC \
--asset-scale 9 \
>logs/account-node_b-bob.log 2>/dev/null
&>logs/account-node_b-bob.log
printf "Creating Node A's account on Node B...\n"
ilp-cli --node http://localhost:8770 accounts create node_a \
--auth admin-b \
--asset-code ABC \
--asset-scale 9 \
--ilp-over-http-incoming-token node_a-password \
>logs/account-node_b-node_a.log 2>/dev/null
&>logs/account-node_b-node_a.log
```

### 5. Sending a Payment
@@ -100,12 +100,12 @@ done

### 1. Prepare interledger.rs

First of all, we have to prepare `interledger.rs`. You could either:
First of all, we have to prepare `interledger.rs`. You can either:

1. Download compiled binaries
1. Compile from the source code

If you would like to play more deeply with interledger.rs, compiling from the source is considerable. It would take less time to download compiled binaries otherwise.
Compiling the source code is relatively slow, so we recommend downloading the pre-built binaries unless you want to modify some part of the code.

#### Download Compiled Binaries

@@ -182,6 +182,9 @@ if [ ${SOURCE_MODE} -eq 1 ]; then
-->
```bash
# These aliases make our command invocations more natural
# Be aware that we are using `--` to differentiate arguments for `cargo` from `ilp-node` or `ilp-cli`.
# Arguments before `--` are used for `cargo`, after are used for `ilp-node`.
alias ilp-node="cargo run --quiet --bin ilp-node --"
alias ilp-cli="cargo run --quiet --bin ilp-cli --"
@@ -264,8 +267,6 @@ mkdir -p logs
# Note that the configuration options can be passed as environment variables
# or saved to a YAML, JSON or TOML file and passed to the node as a positional argument.
# You can also pass it from STDIN.
# Be aware that we are using `--` to differentiate arguments for `cargo` from `ilp-node`.
# Arguments before `--` are used for `cargo`, after are used for `ilp-node`.
# Start Alice's node
ilp-node \
@@ -316,7 +317,7 @@ ilp-cli accounts create alice \
--max-packet-amount 100 \
--ilp-over-http-incoming-token in_alice \
--ilp-over-http-url http://localhost:7770/ilp \
--settle-to 0 > logs/account-alice-alice.log
--settle-to 0 &> logs/account-alice-alice.log
printf "Adding Bob's Account...\n"
ilp-cli --node http://localhost:8770 accounts create bob \
@@ -327,7 +328,7 @@ ilp-cli --node http://localhost:8770 accounts create bob \
--max-packet-amount 100 \
--ilp-over-http-incoming-token in_bob \
--ilp-over-http-url http://localhost:8770/ilp \
--settle-to 0 > logs/account-bob-bob.log
--settle-to 0 &> logs/account-bob-bob.log
printf "Adding Bob's account on Alice's node...\n"
ilp-cli accounts create bob \
@@ -342,7 +343,7 @@ ilp-cli accounts create bob \
--settle-threshold 500 \
--min-balance -1000 \
--settle-to 0 \
--routing-relation Peer > logs/account-alice-bob.log &
--routing-relation Peer &> logs/account-alice-bob.log &
printf "Adding Alice's account on Bob's node...\n"
ilp-cli --node http://localhost:8770 accounts create alice \
@@ -358,7 +359,7 @@ ilp-cli --node http://localhost:8770 accounts create alice \
--settle-threshold 500 \
--min-balance -1000 \
--settle-to 0 \
--routing-relation Peer > logs/account-bob-alice.log &
--routing-relation Peer &> logs/account-bob-alice.log &
sleep 2
```

0 comments on commit d6f5c74

Please sign in to comment.
You can’t perform that action at this time.