Collator set-up guide

COLLATOR SET UP GUIDE

In this document, we will cover how to set up a collator with Composable Finance. There are several ways to do that.
  • Build node locally
  • Download pre-build node from GitHub releases
  • Run node in docker

Build from source

In this step, we will set up a rust compiler, and toolchain and build a node. Setup required libraries
1
sudo apt install -y git clang curl libssl-dev llvm libudev-dev
Copied!
Setup Rust binary and Toolchain
1
#!/bin/bash
2
RUST_C="nightly-2021-11-07"
3
curl https://sh.rustup.rs -sSf | sh -s -- -y && \
4
export PATH="$PATH:$HOME/.cargo/bin" && \
5
rustup toolchain uninstall $(rustup toolchain list) && \
6
rustup toolchain install $RUST_C && \
7
rustup target add wasm32-unknown-unknown --toolchain $RUST_C && \
8
rustup default $RUST_C && \
9
rustup show
Copied!
Get project and build node
1
git clone --depth 1 --branch v2.1.3 https://github.com/ComposableFi/composable.git && \
2
cd composable && \
3
export SKIP_WASM_BUILD=1 && \
4
cargo build --release
Copied!
One-liner
1
RUST_C="nightly-2021-11-07"
2
RELEASE_TAG="v2.1.3"
3
4
sudo apt install -y git clang curl libssl-dev llvm libudev-dev && \
5
git clone --depth 1 --branch $RELEASE_TAG https://github.com/ComposableFi/composable.git && \
6
cd composable && \
7
curl https://sh.rustup.rs -sSf | sh -s -- -y && \
8
export PATH="$PATH:$HOME/.cargo/bin" && \
9
rustup toolchain uninstall $(rustup toolchain list) && \
10
rustup toolchain install $RUST_C && \
11
rustup target add wasm32-unknown-unknown --toolchain $RUST_C && \
12
rustup default $RUST_C && \
13
rustup show && \
14
export SKIP_WASM_BUILD=1 && \
15
cargo build --release
Copied!
Compiled node should be in ./target/release
Download prebuilt node
wget https://github.com/ComposableFi/composable/releases/download/v2.1.3/composable

Run as systemd service

Download prebuilt node

wget https://github.com/ComposableFi/composable/releases/download/v2.1.3/composable
  1. 1.
    Put compiled binary to /usr/bin/ cp ./target/release/composable /usr/bin
  2. 2.
    Create collator.service file and put following content into it. Save it with Ctrl+O sudo nano /etc/systemd/system/collator.service
  3. 3.
    Enable and Start service sudo systemctl enable collator.service sudo systemctl start collator.service
  4. 4.
    Check service status sudo systemctl status collator.service
  5. 5.
    Check logs output journalctl -f collator.service content
1
[Unit]
2
Description=Composable
3
4
[Service]
5
6
ExecStart=/usr/local/bin/сomposable \
7
--collator \
8
--chain=picasso \
9
--pruning=archive \
10
--base-path /var/lib/composable-data/ \
11
--port 30333 \
12
--listen-addr=/ip4/0.0.0.0/tcp/30334 \
13
--execution wasm \
14
-- \
15
--execution=wasm \
16
--pruning=archive \
17
--listen-addr=/ip4/0.0.0.0/tcp/30333
18
19
20
# (file size)
21
LimitFSIZE=infinity
22
# (cpu time)
23
LimitCPU=infinity
24
# (virtual memory size)
25
LimitAS=infinity
26
# (locked-in-memory size)
27
LimitMEMLOCK=infinity
28
# (open files)
29
LimitNOFILE=64000
30
# (processes/threads)
31
LimitNPROC=64000
32
33
Restart=always
34
RestartSec=120
35
36
[Install]
37
WantedBy=multi-user.target
38
Copied!
Compiled node should be in ./target/release

Download prebuilt node

wget https://github.com/ComposableFi/composable/releases/download/v2.1.3/composable

Run as systemd service

Download prebuilt node

wget https://github.com/ComposableFi/composable/releases/download/v2.1.3/composable
  1. 1.
    Put compiled binary to /usr/bin/ cp ./target/release/composable /usr/bin
  2. 2.
    Create collator.service file and put following content into it. Save it with Ctrl+O sudo nano /etc/systemd/system/collator.service
  3. 3.
    Enable and Start service sudo systemctl enable collator.service sudo systemctl start collator.service
  4. 4.
    Check service status sudo systemctl status collator.service
  5. 5.
    Check logs output journalctl -f collator.service content
1
[Unit]
2
Description=Composable
3
4
[Service]
5
6
ExecStart=/usr/local/bin/сomposable \
7
--collator \
8
--chain=picasso \
9
--pruning=archive \
10
--base-path /var/lib/composable-data/ \
11
--port 30333 \
12
--listen-addr=/ip4/0.0.0.0/tcp/30334 \
13
--execution wasm \
14
-- \
15
--execution=wasm \
16
--pruning=archive \
17
--listen-addr=/ip4/0.0.0.0/tcp/30333
18
19
20
# (file size)
21
LimitFSIZE=infinity
22
# (cpu time)
23
LimitCPU=infinity
24
# (virtual memory size)
25
LimitAS=infinity
26
# (locked-in-memory size)
27
LimitMEMLOCK=infinity
28
# (open files)
29
LimitNOFILE=64000
30
# (processes/threads)
31
LimitNPROC=64000
32
33
Restart=always
34
RestartSec=120
35
36
[Install]
37
WantedBy=multi-user.target
Copied!

Setup docker and docker-compose

1
sudo apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
2
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
3
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
4
sudo apt install docker-ce docker-ce-cli containerd.io
Copied!
Optional steps
1
sudo apt-mark hold docker-ce # prevent the Docker package from being updated, so no sudden updates and process interuption
2
sudo usermod -aG docker $USER # adds docker to sudo group so there's no need to run it from root
Copied!
Setup docker compose
1
sudo curl -L
2
"https://github.com/docker/compose/releases/download/1.29.2/docker-
3
compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
4
5
sudo chmod +x /usr/local/bin/docker-compose
Copied!
Check docker installation sudo systemctl status docker docker container run hello-world
docker compose
Save the following content to docker-compose.yml and run docker-compose up -d
1
version: "3.7"
2
3
services:
4
composable_node:
5
image: composablefi/composable:latest
6
container_name: composable_node
7
volumes:
8
- ./chain-data:/chain-data
9
ports:
10
- 9833:9833
11
- 9844:9844
12
- 40333:40333
13
- 30333:30333
14
restart: unless-stopped
15
command: >
16
/usr/local/bin/сomposable
17
--collator
18
--chain=picasso
19
--pruning=archive
20
--base-path /chain-data
21
--port 30333
22
--unsafe-ws-external
23
--unsafe-rpc-external
24
--listen-addr=/ip4/0.0.0.0/tcp/30334k
25
--execution wasm
26
--
27
--execution=wasm
28
--listen-addr=/ip4/0.0.0.0/tcp/30333
Copied!