Update Local Development docs to use Makefile (#105)
* Update Local Development docs to use Makefile * Update Makefile per @athei Co-authored-by: Alexander Theißen <alex.theissen@me.com> Co-authored-by: Alexander Theißen <alex.theissen@me.com>main
parent
aa444e2413
commit
655bfdc6fc
|
@ -0,0 +1,19 @@
|
||||||
|
.PHONY: init
|
||||||
|
init:
|
||||||
|
./scripts/init.sh
|
||||||
|
|
||||||
|
.PHONY: check
|
||||||
|
check:
|
||||||
|
SKIP_WASM_BUILD=1 cargo check
|
||||||
|
|
||||||
|
.PHONY: test
|
||||||
|
test:
|
||||||
|
SKIP_WASM_BUILD=1 cargo test --all
|
||||||
|
|
||||||
|
.PHONY: run
|
||||||
|
run:
|
||||||
|
WASM_BUILD_TOOLCHAIN=nightly-2020-10-05 cargo run --release -- --dev --tmp
|
||||||
|
|
||||||
|
.PHONY: build
|
||||||
|
build:
|
||||||
|
WASM_BUILD_TOOLCHAIN=nightly-2020-10-05 cargo build --release
|
64
README.md
64
README.md
|
@ -2,42 +2,70 @@
|
||||||
|
|
||||||
A new FRAME-based Substrate node, ready for hacking :rocket:
|
A new FRAME-based Substrate node, ready for hacking :rocket:
|
||||||
|
|
||||||
## Local Development
|
## Getting Started
|
||||||
|
|
||||||
Follow these steps to prepare a local Substrate development environment :hammer_and_wrench:
|
This project contains some configuration files to help get started :hammer_and_wrench:
|
||||||
|
|
||||||
### Setup
|
### Rust Setup
|
||||||
|
|
||||||
Setup instructions can be found at the
|
Setup instructions for working with the [Rust](https://www.rust-lang.org/) programming language can
|
||||||
[Substrate Developer Hub](https://substrate.dev/docs/en/knowledgebase/getting-started).
|
be found at the
|
||||||
|
[Substrate Developer Hub](https://substrate.dev/docs/en/knowledgebase/getting-started). Follow those
|
||||||
|
steps to install [`rustup`](https://rustup.rs/) and configure the Rust toolchain to default to the
|
||||||
|
latest stable version.
|
||||||
|
|
||||||
|
### Makefile
|
||||||
|
|
||||||
|
This project uses a [Makefile](Makefile) to document helpful commands and make it easier to execute
|
||||||
|
them. Get started by running these [`make`](https://www.gnu.org/software/make/manual/make.html)
|
||||||
|
targets:
|
||||||
|
|
||||||
|
1. `make init` - Run the [init script](scripts/init.sh) to configure the Rust toolchain for
|
||||||
|
[WebAssembly compilation](https://substrate.dev/docs/en/knowledgebase/getting-started/#webassembly-compilation).
|
||||||
|
1. `make run` - Build and launch this project in development mode.
|
||||||
|
|
||||||
|
The init script and Makefile both specify the version of the
|
||||||
|
[Rust nightly compiler](https://substrate.dev/docs/en/knowledgebase/getting-started/#rust-nightly-toolchain)
|
||||||
|
that this project depends on.
|
||||||
|
|
||||||
### Build
|
### Build
|
||||||
|
|
||||||
Once the development environment is set up, build the node template. This command will build the
|
The `make run` command will perform an initial build. Use the following command to build the node
|
||||||
[Wasm](https://substrate.dev/docs/en/knowledgebase/advanced/executor#wasm-execution) and
|
without launching it:
|
||||||
[native](https://substrate.dev/docs/en/knowledgebase/advanced/executor#native-execution) code:
|
|
||||||
|
|
||||||
```bash
|
```sh
|
||||||
WASM_BUILD_TOOLCHAIN=nightly-2020-10-05 cargo build --release
|
make build
|
||||||
|
```
|
||||||
|
|
||||||
|
### Embedded Docs
|
||||||
|
|
||||||
|
Once the project has been built, the following command can be used to explore all parameters and
|
||||||
|
subcommands:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
./target/release/node-template -h
|
||||||
```
|
```
|
||||||
|
|
||||||
## Run
|
## Run
|
||||||
|
|
||||||
### Single Node Development Chain
|
The `make run` command will launch a temporary node and its state will be discarded after you
|
||||||
|
terminate the process. After the project has been built, there are other ways to launch the node.
|
||||||
|
|
||||||
Purge any existing dev chain state:
|
### Single-Node Development Chain
|
||||||
|
|
||||||
```bash
|
This command will start the single-node development chain with persistent state:
|
||||||
./target/release/node-template purge-chain --dev
|
|
||||||
```
|
|
||||||
|
|
||||||
Start a dev chain:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./target/release/node-template --dev
|
./target/release/node-template --dev
|
||||||
```
|
```
|
||||||
|
|
||||||
Or, start a dev chain with detailed logging:
|
Purge the development chain's state:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./target/release/node-template purge-chain --dev
|
||||||
|
```
|
||||||
|
|
||||||
|
Start the development chain with detailed logging:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
RUST_LOG=debug RUST_BACKTRACE=1 ./target/release/node-template -lruntime=debug --dev
|
RUST_LOG=debug RUST_BACKTRACE=1 ./target/release/node-template -lruntime=debug --dev
|
||||||
|
|
|
@ -5,8 +5,10 @@ set -e
|
||||||
echo "*** Initializing WASM build environment"
|
echo "*** Initializing WASM build environment"
|
||||||
|
|
||||||
if [ -z $CI_PROJECT_NAME ] ; then
|
if [ -z $CI_PROJECT_NAME ] ; then
|
||||||
rustup install nightly-2020-10-05
|
rustup update nightly
|
||||||
|
rustup update nightly-2020-10-05
|
||||||
rustup update stable
|
rustup update stable
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
rustup target add wasm32-unknown-unknown --toolchain nightly
|
||||||
rustup target add wasm32-unknown-unknown --toolchain nightly-2020-10-05
|
rustup target add wasm32-unknown-unknown --toolchain nightly-2020-10-05
|
||||||
|
|
25
shell.nix
25
shell.nix
|
@ -1,25 +0,0 @@
|
||||||
let
|
|
||||||
mozillaOverlay =
|
|
||||||
import (builtins.fetchGit {
|
|
||||||
url = "https://github.com/mozilla/nixpkgs-mozilla.git";
|
|
||||||
rev = "57c8084c7ef41366993909c20491e359bbb90f54";
|
|
||||||
});
|
|
||||||
nixpkgs = import <nixpkgs> { overlays = [ mozillaOverlay ]; };
|
|
||||||
rust-nightly = with nixpkgs; ((rustChannelOf { date = "2020-10-05"; channel = "nightly"; }).rust.override {
|
|
||||||
targets = [ "wasm32-unknown-unknown" ];
|
|
||||||
});
|
|
||||||
in
|
|
||||||
with nixpkgs; pkgs.mkShell {
|
|
||||||
buildInputs = [
|
|
||||||
clang
|
|
||||||
cmake
|
|
||||||
pkg-config
|
|
||||||
rust-nightly
|
|
||||||
] ++ stdenv.lib.optionals stdenv.isDarwin [
|
|
||||||
darwin.apple_sdk.frameworks.Security
|
|
||||||
];
|
|
||||||
|
|
||||||
LIBCLANG_PATH = "${llvmPackages.libclang}/lib";
|
|
||||||
PROTOC = "${protobuf}/bin/protoc";
|
|
||||||
ROCKSDB_LIB_DIR = "${rocksdb}/lib";
|
|
||||||
}
|
|
Loading…
Reference in New Issue