@@ -42,8 +42,7 @@ Block-producing collators require robust hardware for reliable operation includi
4242- ** CPU** : 4+ cores (8+ cores recommended for optimal performance)
4343- ** Memory** : 32 GB RAM minimum (64 GB recommended)
4444- ** Storage** :
45- - 500 GB+ NVMe SSD for parachain data
46- - Additional 200+ GB for relay chain pruned database
45+ - 200+ GB NVMe SSD (with pruning enabled for both parachain and relay chain)
4746 - Fast disk I/O is critical for block production performance
4847- ** Network** :
4948 - Public IP address (required)
@@ -213,72 +212,151 @@ Follow these steps to build a chainspec from the runtime:
213212 - People Chain: 1004
214213 - Coretime Chain: 1005
215214
216- ## Create User and Directory Structure
215+ ## Run the Collator
217216
218- 1 . Create a dedicated user with the following command:
219- ``` bash
220- sudo useradd -r -s /bin/bash polkadot
221- ```
217+ Select your preferred deployment method:
222218
223- 2 . Use the following command to copy your chain spec to the directory:
224- ``` bash
225- sudo cp chain-spec.json /var/lib/polkadot-collator/
226- ```
219+ === "Docker Setup"
227220
228- 3 . Set permissions using the following command:
229- ``` bash
230- sudo chown -R polkadot:polkadot /var/lib/polkadot-collator
231- ```
221+ 1. Create a directory for collator data and copy the chain spec:
222+ ```bash
223+ mkdir -p collator-data
224+ cp chain-spec.json collator-data/
225+ cp /var/lib/polkadot-collator/node.key collator-data/
226+ ```
232227
233- ## Create Systemd Service File
228+ 2. Launch the collator using Docker:
229+ ```bash
230+ docker run -d --name polkadot-collator --restart unless-stopped \
231+ -p 30333:30333 \
232+ -p 30334:30334 \
233+ -p 9944:9944 \
234+ -p 9615:9615 \
235+ -v $(pwd)/collator-data:/data \
236+ -v $(pwd)/chain-spec.json:/chain-spec.json \
237+ parity/polkadot-parachain:stable2509-2 \
238+ --collator \
239+ --chain=/chain-spec.json \
240+ --base-path=/data \
241+ --port=30333 \
242+ --rpc-port=9944 \
243+ --prometheus-port=9615 \
244+ --prometheus-external \
245+ --node-key-file=/data/node.key \
246+ --name="YourCollatorName" \
247+ --blocks-pruning=256 \
248+ --state-pruning=256 \
249+ --database=paritydb \
250+ -- \
251+ --chain=polkadot \
252+ --port=30334 \
253+ --sync=fast \
254+ --blocks-pruning=256 \
255+ --state-pruning=256 \
256+ --database=paritydb \
257+ --pool-limit=0 \
258+ --rpc-port=0
259+ ```
234260
235- 1 . Create a service file to hold the configuration for your collator :
236- ``` bash
237- sudo nano /etc/systemd/system/ polkadot-collator.service
238- ```
261+ 3. View logs to monitor sync progress :
262+ ```bash
263+ docker logs -f polkadot-collator
264+ ```
239265
240- 2 . Open the new file and add the following configuration code:
241- ``` ini title="systemd/system/polkadot-collator.service"
242- [Unit]
243- Description =Polkadot System Parachain Collator
244- After =network.target
245-
246- [Service]
247- Type =simple
248- User =polkadot
249- Group =polkadot
250- WorkingDirectory =/var/lib/polkadot-collator
251-
252- # Block-Producing Collator Configuration
253- ExecStart =/usr/local/bin/polkadot-parachain \
254- --collator \
255- --chain =/var/lib/polkadot-collator/chain-spec.json \
256- --base-path =/var/lib/polkadot-collator \
257- --port =30333 \
258- --rpc-port =9944 \
259- --prometheus-port =9615 \
260- --node-key-file =/var/lib/polkadot-collator/node.key \
261- --name =" YourCollatorName" \
262- --blocks-pruning =256 \
263- --state-pruning =256 \
264- --database =paritydb \
265- -- \
266- --chain =polkadot \
267- --port =30334 \
268- --sync =fast \
269- --blocks-pruning =256 \
270- --state-pruning =256 \
271- --database =paritydb \
272- --pool-limit =0 \
273- --rpc-port =0
274-
275- Restart =always
276- RestartSec =10
277- LimitNOFILE =65536
278-
279- [Install]
280- WantedBy =multi-user.target
281- ```
266+ 4. Use the following commands to manage your Docker container:
267+ - Stop container:
268+ ```bash
269+ docker stop polkadot-collator
270+ ```
271+ - Start container:
272+ ```bash
273+ docker start polkadot-collator
274+ ```
275+ - Remove container:
276+ ```bash
277+ docker rm polkadot-collator
278+ ```
279+
280+ === "systemd Setup"
281+
282+ 1. Create a dedicated user:
283+ ```bash
284+ sudo useradd -r -s /bin/bash polkadot
285+ ```
286+
287+ 2. Copy your chain spec to the directory:
288+ ```bash
289+ sudo cp chain-spec.json /var/lib/polkadot-collator/
290+ ```
291+
292+ 3. Set permissions:
293+ ```bash
294+ sudo chown -R polkadot:polkadot /var/lib/polkadot-collator
295+ ```
296+
297+ 4. Create a systemd service file:
298+ ```bash
299+ sudo nano /etc/systemd/system/polkadot-collator.service
300+ ```
301+
302+ 5. Add the following configuration:
303+ ```ini title="systemd/system/polkadot-collator.service"
304+ [Unit]
305+ Description=Polkadot System Parachain Collator
306+ After=network.target
307+
308+ [Service]
309+ Type=simple
310+ User=polkadot
311+ Group=polkadot
312+ WorkingDirectory=/var/lib/polkadot-collator
313+
314+ ExecStart=/usr/local/bin/polkadot-parachain \
315+ --collator \
316+ --chain=/var/lib/polkadot-collator/chain-spec.json \
317+ --base-path=/var/lib/polkadot-collator \
318+ --port=30333 \
319+ --rpc-port=9944 \
320+ --prometheus-port=9615 \
321+ --node-key-file=/var/lib/polkadot-collator/node.key \
322+ --name="YourCollatorName" \
323+ --blocks-pruning=256 \
324+ --state-pruning=256 \
325+ --database=paritydb \
326+ -- \
327+ --chain=polkadot \
328+ --port=30334 \
329+ --sync=fast \
330+ --blocks-pruning=256 \
331+ --state-pruning=256 \
332+ --database=paritydb \
333+ --pool-limit=0 \
334+ --rpc-port=0
335+
336+ Restart=always
337+ RestartSec=10
338+ LimitNOFILE=65536
339+
340+ [Install]
341+ WantedBy=multi-user.target
342+ ```
343+
344+ 6. Start the service:
345+ ```bash
346+ sudo systemctl daemon-reload
347+ sudo systemctl enable polkadot-collator
348+ sudo systemctl start polkadot-collator
349+ ```
350+
351+ 7. Check the status:
352+ ```bash
353+ sudo systemctl status polkadot-collator
354+ ```
355+
356+ 8. View logs:
357+ ```bash
358+ sudo journalctl -u polkadot-collator -f
359+ ```
282360
283361??? note "Configuration notes"
284362
@@ -291,34 +369,6 @@ Follow these steps to build a chainspec from the runtime:
291369 - `--pool-limit=0`: Disables transaction pool on relay chain (collators don't need it)
292370 - `--rpc-port=0` (relay chain): Disables RPC on the embedded relay chain node (not needed for collators)
293371
294- ## Run the Collator
295-
296- Follow these steps to run your collator node:
297-
298- 1 . Reload systemd using the following command:
299- ``` bash
300- sudo systemctl daemon-reload
301- ```
302-
303- 2 . Next, enable the service to start on boot using the command:
304- ``` bash
305- sudo systemctl enable polkadot-collator
306- ```
307- 3 . Now, start the service with the following command:
308- ``` bash
309- sudo systemctl start polkadot-collator
310- ```
311-
312- 4 . Finally, you can check the status of the service using the command:
313- ``` bash
314- sudo systemctl status polkadot-collator
315- ```
316-
317- To view collator service logs, use the command:
318- ``` bash
319- sudo journalctl -u polkadot-collator -f
320- ```
321-
322372## Complete Initial Sync
323373
324374Your collator must sync both the relay chain and parachain before producing blocks.
0 commit comments