changeset 458:4c68b604c7ec

change port, put to /values, build updates Ignore-this: 8ebe7c9293d7ae47f6de73677053cafb
author drewp@bigasterisk.com
date Sat, 20 Apr 2019 23:30:31 -0700
parents d96621e2fc08
children a471688fb7b7
files service/store/Dockerfile service/store/index.html service/store/makefile service/store/requirements.txt service/store/store.py
diffstat 5 files changed, 47 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/service/store/Dockerfile	Sat Apr 20 23:29:44 2019 -0700
+++ b/service/store/Dockerfile	Sat Apr 20 23:30:31 2019 -0700
@@ -7,6 +7,6 @@
 
 COPY *.py *.html ./
 
-EXPOSE 11014
+EXPOSE 10015
 
 CMD [ "python", "./store.py" ]
--- a/service/store/index.html	Sat Apr 20 23:29:44 2019 -0700
+++ b/service/store/index.html	Sat Apr 20 23:30:31 2019 -0700
@@ -3,10 +3,41 @@
   <head>
     <title>store</title>
     <meta charset="utf-8" />
+    <script src="/lib/polymer/1.0.9/webcomponentsjs/webcomponents.min.js"></script>
+    <script src="/lib/require/require-2.3.3.js"></script>
+    <script src="/rdf/common_paths_and_ns.js"></script>
+
+    <link rel="import" href="/rdf/streamed-graph.html">
+    <link rel="import" href="/lib/polymer/1.0.9/polymer/polymer.html">
+
+    <meta name="mobile-web-app-capable" content="yes">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
   </head>
   <body>
+    <template id="t" is="dom-bind">
 
-    table of statements, creation times, creators, which UI they used
-    
+      table of statements, creation times, creators, which UI they used
+      <streamed-graph url="graph/events" graph="{{graph}}"></streamed-graph>
+      <div id="out"></div>
+      <script type="module" src="/rdf/streamed_graph_view.js"></script>
+    </template>
+    <style>
+     .served-resources {
+         margin-top: 4em;
+         border-top: 1px solid gray;
+         padding-top: 1em;
+     }
+     .served-resources a {
+         padding-right: 2em;
+     }
+    </style>
+
+      <div class="served-resources">
+        <a href="stats/">/stats/</a>
+        <a href="graph">/graph</a>
+        <a href="graph/events">/graph/events</a>
+        <a href="values">/values (put)</a>
+    </div>
+
   </body>
 </html>
--- a/service/store/makefile	Sat Apr 20 23:29:44 2019 -0700
+++ b/service/store/makefile	Sat Apr 20 23:30:31 2019 -0700
@@ -1,5 +1,5 @@
 JOB=store
-PORT=10014
+PORT=10015
 
 TAG=bang6:5000/${JOB}_x86:latest
 
@@ -19,4 +19,7 @@
 	docker run --rm -it --cap-add SYS_PTRACE --net=host $(TAG) /bin/sh
 
 local_run: build_x86
-	docker run --rm -it --net=host -v `pwd`/index.html:/opt/index.html -v `pwd`:/opt/homeauto_store bang6:5000/store_x86:latest python ./store.py -v
+	docker run --rm -it -v `pwd`/index.html:/opt/index.html -v `pwd`:/opt/homeauto_store bang6:5000/store_x86:latest python ./store.py -v
+
+redeploy: build_image
+	supervisorctl restart $(JOB)_$(PORT)
--- a/service/store/requirements.txt	Sat Apr 20 23:29:44 2019 -0700
+++ b/service/store/requirements.txt	Sat Apr 20 23:30:31 2019 -0700
@@ -1,4 +1,5 @@
 rdflib==4.2.2
 cyclone
-https://projects.bigasterisk.com/rdfdb/rdfdb-0.6.0.tar.gz
+https://projects.bigasterisk.com/rdfdb/rdfdb-0.8.0.tar.gz
 rdflib-jsonld==0.3
+git+http://github.com/drewp/scales.git@448d59fb491b7631877528e7695a93553bfaaa93#egg=scales
--- a/service/store/store.py	Sat Apr 20 23:29:44 2019 -0700
+++ b/service/store/store.py	Sat Apr 20 23:30:31 2019 -0700
@@ -23,17 +23,17 @@
 
 CTX = ROOM['stored']
 
-class OutputPage(cyclone.web.RequestHandler):
+class ValuesResource(cyclone.web.RequestHandler):
     def put(self):
         arg = self.request.arguments
         if arg.get('s') and arg.get('p'):
             self._onQueryStringStatement(arg['s'][-1], arg['p'][-1], self.request.body)
         else:
             self._onGraphBodyStatements(self.request.body, self.request.headers)
-            
+    post = put
     def _onQueryStringStatement(self, s, p, body):
-        subj = URIRef(arg['s'][-1])
-        pred = URIRef(arg['p'][-1])
+        subj = URIRef(s)
+        pred = URIRef(p)
         turtleLiteral = self.request.body
         try:
             obj = Literal(float(turtleLiteral))
@@ -77,14 +77,14 @@
     if dbFile.exists():
         masterGraph._graph.parse(dbFile.open(), format='nquads')
     
-    port = 10014
+    port = 10015
     reactor.listenTCP(port, cyclone.web.Application([
         (r"/()", cyclone.web.StaticFileHandler,
          {"path": ".", "default_filename": "index.html"}),
         (r"/graph", CycloneGraphHandler, {'masterGraph': masterGraph}),
         (r"/graph/events", CycloneGraphEventsHandler,
          {'masterGraph': masterGraph}),
-        (r'/output', OutputPage),
+        (r'/values', ValuesResource),
     ], masterGraph=masterGraph, dbFile=dbFile, debug=arg['-v']),
                       interface='::')
     log.warn('serving on %s', port)