diff --git a/deployment/samples/docker-compose/docker-compose.yml b/deployment/samples/docker-compose/docker-compose.yml index 3a3eb3aa2..7c929089d 100644 --- a/deployment/samples/docker-compose/docker-compose.yml +++ b/deployment/samples/docker-compose/docker-compose.yml @@ -112,13 +112,12 @@ services: - "127.0.0.1:5001:5001" volumes: - "pyaleph-ipfs:/data/ipfs" - - "./kubo.json:/etc/kubo.json:ro" + - "./001-update-ipfs-config.sh:/container-init.d/001-update-ipfs-config.sh:ro" environment: - IPFS_PROFILE=server networks: - pyaleph - command: ["daemon", "--enable-pubsub-experiment", "--enable-gc", "--migrate", - "--config-file", "/etc/kubo.json"] + command: ["daemon", "--enable-pubsub-experiment", "--enable-gc", "--migrate"] networks: diff --git a/deployment/samples/docker-compose/kubo.json b/deployment/samples/docker-compose/kubo.json deleted file mode 100644 index 5d9295592..000000000 --- a/deployment/samples/docker-compose/kubo.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "AutoNAT": { - "ServiceMode": "enabled" - }, - "Reprovider": { - "Strategy": "pinned" - }, - "Routing": { - "Type": "dhtserver" - }, - "Bootstrap": [ - "/ip4/51.159.57.71/tcp/4001/p2p/12D3KooWSdcuGvLfXgc6BPgDEqWYQirGpBWUmyXRwK5RmyM1T7Di", - "/ip4/46.255.204.209/tcp/4001/p2p/12D3KooWHWNCn8t9NKQPBPZU61Fq6BoVw9XV37YsWTuMLwZXrEtj", - "/dnsaddr/bootstrap.libp2p.io/p2p/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN", - "/ip4/104.131.131.82/tcp/4001/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ", - "/dnsaddr/bootstrap.libp2p.io/p2p/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN", - "/dnsaddr/bootstrap.libp2p.io/p2p/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa", - "/dnsaddr/bootstrap.libp2p.io/p2p/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb", - "/dnsaddr/bootstrap.libp2p.io/p2p/QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt", - "/dnsaddr/va1.bootstrap.libp2p.io/p2p/12D3KooWKnDdG3iXw9eTFijk3EWSunZcFi54Zka4wmtqtt6rPxc8", - "/ip4/104.131.131.82/tcp/4001/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ", - "/ip4/104.131.131.82/udp/4001/quic-v1/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ" - ], - "Datastore": { - "StorageMax": "1500GB", - "GCPeriod": "12h" - }, - "Swarm": { - "EnableHolePunching":true, - "RelayService": { - "Enabled": false - }, - "AddrFilters": [ - "/ip4/86.84.0.0/ipcidr/16" - ] - } -} diff --git a/deployment/scripts/001-update-ipfs-config.sh b/deployment/scripts/001-update-ipfs-config.sh new file mode 100755 index 000000000..c0ca972a1 --- /dev/null +++ b/deployment/scripts/001-update-ipfs-config.sh @@ -0,0 +1,72 @@ +#!/bin/sh + +# Kubo doc => https://github.com/ipfs/kubo/blob/master/docs/config.md + +CONFIG_FILE="/data/ipfs/config" + +if [ -f $CONFIG_FILE ]; then + cp "$CONFIG_FILE" "$CONFIG_FILE.backup" +fi + +echo "Updating IPFS config file..." + +# Enable the V1+V2 service +ipfs config AutoNAT.ServiceMode 'enabled' + +# Only announce recursively pinned CIDs +ipfs config Reprovider.Strategy 'pinned' + +# ONLY use the Amino DHT (no HTTP routers). +ipfs config Routing.Type "dhtserver" + +# Improve latency and read/write for large dataset +ipfs config Routing.AcceleratedDHTClient --json 'true' + +# Aleph + Public Bootstrap peers +ipfs config Bootstrap --json '[ + "/ip4/51.159.57.71/tcp/4001/p2p/12D3KooWSdcuGvLfXgc6BPgDEqWYQirGpBWUmyXRwK5RmyM1T7Di", + "/ip4/46.255.204.209/tcp/4001/p2p/12D3KooWHWNCn8t9NKQPBPZU61Fq6BoVw9XV37YsWTuMLwZXrEtj", + "/dnsaddr/bootstrap.libp2p.io/p2p/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN", + "/dnsaddr/bootstrap.libp2p.io/p2p/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN", + "/dnsaddr/bootstrap.libp2p.io/p2p/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa", + "/dnsaddr/bootstrap.libp2p.io/p2p/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb", + "/dnsaddr/bootstrap.libp2p.io/p2p/QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt", + "/dnsaddr/va1.bootstrap.libp2p.io/p2p/12D3KooWKnDdG3iXw9eTFijk3EWSunZcFi54Zka4wmtqtt6rPxc8", + "/ip4/104.131.131.82/tcp/4001/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ", + "/ip4/104.131.131.82/udp/4001/quic-v1/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ" +]' + +# soft upper limit to trigger GC +ipfs config Datastore.StorageMax '10GB' + +# time duration specifying how frequently to run a garbage collection +ipfs config Datastore.GCPeriod '12h' + +# Enable hole punching for NAT traversal when port forwarding is not possible +ipfs config Swarm.EnableHolePunching --json 'true' + +# Disable providing /p2p-circuit v2 relay service to other peers on the network. +ipfs config Swarm.RelayService.Enabled --json 'false' + +# Disable advertising networks (**Add your server provider network if you receive a netscan alert**) +ipfs config Swarm.AddrFilters --json '[ + "/ip4/10.0.0.0/ipcidr/8", + "/ip4/100.64.0.0/ipcidr/10", + "/ip4/169.254.0.0/ipcidr/16", + "/ip4/172.16.0.0/ipcidr/12", + "/ip4/192.0.0.0/ipcidr/24", + "/ip4/192.0.2.0/ipcidr/24", + "/ip4/192.168.0.0/ipcidr/16", + "/ip4/198.18.0.0/ipcidr/15", + "/ip4/198.51.100.0/ipcidr/24", + "/ip4/203.0.113.0/ipcidr/24", + "/ip4/240.0.0.0/ipcidr/4", + "/ip6/100::/ipcidr/64", + "/ip6/2001:2::/ipcidr/48", + "/ip6/2001:db8::/ipcidr/32", + "/ip6/fc00::/ipcidr/7", + "/ip6/fe80::/ipcidr/10", + "/ip4/86.84.0.0/ipcidr/16" +]' + +echo "IPFS config updated!" diff --git a/docs/guides/install.rst b/docs/guides/install.rst index 4eb7683cf..1e5e50ae1 100644 --- a/docs/guides/install.rst +++ b/docs/guides/install.rst @@ -116,10 +116,10 @@ To check that the generation of the keys succeeded, check the content of your ke 3. Run the node with Docker Compose =================================== -Download the Kubo config file and Docker Compose file that defines how to run PyAleph and IPFS together. +Download the Kubo config file script and Docker Compose file that defines how to run PyAleph and IPFS together. .. parsed-literal:: - wget "https://raw.githubusercontent.com/aleph-im/pyaleph/|pyaleph_version|/deployment/samples/docker-compose/kubo.json" + wget "https://raw.githubusercontent.com/aleph-im/pyaleph/|pyaleph_version|/deployment/scripts/001-update-ipfs-config.sh" wget "https://raw.githubusercontent.com/aleph-im/pyaleph/|pyaleph_version|/deployment/samples/docker-compose/docker-compose.yml" At this stage, you will need your configuration file and your keys.