Skip to content

Instantly share code, notes, and snippets.

@maxaleks
Last active May 21, 2019 13:32
Show Gist options
  • Save maxaleks/0f7feb136e967093c1a66beb2b76b781 to your computer and use it in GitHub Desktop.
Save maxaleks/0f7feb136e967093c1a66beb2b76b781 to your computer and use it in GitHub Desktop.
Script for deploying an IPFS node on a server
#!/bin/sh
ssh root@$IP_ADDRESS << HERE
wget "https://dist.ipfs.io/go-ipfs/v0.4.20/go-ipfs_v0.4.20_linux-amd64.tar.gz"
tar xvfz go-ipfs_v0.4.20_linux-amd64.tar.gz
cd go-ipfs/
./install.sh
ipfs init -p server
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["*"]'
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["PUT", "GET", "POST"]'
ipfs config Addresses.API /ip4/0.0.0.0/tcp/5001
ipfs config Addresses.Gateway /ip4/0.0.0.0/tcp/8080
sudo bash -c 'cat >/lib/systemd/system/ipfs.service << EOL
[Unit]
Description=IPFS Daemon
[Service]
ExecStart=/usr/local/bin/ipfs daemon
Restart=always
User=root
[Install]
WantedBy=multi-user.target
EOL'
sudo systemctl daemon-reload
sudo systemctl enable ipfs.service
sudo systemctl start ipfs
sudo systemctl status ipfs
HERE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment