Crossbar on Heroku: How to set port dynamically?

129 views
Skip to first unread message

Mattia Romeo

unread,
Dec 23, 2014, 5:10:44 PM12/23/14
to autob...@googlegroups.com
I'm trying to install the hello:python template running on Heroku. Heroku assigns port numbers dynamically but Crossbar (as far as I can tell) requires the port number to be defined statically in the config file. Has anyone had any success in running crossbar in Heroku? Heroku aside, is it possible to define things like the host or port dynamically outside of the config files?

Tobias Oberstein

unread,
Dec 30, 2014, 9:58:25 AM12/30/14
to autob...@googlegroups.com
Hi Mattia,

Heroku seems to set the port dynamically when a dyno starts, but sets an environment variable "PORT" to the respective port.

I've added the option to read listening ports from environment variables: https://github.com/crossbario/crossbar/issues/192

Could you try with Crossbar.io trunk (from GitHub) and a config like:

```
"transports": [
   {
      "type": "web",
      "endpoint": {
         "type": "tcp",
         "port": "$PORT",
      },
```

Note the use of "$PORT" instead of say 8080.

I'd be interested in getting Crossbar.io work properly on Heroku .. so if above isn't sufficient yet, I'm willing to help!

Cheers,
/Tobias

Mattia Romeo

unread,
Dec 30, 2014, 10:30:43 AM12/30/14
to autob...@googlegroups.com
Hi Tobias,

I ended up writing a script that overwrites the "port" values in the config file with the value in the PORT environment variable that Heroku sets. I run that script in the procfile before starting crossbar (i.e. web: ./my_config_script && crossbar start). Setting the host to 0.0.0.0 and using that script seems to work and in the bit of testing I've done the app runs fine (my tests have not been extensive though). TO me that implies that the version on Github should work as well.

In order to run the Github version of Crossbar on Heroku wouldn't I have to write a script to install it through git since Heroku wouldn't be able to load it through the requirements.txt file?

Tobias Oberstein

unread,
Dec 30, 2014, 10:42:25 AM12/30/14
to autob...@googlegroups.com
Hi Mattia,

> In order to run the Github version of Crossbar on Heroku wouldn't I have
> to write a script to install it through git since Heroku wouldn't be
> able to load it through the requirements.txt file?

I haven't used Heroku myself. So you can only install stuff from PyPI in
a dyno? Anyway, I've pushed a point release containing the new code:

https://pypi.python.org/pypi/crossbar/0.9.12-2

If you could give this version a shot and test if it works on Heroku,
that would be great!

Anything else that needs to be done to run on Heroku?

If you like you might add your experience/findings/hints here:

https://github.com/crossbario/crossbar/wiki/Setup-on-Heroku

Guess other might be interested as well ..

Cheers,
/Tobias

Mattia Romeo

unread,
Dec 31, 2014, 11:06:23 AM12/31/14
to autob...@googlegroups.com
I'm trying out the new version out the new version you uploaded now. One quick question: 

In the config file there's a url under components (this is based off of the hello:python template) that reads:
 "url": "ws://127.0.0.1:8080/ws"

how would you set the port dynamically there?

Tobias Oberstein

unread,
Dec 31, 2014, 11:08:56 AM12/31/14
to autob...@googlegroups.com
Am 31.12.2014 um 17:06 schrieb Mattia Romeo:
> I'm trying out the new version out the new version you uploaded now. One
> quick question:
>
> In the config file there's a url under components (this is based off of
> the hello:python template) that reads:
> "url": "ws://127.0.0.1:8080/ws"

Simply remove the "url" parameter altogether. That's fine.

/Tobias

Mattia Romeo

unread,
Dec 31, 2014, 11:38:08 AM12/31/14
to autob...@googlegroups.com
Tried running it and the controller throws an exception. Just FYI this is using Python 2.7.9. Here's the log:

  •  stormy-crag-5179 app/web.1: 2014-12-31 16:35:05+0000 [Controller 2] Log opened.
  •  stormy-crag-5179 app/web.1: 2014-12-31 16:35:05+0000 [Controller 2] Traceback (most recent call last):
  •  stormy-crag-5179 app/web.1: 2014-12-31 16:35:05+0000 [Controller 2] File "/app/.heroku/python/bin/crossbar", line 9, in <module>
  •  stormy-crag-5179 app/web.1: 2014-12-31 16:35:05+0000 [Controller 2] load_entry_point('crossbar==0.9.12-2', 'console_scripts', 'crossbar')()
  •  stormy-crag-5179 app/web.1: 2014-12-31 16:35:05+0000 [Controller 2] File "/app/.heroku/python/lib/python2.7/site-packages/crossbar/controller/cli.py", line 447, in run
  •  stormy-crag-5179 app/web.1: 2014-12-31 16:35:05+0000 [Controller 2] options.func(options)
  •  stormy-crag-5179 app/web.1: 2014-12-31 16:35:05+0000 [Controller 2] File "/app/.heroku/python/lib/python2.7/site-packages/crossbar/controller/cli.py", line 225, in run_command_start
  •  stormy-crag-5179 app/web.1: 2014-12-31 16:35:05+0000 [Controller 2] node.start()
  •  stormy-crag-5179 app/web.1: 2014-12-31 16:35:05+0000 [Controller 2] File "/app/.heroku/python/lib/python2.7/site-packages/crossbar/controller/node.py", line 106, in start
  •  stormy-crag-5179 app/web.1: 2014-12-31 16:35:05+0000 [Controller 2] config = checkconfig.check_config_file(configfile, silence = True)
  •  stormy-crag-5179 app/web.1: 2014-12-31 16:35:05+0000 [Controller 2] File "/app/.heroku/python/lib/python2.7/site-packages/crossbar/common/checkconfig.py", line 1750, in check_config_file
  •  stormy-crag-5179 app/web.1: 2014-12-31 16:35:05+0000 [Controller 2] check_config(config, silence)
  •  stormy-crag-5179 app/web.1: 2014-12-31 16:35:05+0000 [Controller 2] File "/app/.heroku/python/lib/python2.7/site-packages/crossbar/common/checkconfig.py", line 1723, in check_config
  •  stormy-crag-5179 app/web.1: 2014-12-31 16:35:05+0000 [Controller 2] check_worker(worker, silence)
  •  stormy-crag-5179 app/web.1: 2014-12-31 16:35:05+0000 [Controller 2] File "/app/.heroku/python/lib/python2.7/site-packages/crossbar/common/checkconfig.py", line 1627, in check_worker
  •  stormy-crag-5179 app/web.1: 2014-12-31 16:35:05+0000 [Controller 2] ============================== Crossbar.io ==============================
  •  stormy-crag-5179 app/web.1: 2014-12-31 16:35:05+0000 [Controller 2] Crossbar.io 0.9.12-2 starting
  •  stormy-crag-5179 app/web.1: 2014-12-31 16:35:05+0000 [Controller 2] Running on CPython using EPollReactor reactor
  •  stormy-crag-5179 app/web.1: 2014-12-31 16:35:05+0000 [Controller 2] Starting from node directory /app/.crossbar
  •  stormy-crag-5179 app/web.1: 2014-12-31 16:35:05+0000 [Controller 2] Starting from local configuration '/app/.crossbar/config.json'
  •  stormy-crag-5179 app/web.1: 2014-12-31 16:35:05+0000 [Controller 2] File "/app/.heroku/python/lib/python2.7/site-packages/crossbar/common/checkconfig.py", line 1396, in check_container
  •  stormy-crag-5179 app/web.1: 2014-12-31 16:35:05+0000 [Controller 2] check_container(worker, silence)
  •  stormy-crag-5179 app/web.1: 2014-12-31 16:35:05+0000 [Controller 2] check_container_component(component, silence)
  •  stormy-crag-5179 app/web.1: 2014-12-31 16:35:05+0000 [Controller 2] File "/app/.heroku/python/lib/python2.7/site-packages/crossbar/common/checkconfig.py", line 1243, in check_container_component
  •  stormy-crag-5179 app/web.1: 2014-12-31 16:35:05+0000 [Controller 2] check_container_transport(component['transport'])
  •  stormy-crag-5179 app/web.1: 2014-12-31 16:35:05+0000 [Controller 2] File "/app/.heroku/python/lib/python2.7/site-packages/crossbar/common/checkconfig.py", line 1189, in check_container_transport
  •  stormy-crag-5179 app/web.1: 2014-12-31 16:35:05+0000 [Controller 2] check_connecting_transport_websocket(transport)
  •  stormy-crag-5179 app/web.1: 2014-12-31 16:35:05+0000 [Controller 2] File "/app/.heroku/python/lib/python2.7/site-packages/crossbar/common/checkconfig.py", line 1028, in check_connecting_transport_websocket
  •  stormy-crag-5179 app/web.1: 2014-12-31 16:35:05+0000 [Controller 2] check_connecting_endpoint(transport['endpoint'])
  •  stormy-crag-5179 app/web.1: 2014-12-31 16:35:05+0000 [Controller 2] File "/app/.heroku/python/lib/python2.7/site-packages/crossbar/common/checkconfig.py", line 468, in check_connecting_endpoint
  •  stormy-crag-5179 app/web.1: 2014-12-31 16:35:05+0000 [Controller 2] check_connecting_endpoint_tcp(endpoint)
  •  stormy-crag-5179 app/web.1: 2014-12-31 16:35:05+0000 [Controller 2] File "/app/.heroku/python/lib/python2.7/site-packages/crossbar/common/checkconfig.py", line 391, in check_connecting_endpoint_tcp
  •  stormy-crag-5179 app/web.1: 2014-12-31 16:35:05+0000 [Controller 2] check_endpoint_port(endpoint['port'])
  •  stormy-crag-5179 app/web.1: 2014-12-31 16:35:05+0000 [Controller 2] File "/app/.heroku/python/lib/python2.7/site-packages/crossbar/common/checkconfig.py", line 217, in check_endpoint_port
  •  stormy-crag-5179 app/web.1: 2014-12-31 16:35:05+0000 [Controller 2] raise Exception("'port' attribute in {} must be integer ({} encountered)".format(message, type(port)))
  •  stormy-crag-5179 app/web.1: 2014-12-31 16:35:05+0000 [Controller 2] Exception: 'port' attribute in listening/connection endpoint must be integer (<type 'unicode'> encountered)
  •  stormy-crag-5179 heroku/web.1: Process exited with status 1

Tobias Oberstein

unread,
Dec 31, 2014, 11:55:10 AM12/31/14
to autob...@googlegroups.com
Can you send your complete node configuration (config.json)?

I guess you are using a container and want to connect back to your
router via TCP.

The auto-replacement of port values only affects listening transport
(right now), not connecting transports.

I adjust your config so it works .. just send it.

Mattia Romeo

unread,
Dec 31, 2014, 12:14:19 PM12/31/14
to autob...@googlegroups.com
Here's the config. It's just the config from the hello:python template with the port values replaced and the url in the component removed.

{
   "controller": {
   },
   "workers": [
      {
         "type": "router",
         "options": {
            "pythonpath": [".."]
         },
         "realms": [
            {
               "name": "realm1",
               "roles": [
                  {
                     "name": "anonymous",
                     "permissions": [
                        {
                           "uri": "*",
                           "publish": true,
                           "subscribe": true,
                           "call": true,
                           "register": true
                        }
                     ]
                  }
               ]
            }
         ],
         "transports": [
            {
               "type": "web",
               "endpoint": {
                  "type": "tcp",
                  "port": "$PORT"
               },
               "paths": {
                  "/": {
                     "type": "static",
                     "directory": "../hello/web"
                  },
                  "ws": {
                     "type": "websocket"
                  }
               }
            }
         ]
      },
      {
         "type": "container",
         "options": {
            "pythonpath": [".."]
         },
         "components": [
            {
               "type": "class",
               "classname": "hello.hello.AppSession",
               "realm": "realm1",
               "transport": {
                  "type": "websocket",
                  "endpoint": {
                     "type": "tcp",
                     "host": "0.0.0.0",
                     "port": "$PORT"
                 }
               }
            }
         ]
      }
   ]

Tobias Oberstein

unread,
Dec 31, 2014, 12:21:13 PM12/31/14
to autob...@googlegroups.com
yeah, that doesn't work. try this:


{
"controller": {
},
"workers": [
{
"type": "router",
"options": {
"pythonpath": [".."]
},
"realms": [
{
"name": "realm1",
"roles": [
{
"name": "anonymous",
"permissions": [
{
"uri": "*",
"publish": true,
"subscribe": true,
"call": true,
"register": true
}
]
}
]
}
],
"transports": [
{
"type": "websocket",
"endpoint": {
"type": "tcp",
"port": 9000
}
},
{
"host": "127.0.0.1",
"port": "9000"
}
}
}
]
}
]
}

Mattia Romeo

unread,
Dec 31, 2014, 1:02:27 PM12/31/14
to autob...@googlegroups.com
Should I change the places where it says "port"=9000 to "port"="$PORT" or is that intentional?

Tobias Oberstein

unread,
Dec 31, 2014, 1:22:46 PM12/31/14
to autob...@googlegroups.com
Am 31.12.2014 um 19:02 schrieb Mattia Romeo:
> Should I change the places where it says "port"=9000 to "port"="$PORT"
> or is that intentional?

No, this is intentional. Leave it like it is for now ..

Long answer:

The replacement of "port" with a value from environment variable only
works (currently) for a _listening_ transport, not a _connecting_
transport (as you have for hooking up the container worker to the router
worker).

Hence, we simply start a 2nd listening transport on the router (fixed
port 9000), and connect to that. This transport is only reachable from
within your dyno. Does not matter. Both transports hook up to the same
router. Clients can connect of any transport.

Alternatively, we could have used a Unix domain socket transport for the
container=>router wiring.

Or, we could have run your component side-by-side directly inside the
router process.

Or, I could add env var replacement for connecting transport ports also;)

Mattia Romeo

unread,
Dec 31, 2014, 1:31:47 PM12/31/14
to autob...@googlegroups.com
Same error as before:

  •  stormy-crag-5179 heroku/web.1: Starting process with command `crossbar start`
  •  stormy-crag-5179 app/web.1: 2014-12-31 18:31:03+0000 [Controller 2] Log opened.
  •  stormy-crag-5179 app/web.1: 2014-12-31 18:31:03+0000 [Controller 2] ============================== Crossbar.io ==============================
  •  stormy-crag-5179 app/web.1: 2014-12-31 18:31:03+0000 [Controller 2] Crossbar.io 0.9.12-2 starting
  •  stormy-crag-5179 app/web.1: 2014-12-31 18:31:03+0000 [Controller 2] Running on CPython using EPollReactor reactor
  •  stormy-crag-5179 app/web.1: 2014-12-31 18:31:03+0000 [Controller 2] Starting from node directory /app/.crossbar
  •  stormy-crag-5179 app/web.1: 2014-12-31 18:31:04+0000 [Controller 2] Traceback (most recent call last):
  •  stormy-crag-5179 app/web.1: 2014-12-31 18:31:04+0000 [Controller 2] File "/app/.heroku/python/bin/crossbar", line 9, in <module>
  •  stormy-crag-5179 app/web.1: 2014-12-31 18:31:04+0000 [Controller 2] load_entry_point('crossbar==0.9.12-2', 'console_scripts', 'crossbar')()
  •  stormy-crag-5179 app/web.1: 2014-12-31 18:31:04+0000 [Controller 2] File "/app/.heroku/python/lib/python2.7/site-packages/crossbar/controller/cli.py", line 447, in run
  •  stormy-crag-5179 app/web.1: 2014-12-31 18:31:04+0000 [Controller 2] options.func(options)
  •  stormy-crag-5179 app/web.1: 2014-12-31 18:31:04+0000 [Controller 2] File "/app/.heroku/python/lib/python2.7/site-packages/crossbar/controller/cli.py", line 225, in run_command_start
  •  stormy-crag-5179 app/web.1: 2014-12-31 18:31:04+0000 [Controller 2] node.start()
  •  stormy-crag-5179 app/web.1: 2014-12-31 18:31:04+0000 [Controller 2] File "/app/.heroku/python/lib/python2.7/site-packages/crossbar/controller/node.py", line 106, in start
  •  stormy-crag-5179 app/web.1: 2014-12-31 18:31:04+0000 [Controller 2] config = checkconfig.check_config_file(configfile, silence = True)
  •  stormy-crag-5179 app/web.1: 2014-12-31 18:31:04+0000 [Controller 2] File "/app/.heroku/python/lib/python2.7/site-packages/crossbar/common/checkconfig.py", line 1750, in check_config_file
  •  stormy-crag-5179 app/web.1: 2014-12-31 18:31:04+0000 [Controller 2] check_config(config, silence)
  •  stormy-crag-5179 app/web.1: 2014-12-31 18:31:04+0000 [Controller 2] File "/app/.heroku/python/lib/python2.7/site-packages/crossbar/common/checkconfig.py", line 1723, in check_config
  •  stormy-crag-5179 app/web.1: 2014-12-31 18:31:04+0000 [Controller 2] check_worker(worker, silence)
  •  stormy-crag-5179 app/web.1: 2014-12-31 18:31:04+0000 [Controller 2] File "/app/.heroku/python/lib/python2.7/site-packages/crossbar/common/checkconfig.py", line 1627, in check_worker
  •  stormy-crag-5179 app/web.1: 2014-12-31 18:31:04+0000 [Controller 2] check_container(worker, silence)
  •  stormy-crag-5179 app/web.1: 2014-12-31 18:31:04+0000 [Controller 2] File "/app/.heroku/python/lib/python2.7/site-packages/crossbar/common/checkconfig.py", line 1396, in check_container
  •  stormy-crag-5179 app/web.1: 2014-12-31 18:31:04+0000 [Controller 2] check_container_component(component, silence)
  •  stormy-crag-5179 app/web.1: 2014-12-31 18:31:04+0000 [Controller 2] File "/app/.heroku/python/lib/python2.7/site-packages/crossbar/common/checkconfig.py", line 1243, in check_container_component
  •  stormy-crag-5179 app/web.1: 2014-12-31 18:31:04+0000 [Controller 2] check_container_transport(component['transport'])
  •  stormy-crag-5179 app/web.1: 2014-12-31 18:31:04+0000 [Controller 2] Starting from local configuration '/app/.crossbar/config.json'
  •  stormy-crag-5179 app/web.1: 2014-12-31 18:31:04+0000 [Controller 2] File "/app/.heroku/python/lib/python2.7/site-packages/crossbar/common/checkconfig.py", line 1189, in check_container_transport
  •  stormy-crag-5179 app/web.1: 2014-12-31 18:31:04+0000 [Controller 2] check_connecting_transport_websocket(transport)
  •  stormy-crag-5179 app/web.1: 2014-12-31 18:31:04+0000 [Controller 2] File "/app/.heroku/python/lib/python2.7/site-packages/crossbar/common/checkconfig.py", line 1028, in check_connecting_transport_websocket
  •  stormy-crag-5179 app/web.1: 2014-12-31 18:31:04+0000 [Controller 2] check_connecting_endpoint(transport['endpoint'])
  •  stormy-crag-5179 app/web.1: 2014-12-31 18:31:04+0000 [Controller 2] File "/app/.heroku/python/lib/python2.7/site-packages/crossbar/common/checkconfig.py", line 468, in check_connecting_endpoint
  •  stormy-crag-5179 app/web.1: 2014-12-31 18:31:04+0000 [Controller 2] check_connecting_endpoint_tcp(endpoint)
  •  stormy-crag-5179 app/web.1: 2014-12-31 18:31:04+0000 [Controller 2] File "/app/.heroku/python/lib/python2.7/site-packages/crossbar/common/checkconfig.py", line 391, in check_connecting_endpoint_tcp
  •  stormy-crag-5179 app/web.1: 2014-12-31 18:31:04+0000 [Controller 2] check_endpoint_port(endpoint['port'])
  •  stormy-crag-5179 app/web.1: 2014-12-31 18:31:04+0000 [Controller 2] File "/app/.heroku/python/lib/python2.7/site-packages/crossbar/common/checkconfig.py", line 217, in check_endpoint_port
  •  stormy-crag-5179 app/web.1: 2014-12-31 18:31:04+0000 [Controller 2] raise Exception("'port' attribute in {} must be integer ({} encountered)".format(message, type(port)))
  •  stormy-crag-5179 app/web.1: 2014-12-31 18:31:04+0000 [Controller 2] Exception: 'port' attribute in listening/connection endpoint must be integer (<type 'unicode'> encountered)
  •  stormy-crag-5179 heroku/web.1: State changed from starting to crashed
  •  stormy-crag-5179 heroku/web.1: Process exited with status 1

Tobias Oberstein

unread,
Dec 31, 2014, 1:37:37 PM12/31/14
to autob...@googlegroups.com
Am 31.12.2014 um 19:31 schrieb Mattia Romeo:
> Same error as before:

The error again comes from connecting transport. Probably you mixed it
up. Are you sure you have used the config I supplied _unmodified_?
Anyway. Please come over to IRC (#autobahn @ freenode) if I should
assist .. this email ping pong gets old.

/Tobias

Mattia Romeo

unread,
Dec 31, 2014, 1:53:51 PM12/31/14
to Tobias Oberstein, autob...@googlegroups.com
I just copied and pasted the file you sent, committed it, and redeployed so unless something strange is happening on the server end (e.g. some caching?) it should be running with the config you sent. I just double checked the file and it looked right. Just to be sure I cut, pasted, committed and deployed again and got the same error. 

Unfortunately, I don’t use IRC (nothing against it I just never got around to using it). All I can offer are emails, IM or maybe smoke signals or carrier pigeons?
--
You received this message because you are subscribed to a topic in the Google Groups "Autobahn" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/autobahnws/FjaDEw8-qbI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to autobahnws+...@googlegroups.com.
To post to this group, send email to autob...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/autobahnws/54A4426D.2070503%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Tobias Oberstein

unread,
Dec 31, 2014, 1:58:40 PM12/31/14
to autob...@googlegroups.com
Am 31.12.2014 um 19:53 schrieb Mattia Romeo:
> I just copied and pasted the file you sent, committed it, and redeployed
> so unless something strange is happening on the server end (e.g. some
> caching?) it should be running with the config you sent. I just double
> checked the file and it looked right. Just to be sure I cut, pasted,
> committed and deployed again and got the same error.
>
> Unfortunately, I don’t use IRC (nothing against it I just never got
> around to using it). All I can offer are emails, IM or maybe smoke
> signals or carrier pigeons?

here is my skype nick: toberstein

anyway, I'm just stupid - can you spot the error?


"components": [
{
"type": "class",
"classname": "hello.hello.AppSession",
"realm": "realm1",
"transport": {
"type": "websocket",
"endpoint": {
"type": "tcp",
"host": "127.0.0.1",
"port": "9000"
}
}
}
]

==

wrong:

"port": "9000"

correct:

"port": 9000
==

checkconfig is right. my fault. sorry;)


>
> On December 31, 2014 at 1:37:39 PM, Tobias Oberstein
> (tobias.o...@gmail.com <mailto:tobias.o...@gmail.com>) wrote:
>
>> Am 31.12.2014 um 19:31 schrieb Mattia Romeo:
>> > Same error as before:
>>
>> The error again comes from connecting transport. Probably you mixed it
>> up. Are you sure you have used the config I supplied _unmodified_?
>> Anyway. Please come over to IRC (#autobahn @ freenode) if I should
>> assist .. this email ping pong gets old.
>>
>> /Tobias
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Autobahn" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/autobahnws/FjaDEw8-qbI/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> autobahnws+...@googlegroups.com.
>> To post to this group, send email to autob...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/autobahnws/54A4426D.2070503%40gmail.com.
>>
>> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Autobahn" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to autobahnws+...@googlegroups.com
> <mailto:autobahnws+...@googlegroups.com>.
> To post to this group, send email to autob...@googlegroups.com
> <mailto:autob...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/autobahnws/etPan.54a4463c.19495cff.219%40cpe-74-72-119-90.nyc.res.rr.com
> <https://groups.google.com/d/msgid/autobahnws/etPan.54a4463c.19495cff.219%40cpe-74-72-119-90.nyc.res.rr.com?utm_medium=email&utm_source=footer>.

Mattia Romeo

unread,
Dec 31, 2014, 2:10:14 PM12/31/14
to Tobias Oberstein, autob...@googlegroups.com
Happens to the best of us ;) Tried running it with the updated config and now crossbar is complaining that the mandatory url field is missing:

  •  stormy-crag-5179 heroku/web.1: Starting process with command `crossbar start`
  •  stormy-crag-5179 app/web.1: 2014-12-31 19:04:21+0000 [Controller 2] Log opened.
  •  stormy-crag-5179 app/web.1: 2014-12-31 19:04:21+0000 [Controller 2] ============================== Crossbar.io ==============================
  •  stormy-crag-5179 app/web.1: 2014-12-31 19:04:21+0000 [Controller 2] Crossbar.io 0.9.12-2 starting
  •  stormy-crag-5179 app/web.1: 2014-12-31 19:04:21+0000 [Controller 2] Running on CPython using EPollReactor reactor
  •  stormy-crag-5179 app/web.1: 2014-12-31 19:04:21+0000 [Controller 2] Starting from node directory /app/.crossbar
  •  stormy-crag-5179 app/web.1: 2014-12-31 19:04:22+0000 [Controller 2] Starting from local configuration '/app/.crossbar/config.json'
  •  stormy-crag-5179 app/web.1: 2014-12-31 19:04:22+0000 [Controller 2] Traceback (most recent call last):
  •  stormy-crag-5179 app/web.1: 2014-12-31 19:04:22+0000 [Controller 2] File "/app/.heroku/python/bin/crossbar", line 9, in <module>
  •  stormy-crag-5179 app/web.1: 2014-12-31 19:04:22+0000 [Controller 2] load_entry_point('crossbar==0.9.12-2', 'console_scripts', 'crossbar')()
  •  stormy-crag-5179 app/web.1: 2014-12-31 19:04:22+0000 [Controller 2] File "/app/.heroku/python/lib/python2.7/site-packages/crossbar/controller/cli.py", line 447, in run
  •  stormy-crag-5179 app/web.1: 2014-12-31 19:04:22+0000 [Controller 2] options.func(options)
  •  stormy-crag-5179 app/web.1: 2014-12-31 19:04:22+0000 [Controller 2] File "/app/.heroku/python/lib/python2.7/site-packages/crossbar/controller/cli.py", line 225, in run_command_start
  •  stormy-crag-5179 app/web.1: 2014-12-31 19:04:22+0000 [Controller 2] node.start()
  •  stormy-crag-5179 app/web.1: 2014-12-31 19:04:22+0000 [Controller 2] File "/app/.heroku/python/lib/python2.7/site-packages/crossbar/controller/node.py", line 106, in start
  •  stormy-crag-5179 app/web.1: 2014-12-31 19:04:22+0000 [Controller 2] config = checkconfig.check_config_file(configfile, silence = True)
  •  stormy-crag-5179 app/web.1: 2014-12-31 19:04:22+0000 [Controller 2] File "/app/.heroku/python/lib/python2.7/site-packages/crossbar/common/checkconfig.py", line 1750, in check_config_file
  •  stormy-crag-5179 app/web.1: 2014-12-31 19:04:22+0000 [Controller 2] check_config(config, silence)
  •  stormy-crag-5179 app/web.1: 2014-12-31 19:04:22+0000 [Controller 2] File "/app/.heroku/python/lib/python2.7/site-packages/crossbar/common/checkconfig.py", line 1723, in check_config
  •  stormy-crag-5179 app/web.1: 2014-12-31 19:04:22+0000 [Controller 2] check_worker(worker, silence)
  •  stormy-crag-5179 app/web.1: 2014-12-31 19:04:22+0000 [Controller 2] File "/app/.heroku/python/lib/python2.7/site-packages/crossbar/common/checkconfig.py", line 1627, in check_worker
  •  stormy-crag-5179 app/web.1: 2014-12-31 19:04:22+0000 [Controller 2] check_container(worker, silence)
  •  stormy-crag-5179 app/web.1: 2014-12-31 19:04:22+0000 [Controller 2] File "/app/.heroku/python/lib/python2.7/site-packages/crossbar/common/checkconfig.py", line 1396, in check_container
  •  stormy-crag-5179 app/web.1: 2014-12-31 19:04:22+0000 [Controller 2] check_container_component(component, silence)
  •  stormy-crag-5179 app/web.1: 2014-12-31 19:04:22+0000 [Controller 2] File "/app/.heroku/python/lib/python2.7/site-packages/crossbar/common/checkconfig.py", line 1243, in check_container_component
  •  stormy-crag-5179 app/web.1: 2014-12-31 19:04:22+0000 [Controller 2] check_container_transport(component['transport'])
  •  stormy-crag-5179 app/web.1: 2014-12-31 19:04:22+0000 [Controller 2] File "/app/.heroku/python/lib/python2.7/site-packages/crossbar/common/checkconfig.py", line 1189, in check_container_transport
  •  stormy-crag-5179 app/web.1: 2014-12-31 19:04:22+0000 [Controller 2] check_connecting_transport_websocket(transport)
  •  stormy-crag-5179 app/web.1: 2014-12-31 19:04:22+0000 [Controller 2] File "/app/.heroku/python/lib/python2.7/site-packages/crossbar/common/checkconfig.py", line 1044, in check_connecting_transport_websocket
  •  stormy-crag-5179 app/web.1: 2014-12-31 19:04:22+0000 [Controller 2] raise Exception("missing mandatory attribute 'url' in WebSocket transport item\n\n{}".format(pformat(transport)))
  •  stormy-crag-5179 app/web.1: 2014-12-31 19:04:22+0000 [Controller 2] Exception: missing mandatory attribute 'url' in WebSocket transport item
  •  stormy-crag-5179 app/web.1: 2014-12-31 19:04:22+0000 [Controller 2]
  •  stormy-crag-5179 app/web.1: 2014-12-31 19:04:22+0000 [Controller 2] {u'endpoint': {u'host': u'127.0.0.1', u'port': 9000, u'type': u'tcp'},
  •  stormy-crag-5179 app/web.1: 2014-12-31 19:04:22+0000 [Controller 2] u'type': u'websocket'}
  •  stormy-crag-5179 heroku/web.1: Process exited with status 1
  •  stormy-crag-5179 heroku/web.1: State changed from starting to crashed

