Search the Community
Showing results for tags 'setup'.
The goal here is to setup 2 or more vps's to run IPFS in cluster mode. The IPFS daemons will stay in sync to distribute the files so its always up. Then use a typical domain name to serve the hash using Cloudflare gateway on Cloudflare's dashboard. From there a typical web browser sees your domain like usual, but behind the scenes can still use the IPFS Browser to directly see the website. create user denarius or whoever you want, but notice in the systemd files User=whoeveryoucreated adduser denarius usermod -aG sudo denarius exit If you are using ssh keys already ssh-copy-id [email protected] login ssh [email protected] install ipfs (Snapcraft), since snap might have to logout and back in after the sudo apt install snapd part. Mainly just wanted to show how to use snap IPFS daemon. https://snapcraft.io/ipfs sudo apt update sudo apt install snapd sudo snap install ipfs ipfs version ipfs init systemd service sudo nano /etc/systemd/system/ipfs.service [Unit] Description=IPFS daemon After=network.target [Service] ### Uncomment the following line for custom ipfs datastore location # Environment=IPFS_PATH=/path/to/your/ipfs/datastore User=denarius ExecStart=/snap/bin/ipfs daemon Restart=always [Install] WantedBy=multi-user.target sudo systemctl restart ipfs sudo systemctl status ipfs sudo systemctl enable ipfs install ipfs cluster ctl https://dist.ipfs.io/#ipfs-cluster-ctl wget https://dist.ipfs.io/ipfs-cluster-ctl/v0.13.0/ipfs-cluster-ctl_v0.13.0_linux-amd64.tar.gz tar -xzvf ipfs-cluster-ctl_v0.13.0_linux-amd64.tar.gz cd ipfs-cluster-ctl sudo cp ipfs-cluster-ctl /usr/local/bin/ install ipfs cluster service https://dist.ipfs.io/#ipfs-cluster-service wget https://dist.ipfs.io/ipfs-cluster-service/v0.13.0/ipfs-cluster-service_v0.13.0_linux-amd64.tar.gz tar -xzvf ipfs-cluster-service_v0.13.0_linux-amd64.tar.gz cd ipfs-cluster-service sudo cp ipfs-cluster-service /usr/local/bin/ initialize ipfs cluster ipfs-cluster-service init the secret to use across all the clusters is in ~/.ipfs-cluster/service.json example a2e2f791d26a04e76cbea370696964614a574a4265593aeaf4 systemd service sudo nano /etc/systemd/system/ipfsc.service [Unit] Description=IPFS Cluster daemon After=network.target [Service] ### Uncomment the following line for custom ipfs datastore location # Environment=IPFS_PATH=/path/to/your/ipfs/datastore User=denarius ExecStart=/usr/local/bin/ipfs-cluster-service daemon Restart=always [Install] WantedBy=multi-user.target Start, Status and Enable service sudo systemctl restart ipfsc sudo systemctl status ipfsc sudo systemctl enable ipfsc in status look for a line like this, this will be your bootstrap for the other nodes in the cluster /ip4/220.127.116.11/tcp/9096/p2p/12D3KooWL6FJgyiY3BUMx8PXpqCK3B6Qcn6X5dPPtGvgAaB7gTxW how bootstrap looks in systemd on the helpers sudo nano /etc/systemd/system/ipfsc.service [Unit] Description=IPFS Cluster daemon After=network.target [Service] ### Uncomment the following line for custom ipfs datastore location # Environment=IPFS_PATH=/path/to/your/ipfs/datastore User=denarius ExecStart=/usr/local/bin/ipfs-cluster-service daemon --bootstrap /ip4/18.104.22.168/tcp/9096/p2p/12D3KooWL6FJgyiY3BUMx8PXpqCK3B6Qcn6X5dPPtGvgAaB7gTxW Restart=always [Install] WantedBy=multi-user.target then to pin we use ipfs-cluster-ctl ipfs-cluster-ctl peers ls Add some random example file. Like nano example.txt, "this is a test" ipfs-cluster-ctl add example.txt ipfs-cluster-ctl pin ls now go to, to add the newly created hash directly to cloudflare to serve through their gateway. I see a 50mb limit on files, so be aware of this if making a website. https://www.cloudflare.com/distributed-web-gateway/ Add the CNAME and TXT Record like below Then back on the cloudflare link above, input your domain name, and Submit. Now you have an instant website serving using the Cloudflare IPFS gateway and a cluster of IPFS daemons keeping the files in sync. The website will also stay fully decentralized using IPFS directly because of that initial cluster we setup above. An example which I am not going to keep up forever. But wanted to show how this looks across different browsers and URLs. Just remember no nginx proxy pass is being used in this guide. ipfs-cluster-ctl add -r ~/website which gave me a hash of QmSrrb571Gm1RLvxHePEMXfuzjTG1nbCNb5PrZutJLde5L spread between the cluster Some Examples then in Brave Nightly as an example I can type ipfs://QmSrrb571Gm1RLvxHePEMXfuzjTG1nbCNb5PrZutJLde5L Which since directly seems slow, and still learning how this works, appears like this. This is how same page looks using Firefox with IPFS Companion, going directly through the hash And how a typical user would see in Chrome going directly to denarius.guide