Skip to content

Instantly share code, notes, and snippets.

@freddi301
Last active June 18, 2019 15:16
Show Gist options
  • Save freddi301/fa3874f99e88a76758c8725f942f85ba to your computer and use it in GitHub Desktop.
Save freddi301/fa3874f99e88a76758c8725f942f85ba to your computer and use it in GitHub Desktop.
Setup your IPFS node on digital ocean ubuntu
# You must run these command manually
mkdir ipfs
cd ipfs
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
source ~/.profile
nvm install stable
nvm use stable
npm install -g yarn
yarn global add ipfs
jsipfs init
nohup jsipfs daemon > jsipfs.log &
#curl -o- https://dist.ipfs.io/go-ipfs/v0.4.21/go-ipfs_v0.4.21_linux-amd64.tar.gz > go-ipfs.tar.gz
#tar xvfz go-ipfs.tar.gz
#cd go-ipfs
#./install.sh
#ipfs init
openssl genrsa -des3 -passout pass:hello -out server.pass.key 2048
openssl rsa -passin pass:hello -in server.pass.key -out server.key
rm server.pass.key
openssl req -new -key server.key -out server.csr
openssl x509 -req -sha256 -days 365 -in server.csr -signkey server.key -out server.crt
jsipfs id
cat > /etc/nginx/sites-available/default
# WebSocketSecure SSL Endpoint
#
# The proxy is also an SSL endpoint for WSS and HTTPS connections.
# So the clients can use wss:// connections
# (e.g. from pages served via HTTPS) which work better with broken
# proxy servers, etc.
server {
listen 443;
# host name to respond to
# server_name ws.example.com;
# your SSL configuration
ssl on;
ssl_certificate /root/ipfs/server.crt;
ssl_certificate_key /root/ipfs/server.key;
location / {
# switch off logging
access_log off;
# redirect all HTTP traffic to localhost:4003
proxy_pass http://localhost:4003;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# WebSocket support (nginx 1.4)
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
systemctl reload nginx
# alert("you need to accept self signed certificate")
# window.open("https://68.183.47.214", "_blank")
# ipfs.swarm.connect("/ip4/68.183.47.214/tcp/443/wss/ipfs/QmQBPBeuKPA3tPdj79om7pk4NaZJXbFpSpxs4hQkXnCkMb")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment