This page provides instructions on how to deploy a chain to a server.
Before we begin, please note that this document only covers the method of downloading and using the chain spec file via the network. If you prefer not to proceed this way, you can upload the file or directly create the chain spec file on the server using various methods.
There are three methods for server deployment:
Systemd
Docker
Kubernetes
Let's explore how to deploy using these three methods.
Systemd
Systemd is a common method for managing services on Linux hosts. It allows you to check if a process is active and running, set policies for restarts, configure the user running the host, and limit memory usage, among other tasks.
You can also use environment variable files to abstract variables into separate files for each server.
To use systemd, you need to first register the service. To do this, create a file named Infrablockspace.service in the /etc/systemd/system directory. Then, copy and paste the code below, replacing <binary file> and <options> with the necessary option values. For a Relay Chain, use infrablockspace as the <binary file>, and for a parachain, use infrablockspace-parachain.
For a parachain, the boot node ID of the Relay Chain is required. Therefore, you need to fill in <bootnode id>.
Run the following command to execute the Docker Compose:
dockercomposeup-d
Kubernetes
To deploy a chain in Kubernetes, you need to create the following files:
Please note that dynamic persistent volume claims are assumed to be possible. If dynamic persistent volume claims are not possible, please create persistent volumes.
For a Relay Chain:
statefuleset.yaml
apiVersion:apps/v1kind:StatefulSetmetadata:name:infrablockspace-bootspec:# pod selectorselector:matchLabels:app:infrablockspace# has to match .spec.template.metadata.labelsregion:an2mode:relay-boot# select headless serviceserviceName:"infrablockspace-headless-service"# update strategyupdateStrategy:rollingUpdate:maxUnavailable:1type:RollingUpdate# specreplicas:1# by default is 1template:metadata:labels:app:infrablockspace# has to match .spec.template.metadata.labelsregion:an2mode:relay-bootspec:terminationGracePeriodSeconds:10securityContext:fsGroup:2000runAsNonRoot:truerunAsUser:1000initContainers:-name:download-specimage:curlimages/curl:8.1.2command: ["curl","-L",<relaychainspecurl>,"-o","/tmp/raw-local-chainspec.json", ]volumeMounts:-name:infrablockspace-specmountPath:/tmpcontainers:-name:infrablockspaceimage:public.ecr.aws/v8x3j0k5/infrablockspace:3imagePullPolicy:Alwaysargs: ["--alice","--validator","--base-path","/data/infrablockspace","--chain","/tmp/raw-local-chainspec.json","--rpc-port=9933",# json rpc"--ws-port=9944",#p2p"--prometheus-external","--prometheus-port=9615","--unsafe-rpc-external","--unsafe-ws-external","--rpc-cors","all","--ws-max-connections=16000" ]resources:limits:cpu:1000mmemory:2Giports:-containerPort:9933name:infraspace-http-containerPort:30333name:infraspace-p2pvolumeMounts:-name:infrablockspace-pvcmountPath:/data/infrablockspace-name:infrablockspace-specmountPath:/tmp# volume claimvolumes:-name:infrablockspace-specemptyDir:{}-name:chain-keystoreemptyDir:{}-name:infrablockspace-pvcpersistentVolumeClaim:claimName:infrablockspace-pvc
service.yaml
apiVersion:v1kind:Servicemetadata:name:infrablockspace-service-clusteripspec:selector:app:infrablockspacetype:ClusterIPports:-name:infraspace-httpprotocol:TCPport:9933targetPort:9933# If you set the `spec.type` field to `NodePort` and you want a specific port number,# you can specify a value in the `spec.ports[*].nodePort` field.-name:infraspace-wsprotocol:TCPport:9944targetPort:9944-name:infraspace-p2pprotocol:TCPport:30333targetPort:30333---apiVersion:v1kind:Servicemetadata:name:infrablockspace-headless-servicespec:clusterIP:Noneselector:app:infrablockspaceports:-name:infraspace-httpprotocol:TCPport:9933targetPort:9933-name:infraspace-wsprotocol:TCPport:9944targetPort:9944-name:infraspace-p2pprotocol:TCPport:30333targetPort:30333---apiVersion:v1kind:Servicemetadata:name:infrablockspace-boot-peerspec:selector:app:infrablockspacemode:relay-bootports:-name:infraspace-p2pprotocol:TCPport:30333targetPort:30333
apiVersion:v1kind:Servicemetadata:name:infra-did-service-clusteripspec:selector:app:infra-didmode:paratype:ClusterIPports: - name:infra-did-httpprotocol:TCPport:9933targetPort:9933 - name:infra-did-wsprotocol:TCPport:9944targetPort:9944# If you set the `spec.type` field to `NodePort` and you want a specific port number,# # you can specify a value in the `spec.ports[*].nodePort` field. - name:relay-peerprotocol:TCPport:30333targetPort:30333---apiVersion:v1kind:Servicemetadata:name:infra-did-headless-servicespec:clusterIP:Noneselector:app:infra-didmode:paraports: - name:infra-did-httpprotocol:TCPport:9933targetPort:9933 - name:infra-did-wsprotocol:TCPport:9944targetPort:9944# If you set the `spec.type` field to `NodePort` and you want a specific port number,# you can specify a value in the `spec.ports[*].nodePort` field. - name:relay-peerprotocol:TCPport:30333targetPort:30333