I’d be happy to jump on Skype at some point possibly on Friday but today I’ve got to try to bang out a few things before the holiday. 

Tobias Oberstein

unread,
Dec 31, 2014, 2:16:18 PM12/31/14
to Mattia Romeo, autob...@googlegroups.com
Am 31.12.2014 um 20:10 schrieb Mattia Romeo:
> Happens to the best of us ;) Tried running it with the updated config
> and now crossbar is complaining that the mandatory url field is missing:

Ok. Fuck. One last try:

"components": [
{
"type": "class",
"classname": "hello.hello.AppSession",
"realm": "realm1",
"transport": {
"type": "websocket",
"url": "ws://127.0.0.1:9000",

Mattia Romeo

unread,
Dec 31, 2014, 2:42:21 PM12/31/14
to autob...@googlegroups.com, Tobias Oberstein
Success! That last one seemed to work. The client web page can’t connect (websocket can’t reach the host) but the server updates and the counter ticks off.

Tobias Oberstein

unread,
Dec 31, 2014, 2:59:34 PM12/31/14
to autob...@googlegroups.com
Am 31.12.2014 um 20:42 schrieb Mattia Romeo:
> Success! That last one seemed to work. The client web page can’t connect
> (websocket can’t reach the host) but the server updates and the counter
> ticks off.

Alright.

"websocket can't reach host": ?

Not sure what that means.

FWIW, Crossbar.io renders a status page when accessing the WebSocket
listening endpoint, e.g.

https://demo.crossbar.io/ws

Is your Heroku app public?

Well, I guess I won't be of much help at this point -- I just don't know
much about Heroku.

Skimming over

https://devcenter.heroku.com/articles/websockets
https://devcenter.heroku.com/articles/http-routing

doesn't reveal much to me.

If you figure it out, would be nice if you leave a reply here ...

Good luck!

Cheers,
/Tobias

Mattia Romeo

unread,
Dec 31, 2014, 3:07:08 PM12/31/14
to Tobias Oberstein, autob...@googlegroups.com
My bad, sorry about that. The problem was on my side. I was pointing to the local version of the web page. The app works properly when I check against the server version. You can check it out at:

--
You received this message because you are subscribed to a topic in the Google Groups "Autobahn" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/autobahnws/FjaDEw8-qbI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to autobahnws+...@googlegroups.com.
To post to this group, send email to autob...@googlegroups.com.

Tobias Oberstein

unread,
Dec 31, 2014, 3:23:17 PM12/31/14
to autob...@googlegroups.com
Am 31.12.2014 um 21:07 schrieb Mattia Romeo:
> My bad, sorry about that. The problem was on my side. I was pointing to
> the local version of the web page. The app works properly when I check
> against the server version. You can check it out at:
>
> http://stormy-crag-5179.herokuapp.com

Awesome!

You can see that Crossbar.io runs behind Heroku's
load-balancer/proxy/whatever ("vegur" .. and the local IP/port
Crossbar.io is listening on "10....:17777") => see attached shots

So that means, apart from the modified Crossbar.io configuration,
nothing else, special had to be done to get it up on Heroku?

Alright, now that we have sunk time into this, would you mind if I'd put
the screenshots onto

https://github.com/crossbario/crossbar/wiki/Setup-on-Heroku

?

Could you attach the complete working config again, so I can put it onto
the Wiki page? Just to be sure I don't make any silly mistakes again;)

Cheers
/Tobias
Clipboard03.png
Clipboard01.png
Clipboard02.png

Mattia Romeo

unread,
Dec 31, 2014, 9:12:53 PM12/31/14
to Tobias Oberstein, autob...@googlegroups.com
So that means, apart from the modified Crossbar.io configuration, 
nothing else, special had to be done to get it up on Heroku? 

Nope. Nothing outside of what you usually would do to create a Heroku project (e.g. creating a procfile, deploying through git, etc.)

Alright, now that we have sunk time into this, would you mind if I'd put 
the screenshots onto 

Absolutely. Feel free to use any screenshots you want and let me know if there’s anything else I can do to help. 

Could you attach the complete working config again, so I can put it onto 
the Wiki page? Just to be sure I don't make any silly mistakes again;) 

Sure. Here’s the config file from the project:

    "controller": { 
    }, 
    "workers": [ 
       { 
          "type": "router", 
          "options": { 
             "pythonpath": [".."] 
          }, 
          "realms": [ 
             { 
                "name": "realm1", 
                "roles": [ 
                   { 
                      "name": "anonymous", 
                      "permissions": [ 
                         { 
                            "uri": "*", 
                            "publish": true, 
                            "subscribe": true, 
                            "call": true, 
                            "register": true 
                         } 
                      ] 
                   } 
                ] 
             } 
          ], 
          "transports": [ 
             { 
                "type": "websocket", 
                "endpoint": { 
                   "type": "tcp", 
                   "port": 9000 
                } 
             }, 
             { 
                "type": "web", 
                "endpoint": { 
                   "type": "tcp", 
                   "port": "$PORT" 
                }, 
                "paths": { 
                   "/": { 
                      "type": "static", 
                      "directory": "../hello/web" 
                   }, 
                   "ws": { 
                      "type": "websocket" 
                   } 
                } 
             } 
          ] 
       }, 
       { 
          "type": "container", 
          "options": { 
             "pythonpath": [".."] 
          }, 
           "components": [ 
             { 
                "type": "class", 
                "classname": "hello.hello.AppSession", 
                "realm": "realm1", 
                "transport": { 
                   "type": "websocket", 
                   "url": "ws://127.0.0.1:9000", 
                   "endpoint": { 
                      "type": "tcp", 
                      "host": "127.0.0.1", 
                      "port": 9000 
                  } 
                } 
             } 
          ] 
       } 
    ] 

Thanks and Happy New Year!

--
You received this message because you are subscribed to a topic in the Google Groups "Autobahn" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/autobahnws/FjaDEw8-qbI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to autobahnws+...@googlegroups.com.
To post to this group, send email to autob...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tobias Oberstein

unread,
Jan 1, 2015, 5:51:49 AM1/1/15
to autob...@googlegroups.com
Hi Mattia,

first off, happy new year!

Am 01.01.2015 um 03:12 schrieb Mattia Romeo:
>> So that means, apart from the modified Crossbar.io configuration,
>> nothing else, special had to be done to get it up on Heroku?
>
> Nope. Nothing outside of what you usually would do to create a Heroku
> project (e.g. creating a procfile, deploying through git, etc.)
>

Great. I've started a Wiki page

https://github.com/crossbario/crossbar/wiki/Setup-on-Heroku

to collect the info.

Maybe you could add the steps that you "usually would do" to

https://github.com/crossbario/crossbar/wiki/Setup-on-Heroku#setup-your-application

?

As for me for example, not knowing anything about Heroku, I would have a
problem.

I signup to Heroku .. and now?

How do I get the demo app created from

crossbar init --template hello:python

into this Heroku thing? What are the exact steps? I mean: think of a
total dummy like me;) I need 1, 2, 3 steps.

Would be great if you can add a little text to that Wiki page .. you can
edit just in your browser .. ok, you need a GitHub account.

Cheers,
/Tobias




Mattia Romeo

unread,
Jan 4, 2015, 12:32:56 PM1/4/15
to autob...@googlegroups.com
Hey Tobias,

Happy New Year to you too! I added a section to the github page you pointed to. Let me know if it doesn't fit the bill. 

Tobias Oberstein

unread,
Jan 4, 2015, 1:00:56 PM1/4/15
to autob...@googlegroups.com
Hi Mattia,

Am 04.01.2015 um 18:32 schrieb Mattia Romeo:
> Hey Tobias,
>
> Happy New Year to you too! I added a section to the github page you

Awesome!! Thanks!

This is the kind of recipe that absolute beginners can digest;) Step by
step.

> pointed to. Let me know if it doesn't fit the bill.

No, it's just fine (I've only tuned up the page visually a little).

Thanks again,
/Tobias
> --
> You received this message because you are subscribed to the Google
> Groups "Autobahn" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to autobahnws+...@googlegroups.com
> <mailto:autobahnws+...@googlegroups.com>.
> To post to this group, send email to autob...@googlegroups.com
> <mailto:autob...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/autobahnws/4c5171e7-42bb-4611-98cc-207dd1cc433f%40googlegroups.com
> <https://groups.google.com/d/msgid/autobahnws/4c5171e7-42bb-4611-98cc-207dd1cc433f%40googlegroups.com?utm_medium=email&utm_source=footer>.
Reply all
Reply to author
Forward
0 new messages