summaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
Diffstat (limited to 'backend')
-rw-r--r--backend/auth/ipfs-public/.gitignore2
-rw-r--r--backend/auth/ipfs-public/blocks/.keepme0
-rw-r--r--backend/auth/ipfs-public/config68
-rw-r--r--backend/auth/ipfs-public/version1
-rw-r--r--backend/resilient/__init__.py29
-rwxr-xr-xbackend/update.py42
6 files changed, 117 insertions, 25 deletions
diff --git a/backend/auth/ipfs-public/.gitignore b/backend/auth/ipfs-public/.gitignore
new file mode 100644
index 0000000..b9eff79
--- /dev/null
+++ b/backend/auth/ipfs-public/.gitignore
@@ -0,0 +1,2 @@
+datastore
+blocks/*
diff --git a/backend/auth/ipfs-public/blocks/.keepme b/backend/auth/ipfs-public/blocks/.keepme
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/backend/auth/ipfs-public/blocks/.keepme
diff --git a/backend/auth/ipfs-public/config b/backend/auth/ipfs-public/config
new file mode 100644
index 0000000..83ac53a
--- /dev/null
+++ b/backend/auth/ipfs-public/config
@@ -0,0 +1,68 @@
+{
+ "Identity": {
+ "PeerID": "QmPw1ZqrdEma823zTrnH9cVFF4j3YSeedrRjqPGj9Q8Utx",
+ "PrivKey": "CAASqAkwggSkAgEAAoIBAQDc6CHJRjbec+fOjsZ6woPSW712lVyhGF6ECd5XkfqkVzXmLZUqx7eVxfsObvNzFgVzh2BkPJ4/PsH2W6KK6pbRoO7Kgu+XQeS05Z/kE2yLAXniR80Se/JsyaKEVPrh0vilHHmmmyDBam4kF4YznJYlHhh59VrrAC1Hypr1s2r1D6mLinpgDDPwyNSLqSEdsGjZq27gAbu5/5o+Yi3gc/4y3/puAJ4u/RGRBbg5uutEfoWjzHMfdwAbBMg1z/2YpnA8hCBfExTR3vqiYhwSdojOfnr3+9udPSV2MEZ9efjlcho51BeXZceMlJt3UA++sf9Kp/TXzGz3vktXeU/U/Fd5AgMBAAECggEAWxcdV3Gsjm4c1//nuBcdZFCP/6X3XDZAQxIOrO10/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5bQ0cioW5GE3js8CTrOpc1OfXTaUygrpXwrpaW0Pc9+FYjAT0z+FypzFUyDO3I3AafQ0F+B91L2diPh1CrXsfmkrFW9yvPknVzdt6lxxz4H"
+ },
+ "Datastore": {
+ "Type": "leveldb",
+ "Path": "auth/ipfs-public/datastore",
+ "StorageMax": "10GB",
+ "StorageGCWatermark": 90,
+ "GCPeriod": "1h",
+ "Params": null,
+ "NoSync": false
+ },
+ "Addresses": {
+ "Swarm": [
+ "/ip4/0.0.0.0/tcp/14001",
+ "/ip6/::/tcp/14001"
+ ],
+ "API": "/ip4/127.0.0.1/tcp/15001",
+ "Gateway": "/ip4/127.0.0.1/tcp/18080"
+ },
+ "Mounts": {
+ "IPFS": "/ipfs",
+ "IPNS": "/ipns",
+ "FuseAllowOther": false
+ },
+ "Discovery": {
+ "MDNS": {
+ "Enabled": true,
+ "Interval": 10
+ }
+ },
+ "Ipns": {
+ "RepublishPeriod": "",
+ "RecordLifetime": "",
+ "ResolveCacheSize": 128
+ },
+ "Bootstrap": [
+ "/ip4/104.131.131.82/tcp/4001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ",
+ "/ip4/104.236.176.52/tcp/4001/ipfs/QmSoLnSGccFuZQJzRadHn95W2CrSFmZuTdDWP8HXaHca9z",
+ "/ip4/104.236.179.241/tcp/4001/ipfs/QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM",
+ "/ip4/162.243.248.213/tcp/4001/ipfs/QmSoLueR4xBeUbY9WZ9xGUUxunbKWcrNFTDAadQJmocnWm",
+ "/ip4/128.199.219.111/tcp/4001/ipfs/QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu",
+ "/ip4/104.236.76.40/tcp/4001/ipfs/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64",
+ "/ip4/178.62.158.247/tcp/4001/ipfs/QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd",
+ "/ip4/178.62.61.185/tcp/4001/ipfs/QmSoLMeWqB7YGVLJN3pNLQpmmEk35v6wYtsMGLzSr5QBU3",
+ "/ip4/104.236.151.122/tcp/4001/ipfs/QmSoLju6m7xTh3DuokvT3886QRYqxAzb1kShaanJgW36yx"
+ ],
+ "Tour": {
+ "Last": ""
+ },
+ "Gateway": {
+ "HTTPHeaders": null,
+ "RootRedirect": "",
+ "Writable": false,
+ "PathPrefixes": []
+ },
+ "SupernodeRouting": {
+ "Servers": null
+ },
+ "API": {
+ "HTTPHeaders": null
+ },
+ "Swarm": {
+ "AddrFilters": null
+ }
+}
diff --git a/backend/auth/ipfs-public/version b/backend/auth/ipfs-public/version
new file mode 100644
index 0000000..00750ed
--- /dev/null
+++ b/backend/auth/ipfs-public/version
@@ -0,0 +1 @@
+3
diff --git a/backend/resilient/__init__.py b/backend/resilient/__init__.py
index 21f2d85..07f3793 100644
--- a/backend/resilient/__init__.py
+++ b/backend/resilient/__init__.py
@@ -3,6 +3,7 @@ import os
import shutil
import subprocess
import tempfile
+import time
import urllib
__all__ = ["freenet"]
@@ -125,15 +126,21 @@ class ipfs:
found = (os.system('ipfs version') == 0)
if not found:
print("WARNING: ipfs not found, ipfs content won't be updated")
- else:
- found = (os.system('ipns-pub --version') == 0)
- if not found:
- print ("WARNING: ipns-pub not found, ipfs content won't be updated")
synced = False
- def __init__(self, keyfile):
- self.keyfile = keyfile
+ def __init__(self, configdir):
+ self.configdir = os.path.join(auth_path, configdir)
+ subprocess.Popen(['ipfs', '-c', self.configdir, 'daemon'])
+ while self._config('Identity.PeerID') == None:
+ time.sleep(0.5)
+ self.peerid = self._config('Identity.PeerID')
+ self.gateway = self._config('Addresses.Gateway').replace('/ip4','http:/').replace('/tcp/',':')
+
+ def _config(self, key):
+ proc = subprocess.Popen(['ipfs', '-c', self.configdir, 'config', key], stdout=subprocess.PIPE)
+ for line in proc.stdout:
+ return line[0:-1]
def push(self):
if not ikiwiki.synced or not ipfs.found:
@@ -141,16 +148,16 @@ class ipfs:
# add files to ipfs
if not ipfs.synced:
- proc = subprocess.Popen(['ipfs', 'add', '-rH', html_path], stdout=subprocess.PIPE)
+ proc = subprocess.Popen(['ipfs', '-c', self.configdir, 'add', '-rH', html_path], stdout=subprocess.PIPE)
for line in proc.stdout:
print line[0:-1]
ipfs.hash = line[6:52]
ipfs.synced = True
# publish hash to private key
- proc = subprocess.Popen(['ipns-pub', '-key=%s' % self.keyfile, ipfs.hash])
+ proc = subprocess.Popen(['ipfs', '-c', self.configdir, 'name', 'publish', ipfs.hash], stdout=subprocess.PIPE)
+ for line in proc.stdout:
+ print line[0:-1]
+ self.peerid = line[13:59]
status = proc.wait()
- if status != 0:
- print 'NOTE: ipns-pub failed to run under python as is common, try running by hand.'
- print 'CMDLINE: ipns-pub -key=%s %s' % (self.keyfile, ipfs.hash)
return status == 0
diff --git a/backend/update.py b/backend/update.py
index 0e9bcce..417ed2e 100755
--- a/backend/update.py
+++ b/backend/update.py
@@ -4,6 +4,26 @@ import resilient
import resilient.freenet
+####################### Instantiate hosts
+
+hosts = []
+
+zeronet_urls = ['http://bit.no.com:43110']
+if resilient.zeronet.found:
+ hosts.append(resilient.zeronet('1GtQ8bkFkhYtKerSdXHKe1z4j9VTmFR5d4',
+ '5JzZACCELsT4bx66qmV9JDaWhEQ6Sx6j7LzeucsxJGA9H7nuoRr'))
+ zeronet_urls.append('http://127.0.0.1:43110')
+
+ipfs_urls = ['https://ipfs.io']
+if resilient.ipfs.found:
+ ipfs_host = resilient.ipfs('ipfs-public')
+ ipfs_urls.append(ipfs_host.gateway)
+ hosts.append(ipfs_host)
+
+if resilient.freenet.freesitemgr.found and resilient.freenet.running:
+ hosts.append(resilient.freenet.freesitemgr()) # keys for freesitemgr are in auth/freesitemgr
+
+
##################### Instantiate remotes
git_repos = [
@@ -11,9 +31,6 @@ git_repos = [
resilient.git('fairlystable-guest:/srv/git/standingwithresilience')
]
-zeronet_urls = ['http://bit.no.com:43110']
-if resilient.zeronet.running:
- zeronet_urls.append('http://127.0.0.1:43110')
for host in zeronet_urls:
git_repos.extend([
#### public zeronet ####
@@ -22,6 +39,14 @@ for host in zeronet_urls:
resilient.git('%s/1L363bqJnCG63SnV83kfV7izZXbmentctD/.git' % host, None)
])
+for host in ipfs_urls:
+ git_repos.extend([
+ #### public ipfs ####
+ resilient.git('%s/ipns/QmPw1ZqrdEma823zTrnH9cVFF4j3YSeedrRjqPGj9Q8Utx/.git' % host, None),
+ #### private ipfs ####
+ resilient.git('%s/ipns/QmYMViYhjtwH2BkuHYRGJvPDWcXdNf2YcRFTTCzzqQGVn1/.git' % host, None)
+ ])
+
if resilient.freenet.gitocalypse.found and resilient.freenet.running:
git_repos.extend([
#### public freenet ####
@@ -59,17 +84,6 @@ if not resilient.ikiwiki().push():
print (":: Exiting due to failure")
exit(-1)
-####################### Instantiate hosts
-
-hosts = []
-
-if resilient.zeronet.found:
- hosts.append(resilient.zeronet('1GtQ8bkFkhYtKerSdXHKe1z4j9VTmFR5d4',
- '5JzZACCELsT4bx66qmV9JDaWhEQ6Sx6j7LzeucsxJGA9H7nuoRr'))
-
-if resilient.freenet.freesitemgr.found and resilient.freenet.running:
- hosts.append(resilient.freenet.freesitemgr()) # keys for freesitemgr are in auth/freesitemgr
-
########################### Upload to all
print (":: Publishing site ...")