Deploy multiple nodes as stack with docker compose

Hello,
I want to move my nodes to larger drives. To adjust the size I have to delete the docker container and deploy a new one with the new credentials. Is it possible to deploy several nodes as a stack, so if there is something to be changed it will be easier and faster to adjust just one file, instead of deleting them, adjust the credentials and manually deploying them one by one via console. (I`m using portainer).

Check out docker-compose. It allows you to have a file that holds your entire docker config and you can start, stop, restart, etc with easy CLI commands, and can update your docker-compose.yml then run an unchanging command to reup the node. You just run “docker-compose up -d”, and any containers that have been changed get removed and started again with the new config.

2 Likes

You may check this:

3 Likes

if anyone needs help setting this up, let me know!

i have a couple running this way since a couple of years.

Hi,
I have another question about the docker-compose file.
Do I understand correctly that if I want to have several nodes in the file, they have to look something like this?

version: "3.3"
services:
  Node1:
    image: storjlabs/storagenode:latest
    container_name: Node1
    volumes:
 - type: bind
        source: <"/Path/to/identity/files">
        target: /app/identity
      - type: bind
        source: <"/Path/to/Data/storage/location">
        target: /app/config
    ports:
      - "28967:28967/tcp"
      - "28967:28967/udp"
      - 14002:14002
    restart: unless-stopped
    stop_grace_period: 300s
    environment:
      - WALLET=<WalletID>
      - EMAIL=<Emailaddress>
      - ADDRESS=<example.com:28967>
      - STORAGE=<1TB>
	  
  Node2:
    image: storjlabs/storagenode:latest
    container_name: Node2
    volumes:
 - type: bind
        source: <"/Path/to/identity/files">
        target: /app/identity
      - type: bind
        source: <"/Path/to/Data/storage/location">
        target: /app/config
    ports:
      - "28968:28967/tcp"
      - "28968:28967/udp"
      - 14003:14002
    restart: unless-stopped
    stop_grace_period: 300s
    environment:
      - WALLET=<WalletID>
      - EMAIL=<Emailaddress>
      - ADDRESS=<example.com:28968>
      - STORAGE=<1TB>
 
  watchtower:
    image: storjlabs/watchtower
    restart: unless-stopped
    container_name: watchtower
    command: "<containername> watchtower --stop-timeout 300s --interval 21600"
    volumes:
    - /var/run/docker.sock:/var/run/docker.sock

So that these places have to be adapted? And of course the paths.

  - "28968:28967/tcp"
  - "28968:28967/udp"
  - 14003:14002
  - ADDRESS=<example.com:28968>

Thank you very much! :slight_smile:

Greetings
CubeFan

Yes, looks correct. You need to update port mappings and port in the external address for the each next node - they should be unique.
Don’t forget to update/add port forwarding rule on your router.