Skip to content

Instantly share code, notes, and snippets.

@Javiseeker
Created June 25, 2021 02:44
Show Gist options
  • Select an option

  • Save Javiseeker/fc91c06efdff1784a02d98c276170511 to your computer and use it in GitHub Desktop.

Select an option

Save Javiseeker/fc91c06efdff1784a02d98c276170511 to your computer and use it in GitHub Desktop.
Docker-compose file that creates a Private IPFS Node Network with a Cluster.
networks:
vpcbr:
driver: bridge
ipam:
config:
- subnet: 10.5.0.0/16
services:
# ipfs peer/node0 only one in charge of adding data for cluster0
ipfsNode0:
container_name: tipfsNode0
image: ipfs/go-ipfs:latest
ports:
- "4001:4001" # ipfs swarm - expose if needed/wanted
- "5001:5001" # ipfs api - expose if needed/wanted
- "8080:8080" # ipfs gateway - expose if needed/wanted
volumes:
- ./data/tipfsNode0:/data/ipfs
environment:
IPFS_SWARM_KEY: /key/swarm/psk/1.0.0/base16/b87ba5d2a00e1fb91d386411639897605e39813b054c434fe9b6fc60aab07ea5
IPFS_LOGGING: debug
networks:
vpcbr:
ipv4_address: 10.5.0.5
# ipfs peer/node1
ipfsNode1:
container_name: tipfsNode1
image: ipfs/go-ipfs:latest
volumes:
- ./data/tipfsNode1:/data/ipfs
environment:
IPFS_SWARM_KEY: /key/swarm/psk/1.0.0/base16/b87ba5d2a00e1fb91d386411639897605e39813b054c434fe9b6fc60aab07ea5
IPFS_LOGGING: debug
ports:
- "4101:4001" # ipfs swarm - expose if needed/wanted
- "5101:5001" # ipfs api - expose if needed/wanted
- "8180:8080" # ipfs gateway - expose if needed/wanted
networks:
vpcbr:
ipv4_address: 10.5.0.6
#cluster peer 0
cluster0:
container_name: tcluster0
image: ipfs/ipfs-cluster:latest
depends_on:
- ipfsNode0
- ipfsNode1
environment:
CLUSTER_PEERNAME: tcluster0
CLUSTER_SECRET: 1aebe6d1ff52d96241e00d1abbd1be0743e3ccd0e3f8a05e3c8dd2bbbddb7b93
# CLUSTER_REPLICATIONFACTORMIN: -1
# CLUSTER_REPLICATIONFACTORMAX: -1
CLUSTER_IPFSHTTP_NODEMULTIADDRESS: /dns4/ipfsNode0/tcp/5001
CLUSTER_CRDT_TRUSTEDPEERS: '*' # Trust all peers in Cluster
CLUSTER_RESTAPI_HTTPLISTENMULTIADDRESS: /ip4/0.0.0.0/tcp/9094 # Expose API
CLUSTER_MONITORPINGINTERVAL: 2s # Speed up peer discovery
ports:
- "9094:9094" # Open API port (allows ipfs-cluster-ctl usage on host)
- "9095:9095" # The cluster swarm port
- "9096:9096" # Cluster IPFS Proxy endpoint
volumes:
- ./data/tcluster0:/data/ipfs-cluster
networks:
vpcbr:
ipv4_address: 10.5.0.7
### To generate this hash/ipfs-swarm-key I ran the following .sh script with git bash.
!/bin/bash
set -eu
function main() {
echo -e "/key/swarm/psk/1.0.0/\n/base16/\n$(tr -dc 'a-f0-9' < /dev/urandom | head -c64)"
}
main "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment