Changeset - 0d295af23c4b
[Not reviewed]
default
0 4 1
Drew Perttula - 10 years ago 2015-06-08 00:38:08
drewp@bigasterisk.com
new nginx router
Ignore-this: 6124717ecb304709d4662b58a1e9ed71
5 files changed with 44 insertions and 8 deletions:
0 comments (0 inline, 0 general)
bin/homepage
Show inline comments
 
@@ -4,6 +4,8 @@ CONF=/tmp/light9_nginx.conf
 
ROOT=`dirname $0`/..
 
ROOT=${ROOT:a}
 

	
 
bin/homepageConfig > /tmp/light9_nginx_routes.conf
 

	
 
cat > $CONF <<EOF
 
worker_processes 1;
 

	
 
@@ -19,11 +21,10 @@ http {
 
 include $ROOT/light9/web/mime.types;
 
 
 
 server {
 
  listen 8052;
 
  access_log /tmp/light9_homepage_access.log;
 
  listen 8054;
 
  access_log off;
 

	
 
  location /rdfdb { proxy_pass http://localhost:8051/; }
 
  location /ascoltami { proxy_pass http://localhost:8040/; rewrite /ascoltami(.*) $1 break; }
 
  include "/tmp/light9_nginx_routes.conf";
 

	
 
  location / {
 
    root $ROOT/light9/web;
bin/homepageConfig
Show inline comments
 
new file 100644
 
#!bin/python
 
from run_local import log
 
from rdflib import RDF, URIRef
 
from light9 import networking, showconfig
 
from light9.namespaces import L9
 

	
 
from light9.rdfdb.syncedgraph import SyncedGraph
 
from twisted.internet import reactor
 

	
 
graph = SyncedGraph(networking.rdfdb.url, "homepageConfig")
 

	
 
@graph.initiallySynced.addCallback
 
def printConfig(result):
 
    with graph.currentState() as current:
 
        netHome = current.value(showconfig.showUri(), L9['networking'])
 
        for role, server in current.predicate_objects(netHome):
 
            if not server.startswith('http'):
 
                continue
 
            path = current.value(role, L9['urlPath'])
 
            server = server.rstrip('/')
 
            print "location /%(path)s { proxy_pass %(server)s; rewrite /[^/]+/(.*) /$1 break; }" % vars()
 

	
 
    reactor.stop()
 

	
 
reactor.run()
bin/run_local.py
Show inline comments
 
@@ -41,7 +41,7 @@ def setTerminalTitle(s):
 
    if os.environ.get('TERM', '') in ['xterm', 'rxvt']:
 
        print "\033]0;%s\007" % s # not escaped/protected correctly
 

	
 
if 'listsongs' not in sys.argv[0]:
 
if 'listsongs' not in sys.argv[0] and 'homepageConfig' not in sys.argv[0]:
 
    setTerminalTitle('[%s] %s' % (socket.gethostname(), ' '.join(sys.argv)))
 

	
 
# see http://www.youtube.com/watch?v=3cIOT9kM--g for commands that make
light9/showconfig.py
Show inline comments
 
@@ -15,9 +15,8 @@ def getGraph():
 
        graph = Graph()
 
        # note that logging is probably not configured the first time
 
        # we're in here
 
        print "reading n3 files around %r" % root()
 
        warnings.warn("reading n3 files around %r" % root())
 
        for f in FilePath(root()).globChildren("*.n3") + FilePath(root()).globChildren("build/*.n3"):
 
            print "reading %s" % f
 
            graph.parse(location=f.path, format='n3')
 
        _config = graph
 
    return _config
show/dance2014/networking.n3
Show inline comments
 
@@ -14,4 +14,15 @@ sh:netHome
 
  :keyboardComposer <http://plus:8050/>;
 
  :subComposer <http://plus:8054/>;
 
  :picamserve       <http://10.2.0.3:8001/>;
 
  :vidref           <http://plus:8053/> .
 
  :vidref           <http://dash:8053/> .
 

	
 
:rdfdb            :urlPath "rdfdb" .
 
:effectEval       :urlPath "effectEval" .
 
:musicPlayer      :urlPath "ascoltami" .
 
:dmxServer        :urlPath "dmxServer" .
 
:oscDmxServer     :urlPath "oscDmxServer" .
 
:curveCalc        :urlPath "curveCalc" .
 
:keyboardComposer :urlPath "keyboardComposer" .
 
:subComposer      :urlPath "subComposer" .
 
:picamserve       :urlPath "picamserve" .
 
:vidref           :urlPath "vidref" .
0 comments (0 inline, 0 general)