From 9358a0f42190a266e4571eda5942171154dc39aa Mon Sep 17 00:00:00 2001 From: sayyed-kamran Date: Fri, 31 Mar 2023 21:46:49 +0500 Subject: [PATCH] Add comnd to readme to run parachain in container --- Dockerfile.parachain | 26 ++++++++++++++++++++++++++ README.md | 39 ++++----------------------------------- 2 files changed, 30 insertions(+), 35 deletions(-) create mode 100644 Dockerfile.parachain diff --git a/Dockerfile.parachain b/Dockerfile.parachain new file mode 100644 index 00000000..b49a5982 --- /dev/null +++ b/Dockerfile.parachain @@ -0,0 +1,26 @@ +FROM docker.io/paritytech/ci-linux:production as builder + +WORKDIR /node +COPY . . +RUN cargo build --release + +FROM docker.io/library/ubuntu:22.04 + +# Copy the node binary from builder stage. +COPY --from=builder /node/target/release/peaq-node /usr/local/bin +COPY --from=builder /node/node/src/chain-specs/ /node/src/chain-specs + + +RUN useradd -m -u 1000 -U -s /bin/sh -d /peaq peaq && \ + mkdir -p /chain-data /peaq/.local/share && \ + chown -R peaq:peaq /chain-data && \ + ln -s /chain-data /peaq/.local/share/node && \ + rm -rf /usr/bin /usr/sbin && \ + # check if executable works in this container + /usr/local/bin/peaq-node --version + +USER peaq + +EXPOSE 9933 30333 9944 9615 +VOLUME ["/chain-data"] +ENTRYPOINT ["/usr/local/bin/peaq-node"] \ No newline at end of file diff --git a/README.md b/README.md index 967610e9..ce317134 100644 --- a/README.md +++ b/README.md @@ -181,31 +181,10 @@ A FRAME pallet is compromised of a number of blockchain primitives: First, install [Docker](https://docs.docker.com/get-docker/) and [Docker Compose](https://docs.docker.com/compose/install/). -Please follow the steps given below to run peaq-network-node parachian on your local machine connected with polkadot -relaychain running in the PEAQ development environment. It is assumed that you have already downloaded the source code -for peaq-network-node from the git repository +Please use following command to run peaq-network-node parachian in the docker container connected with polkadot relaychain running in the PEAQ development environment. -1. CD into the peaq-network-node directory: -```bash -cd peaq-network-node -``` - -2. Checkout the appropriate branch: -```bash -git checkout run_peaq_dev_parachain_with_docker_commands -``` -3. Create the following folder: - ```bash - mkdir ./.local - ``` - - The folder .local is needed because that is where data such as session keys are stored for validators. Also we bind mount from the container folder /root/.local to the host machine project root folder ./.local. - -Now run the following script to start a peaq-network-node parachain that will connect to the polkadot relay chain running in peaq development envoirnment: ```bash -./scripts/docker_run.sh -./target/release/peaq-node \ ---chain ./node/src/chain-specs/peaq-dev-parachain-raw.json \ + docker run kamranpeaq/peaq-node-parachain:2.0 --chain ./node/src/chain-specs/peaq-dev-parachain-raw.json \ --base-path /tmp/parachain/alice \ --port 40333 \ --ws-port 8844 \ @@ -214,19 +193,9 @@ Now run the following script to start a peaq-network-node parachain that will co --chain ./node/src/chain-specs/rococo-local-relaychain-raw.json \ --port 30343 \ --ws-port 9977 -``` -This command will first compile your code (if it is not already compiled), and then start a peaq-network-node parachain. The node running on your local machine will take sometime to sync up. Make sure that the parachain blocks are generated. - -You can also replace the default command by appending your own. A few useful ones are as follows: + ``` -```bash -# Purge the local dev chain -./scripts/docker_run.sh ./target/release/peaq-node purge-chain --dev -``` -```bash -# Check whether the code is compilable -./scripts/docker_run.sh cargo check -``` +Once you run this command, wait for a few second. Now the peaq parachian should be running in the docker container that is connected to relaychain running in PEAQ dev environament. ### Parachain Launch