I deployed a relay chain node using the provided docker container:
docker run \
--detach \
--name=polkadot \
--volume="$(pwd)/data:/data" \
--network=host \
--entrypoint=polkadot \
"parity/polkadot:v0.9.12" \
--pruning=archive \
--name=polkadot-mainnet-123 \
--database=rocksdb \
--base-path=/data \
--port=30333 \
--rpc-port=8833 \
--rpc-cors=all \
--rpc-external \
--ws-port=8844 \
--ws-external \
--in-peers=5 \
--out-peers=5 \
--max-parallel-downloads=5 \
--prometheus-port=9688
I also deployed a parachain node with the provided docker container (Moonbeam in this case):
docker run \
--detach \
--name=moonbeam \
--volume="$(pwd)/data:/data/volume" \
--network=host \
--entrypoint="/moonbeam/moonbeam" \
"purestake/moonbeam:sha-7b9a2ceb" \
--chain=moonbeam \
--base-path=/data/volume \
--name=moonbeam-mainnet-123 \
--port=30340 \
--rpc-port=9988 \
--rpc-cors=all \
--rpc-external \
--ws-port=9999 \
--ws-external \
--in-peers=5 \
--out-peers=5 \
--prometheus-port=9636 \
-- \
--name=polkadot-mainnet-456 \
--port=30341 \
--rpc-port=19988 \
--rpc-cors=all \
--rpc-external \
--ws-port=19999 \
--ws-external \
--in-peers=5 \
--out-peers=5 \
--prometheus-port=19636
As you can see the Moonbeam node has a relay chain node bundled in the same deployment.
This is also true of most other parachain nodes (e.g. Astar, Acala etc.).
This is quite surprising to me as I initially thought it should be relatively trivial to point the parachain node at an existing (fully synced) relay chain node, and have it establish a connection through a Unix socket or a TCP port.
Naturally having each parachain deploy and sync its own relay chain node is not ideal since the relay chain node is usually the most resource intensive aspect of the deployment and so having to replicate it with every parachain deployment is an unnecessary waste of compute resources.
I understand that the Cumulus framework is used to register a parachain and connect with the relay chain, but why is the parachain node tied to the relay chain node in the same binary of most parachain projects - is it just for convenience or is there a technical reason of why the nodes have to be deployed together?