Skip to content

Commit

Permalink
Add comnd to readme to run parachain in container
Browse files Browse the repository at this point in the history
  • Loading branch information
sayyed-kamran committed Mar 31, 2023
1 parent 844d4a6 commit 9358a0f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 35 deletions.
26 changes: 26 additions & 0 deletions Dockerfile.parachain
Original file line number Diff line number Diff line change
@@ -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"]
39 changes: 4 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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

Expand Down

0 comments on commit 9358a0f

Please sign in to comment.