Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Duniter v2S
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nodes
rust
Duniter v2S
Commits
eb60eb78
Commit
eb60eb78
authored
2 years ago
by
Éloïs
Browse files
Options
Downloads
Patches
Plain Diff
feat(scripts):create-live-network: reuse raw spec if already exist
parent
4cdc5ecd
No related branches found
No related tags found
1 merge request
!41
feat: add script create-live-network.sh
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripts/create-live-network.sh
+28
-8
28 additions, 8 deletions
scripts/create-live-network.sh
with
28 additions
and
8 deletions
scripts/create-live-network.sh
+
28
−
8
View file @
eb60eb78
#!/usr/bin/env bash
#
# USAGE
#
# 1. Generate genesis authorities session keys.
# 2. Create the json file that contains the genesis configuration and verify carefully that the
# declared session keys correspond to the one you have generated in the first step.
# 3. Generate raw chain specs with script `gen-live-network-raw-spec.sh`.
# 4. Share the generated raw spec with other genesis authorities.
# 5. Each genesis authority should run this script with its session keys seed.
#
# This script is meant to be run on Unix/Linux based systems
set
-e
# params
VALIDATOR_SESSION_KEYS_SURI
=
$1
GENESIS
=
"
${
2
:-
resources
/gdev.json
}
"
CURRENCY
=
"
${
3
:-
gdev
}
"
WORK
_DIR
=
"
${
4
:-
tmp
/
$CURRENCY
}
"
CURRENCY
=
"
${
2
:-
gdev
}
"
WORK_DIR
=
"
${
3
:-
tmp
/
$CURRENCY
}
"
SPEC
_DIR
=
"
${
4
:-
resources
}
"
echo
"CURRENCY=
$CURRENCY
"
...
...
@@ -21,10 +32,18 @@ mkdir -p $WORK_DIR/duniter-validator
# build client in debug mode
#cargo clean -p duniter && cargo build
# generate raw_chain spec
export
DUNITER_GENESIS_CONFIG
=
$GENESIS
$DUNITER_BINARY
build-spec
--chain
$CURRENCY
-gl
--raw
>
$WORK_DIR
/duniter-rpc/
$CURRENCY
-raw
.json
cp
$WORK_DIR
/duniter-rpc/
$CURRENCY
-raw
.json
$WORK_DIR
/duniter-validator/
$CURRENCY
-raw
.json
if
[
-e
"
$SPEC_DIR
/
$CURRENCY
-raw.json"
]
then
# copy raw chain spec
cp
$SPEC_DIR
/
$CURRENCY
-raw
.json
$WORK_DIR
/duniter-rpc/
$CURRENCY
-raw
.json
cp
$SPEC_DIR
/
$CURRENCY
-raw
.json
$WORK_DIR
/duniter-validator/
$CURRENCY
-raw
.json
else
# generate raw chain spec
echo
"generate raw_chain spec…"
export
DUNITER_GENESIS_CONFIG
=
"
$SPEC_DIR
/
$CURRENCY
.json"
$DUNITER_BINARY
build-spec
--chain
$CURRENCY
-gl
--raw
>
$WORK_DIR
/duniter-rpc/
$CURRENCY
-raw
.json
cp
$WORK_DIR
/duniter-rpc/
$CURRENCY
-raw
.json
$WORK_DIR
/duniter-validator/
$CURRENCY
-raw
.json
fi
# generate rpc node key
RPC_NODE_KEY
=
$(
$DUNITER_BINARY
key generate-node-key
--file
$WORK_DIR
/duniter-rpc/node-key 2>&1
)
...
...
@@ -39,9 +58,10 @@ sed -i -e "s/RPC_NODE_KEY/$RPC_NODE_KEY/g" $WORK_DIR/docker-compose.yml
sed
-i
-e
"s/VALIDATOR_NODE_KEY/
$VALIDATOR_NODE_KEY
/g"
$WORK_DIR
/docker-compose.yml
# Inject validator session keys in validator node keystore
$DUNITER_BINARY
key generate-session-keys
--chain
"
${
CURRENCY
}
_local"
--suri
"
$VALIDATOR_SESSION_KEYS_SURI
"
-d
$WORK_DIR
/duniter-validator
$DUNITER_BINARY
key generate-session-keys
--chain
"
${
CURRENCY
}
_local"
--suri
"
$VALIDATOR_SESSION_KEYS_SURI
"
-d
$WORK_DIR
/duniter-validator
>
/dev/null
mv
$WORK_DIR
/duniter-validator/chains/
${
CURRENCY
}
_local
$WORK_DIR
/duniter-validator/chains/
$CURRENCY
# Launch the network
echo
"compose ready in '
$WORK_DIR
'"
cd
$WORK_DIR
#docker-compose up -d
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment