In this section we will cover how to deploy a NEO•ONE Node to a swarm using Docker Compose.
If you haven’t already be sure to check out the local docker development section to familiarize yourself with the container we are deploying. Additionally, brushing up on Docker-Compose would also be worthwhile.
We’ll be deploying with docker-compose using
swarm mode. The
docker-compose.yml below is a very similar deployment to what we saw in the kubernetes section. We create a persistent named-volume for each container started and run our backup and sync configuration.
## docker-compose.yml version: "3.1" services: node: image: quay.io/neoone/node command: [ "--options.node.rpcURLs=http://seed6.ngd.network:10332", "--options.node.rpcURLs=https://seed1.red4sec.com:10332", "--options.backup.restore=true", "--options.backup.options.gcloud.projectID=neotracker-172901", "--options.backup.options.gcloud.bucket=bucket-1.neo-one.io", "--options.backup.options.gcloud.prefix=node_0", "--options.backup.options.gcloud.maxSizeBytes=419430400" ] deploy: replicas: 1 resources: limits: cpus: "1" memory: 4G restart_policy: condition: on-failure volumes: - node-data:/root/.local/share/neo_one_node volumes: node-data:
To start a docker swarm and apply our deployment you can run
docker swarm init docker stack deploy -c docker-compose.yml test
You can then check this service is running with
docker service ls
Finally, to shutdown this deployment kill the swarm using
docker swarm leave --force
If you delete the service created by docker, you will still need to cleanup the volume,
node-datain our example, that is created on startup. You can find the volume using
docker volume lsand remove it using
docker volume rm <volume-name>.
You can list all of the containers being run using
docker container ls
then to see its logs you can either attach directly to the container (we recommend this only for testing startup as SIGINT will kill the container) with
docker attach <container_id>
or check its most recent logs
docker logs <container_id>