Crossbar on Heroku: How to set port dynamically?

#1

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?

0 Likes

#2

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

···

Am Dienstag, 23. Dezember 2014 23:10:44 UTC+1 schrieb Mattia Romeo:

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?

0 Likes

#3

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?

···

On Tuesday, December 23, 2014 5:10:44 PM UTC-5, Mattia Romeo wrote:

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?

0 Likes

#4

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

0 Likes

#5

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?

···

On Tuesday, December 30, 2014 10:42:25 AM UTC-5, Tobias Oberstein wrote:

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

0 Likes

#6

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

/Tobias

···

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"

0 Likes

#7

Tried running it and the controller throws an exception. Just FYI this is using Python 2.7.9. Here’s the log:

  • Dec 31 08:35:06 stormy-crag-5179 app/web.1: 2014-12-31 16:35:05+0000 [Controller 2] Log opened.
  • Dec 31 08:35:06 stormy-crag-5179 app/web.1: 2014-12-31 16:35:05+0000 [Controller 2] Traceback (most recent call last):
  • Dec 31 08:35:06 stormy-crag-5179 app/web.1: 2014-12-31 16:35:05+0000 [Controller 2] File “/app/.heroku/python/bin/crossbar”, line 9, in
  • Dec 31 08:35:06 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’)()
  • Dec 31 08:35:06 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
  • Dec 31 08:35:06 stormy-crag-5179 app/web.1: 2014-12-31 16:35:05+0000 [Controller 2] options.func(options)
  • Dec 31 08:35:06 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
  • Dec 31 08:35:06 stormy-crag-5179 app/web.1: 2014-12-31 16:35:05+0000 [Controller 2] node.start()
  • Dec 31 08:35:06 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
  • Dec 31 08:35:06 stormy-crag-5179 app/web.1: 2014-12-31 16:35:05+0000 [Controller 2] config = checkconfig.check_config_file(configfile, silence = True)
  • Dec 31 08:35:06 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
  • Dec 31 08:35:06 stormy-crag-5179 app/web.1: 2014-12-31 16:35:05+0000 [Controller 2] check_config(config, silence)
  • Dec 31 08:35:06 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
  • Dec 31 08:35:06 stormy-crag-5179 app/web.1: 2014-12-31 16:35:05+0000 [Controller 2] check_worker(worker, silence)
  • Dec 31 08:35:06 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
  • Dec 31 08:35:06 stormy-crag-5179 app/web.1: 2014-12-31 16:35:05+0000 [Controller 2] ============================== Crossbar.io ==============================
  • Dec 31 08:35:06 stormy-crag-5179 app/web.1: 2014-12-31 16:35:05+0000 [Controller 2] Crossbar.io 0.9.12-2 starting
  • Dec 31 08:35:06 stormy-crag-5179 app/web.1: 2014-12-31 16:35:05+0000 [Controller 2] Running on CPython using EPollReactor reactor
  • Dec 31 08:35:06 stormy-crag-5179 app/web.1: 2014-12-31 16:35:05+0000 [Controller 2] Starting from node directory /app/.crossbar
  • Dec 31 08:35:06 stormy-crag-5179 app/web.1: 2014-12-31 16:35:05+0000 [Controller 2] Starting from local configuration ‘/app/.crossbar/config.json’
  • Dec 31 08:35:06 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
  • Dec 31 08:35:06 stormy-crag-5179 app/web.1: 2014-12-31 16:35:05+0000 [Controller 2] check_container(worker, silence)
  • Dec 31 08:35:06 stormy-crag-5179 app/web.1: 2014-12-31 16:35:05+0000 [Controller 2] check_container_component(component, silence)
  • Dec 31 08:35:06 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
  • Dec 31 08:35:06 stormy-crag-5179 app/web.1: 2014-12-31 16:35:05+0000 [Controller 2] check_container_transport(component[‘transport’])
  • Dec 31 08:35:06 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
  • Dec 31 08:35:06 stormy-crag-5179 app/web.1: 2014-12-31 16:35:05+0000 [Controller 2] check_connecting_transport_websocket(transport)
  • Dec 31 08:35:06 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
  • Dec 31 08:35:06 stormy-crag-5179 app/web.1: 2014-12-31 16:35:05+0000 [Controller 2] check_connecting_endpoint(transport[‘endpoint’])
  • Dec 31 08:35:06 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
  • Dec 31 08:35:06 stormy-crag-5179 app/web.1: 2014-12-31 16:35:05+0000 [Controller 2] check_connecting_endpoint_tcp(endpoint)
  • Dec 31 08:35:06 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
  • Dec 31 08:35:06 stormy-crag-5179 app/web.1: 2014-12-31 16:35:05+0000 [Controller 2] check_endpoint_port(endpoint[‘port’])
  • Dec 31 08:35:06 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
  • Dec 31 08:35:06 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)))
  • Dec 31 08:35:06 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)
  • Dec 31 08:35:06 stormy-crag-5179 heroku/web.1: Process exited with status 1
···

On Wednesday, December 31, 2014 11:08:56 AM UTC-5, Tobias Oberstein wrote:

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

0 Likes

#8

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.

0 Likes

#9

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”

}

}

}

]

}

]

}

···

On Wednesday, December 31, 2014 11:55:10 AM UTC-5, Tobias Oberstein wrote:

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.

0 Likes

#10

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
                }
             },
             {
                "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": "127.0.0.1",
                      "port": "9000"
                  }
                }
             }
          ]
       }
    ]
}

0 Likes

#11

Should I change the places where it says “port”=9000 to “port”="$PORT" or is that intentional?

···

On Wednesday, December 31, 2014 12:21:13 PM UTC-5, Tobias Oberstein wrote:

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

            }

         },

         {

            "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": "127.0.0.1",

                  "port": "9000"

              }

            }

         }

      ]

   }

]

}

0 Likes

#12

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;)

···

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?

0 Likes

#13

Same error as before:

···
  • Dec 31 10:31:03 stormy-crag-5179 heroku/web.1: Starting process with command crossbar start
  • Dec 31 10:31:04 stormy-crag-5179 app/web.1: 2014-12-31 18:31:03+0000 [Controller 2] Log opened.
  • Dec 31 10:31:04 stormy-crag-5179 app/web.1: 2014-12-31 18:31:03+0000 [Controller 2] ============================== Crossbar.io ==============================
  • Dec 31 10:31:04 stormy-crag-5179 app/web.1: 2014-12-31 18:31:03+0000 [Controller 2] Crossbar.io 0.9.12-2 starting
  • Dec 31 10:31:04 stormy-crag-5179 app/web.1: 2014-12-31 18:31:03+0000 [Controller 2] Running on CPython using EPollReactor reactor
  • Dec 31 10:31:04 stormy-crag-5179 app/web.1: 2014-12-31 18:31:03+0000 [Controller 2] Starting from node directory /app/.crossbar
  • Dec 31 10:31:04 stormy-crag-5179 app/web.1: 2014-12-31 18:31:04+0000 [Controller 2] Traceback (most recent call last):
  • Dec 31 10:31:04 stormy-crag-5179 app/web.1: 2014-12-31 18:31:04+0000 [Controller 2] File “/app/.heroku/python/bin/crossbar”, line 9, in
  • Dec 31 10:31:04 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’)()
  • Dec 31 10:31:04 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
  • Dec 31 10:31:04 stormy-crag-5179 app/web.1: 2014-12-31 18:31:04+0000 [Controller 2] options.func(options)
  • Dec 31 10:31:04 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
  • Dec 31 10:31:04 stormy-crag-5179 app/web.1: 2014-12-31 18:31:04+0000 [Controller 2] node.start()
  • Dec 31 10:31:04 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
  • Dec 31 10:31:04 stormy-crag-5179 app/web.1: 2014-12-31 18:31:04+0000 [Controller 2] config = checkconfig.check_config_file(configfile, silence = True)
  • Dec 31 10:31:04 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
  • Dec 31 10:31:04 stormy-crag-5179 app/web.1: 2014-12-31 18:31:04+0000 [Controller 2] check_config(config, silence)
  • Dec 31 10:31:04 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
  • Dec 31 10:31:04 stormy-crag-5179 app/web.1: 2014-12-31 18:31:04+0000 [Controller 2] check_worker(worker, silence)
  • Dec 31 10:31:04 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
  • Dec 31 10:31:04 stormy-crag-5179 app/web.1: 2014-12-31 18:31:04+0000 [Controller 2] check_container(worker, silence)
  • Dec 31 10:31:04 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
  • Dec 31 10:31:04 stormy-crag-5179 app/web.1: 2014-12-31 18:31:04+0000 [Controller 2] check_container_component(component, silence)
  • Dec 31 10:31:04 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
  • Dec 31 10:31:04 stormy-crag-5179 app/web.1: 2014-12-31 18:31:04+0000 [Controller 2] check_container_transport(component[‘transport’])
  • Dec 31 10:31:04 stormy-crag-5179 app/web.1: 2014-12-31 18:31:04+0000 [Controller 2] Starting from local configuration ‘/app/.crossbar/config.json’
  • Dec 31 10:31:04 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
  • Dec 31 10:31:04 stormy-crag-5179 app/web.1: 2014-12-31 18:31:04+0000 [Controller 2] check_connecting_transport_websocket(transport)
  • Dec 31 10:31:04 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
  • Dec 31 10:31:04 stormy-crag-5179 app/web.1: 2014-12-31 18:31:04+0000 [Controller 2] check_connecting_endpoint(transport[‘endpoint’])
  • Dec 31 10:31:04 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
  • Dec 31 10:31:04 stormy-crag-5179 app/web.1: 2014-12-31 18:31:04+0000 [Controller 2] check_connecting_endpoint_tcp(endpoint)
  • Dec 31 10:31:04 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
  • Dec 31 10:31:04 stormy-crag-5179 app/web.1: 2014-12-31 18:31:04+0000 [Controller 2] check_endpoint_port(endpoint[‘port’])
  • Dec 31 10:31:04 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
  • Dec 31 10:31:04 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)))
  • Dec 31 10:31:04 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)
  • Dec 31 10:31:05 stormy-crag-5179 heroku/web.1: State changed from starting to crashed
  • Dec 31 10:31:05 stormy-crag-5179 heroku/web.1: Process exited with status 1

On Wednesday, December 31, 2014 1:22:46 PM UTC-5, Tobias Oberstein wrote:

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;)

0 Likes

#14

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

···

Am 31.12.2014 um 19:31 schrieb Mattia Romeo:

Same error as before:

0 Likes

#15

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?

···

On December 31, 2014 at 1:37:39 PM, Tobias Oberstein (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.

0 Likes

#16

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"
                  }
                }
             }
          ]

···

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?

==

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>.
For more options, visit https://groups.google.com/d/optout.

0 Likes

#17

Happens to the best of us :wink: Tried running it with the updated config and now crossbar is complaining that the mandatory url field is missing:

  • Dec 31 11:04:20 stormy-crag-5179 heroku/web.1: Starting process with command crossbar start
  • Dec 31 11:04:22 stormy-crag-5179 app/web.1: 2014-12-31 19:04:21+0000 [Controller 2] Log opened.
  • Dec 31 11:04:22 stormy-crag-5179 app/web.1: 2014-12-31 19:04:21+0000 [Controller 2] ============================== Crossbar.io ==============================
  • Dec 31 11:04:22 stormy-crag-5179 app/web.1: 2014-12-31 19:04:21+0000 [Controller 2] Crossbar.io 0.9.12-2 starting
  • Dec 31 11:04:22 stormy-crag-5179 app/web.1: 2014-12-31 19:04:21+0000 [Controller 2] Running on CPython using EPollReactor reactor
  • Dec 31 11:04:22 stormy-crag-5179 app/web.1: 2014-12-31 19:04:21+0000 [Controller 2] Starting from node directory /app/.crossbar
  • Dec 31 11:04:22 stormy-crag-5179 app/web.1: 2014-12-31 19:04:22+0000 [Controller 2] Starting from local configuration ‘/app/.crossbar/config.json’
  • Dec 31 11:04:22 stormy-crag-5179 app/web.1: 2014-12-31 19:04:22+0000 [Controller 2] Traceback (most recent call last):
  • Dec 31 11:04:22 stormy-crag-5179 app/web.1: 2014-12-31 19:04:22+0000 [Controller 2] File “/app/.heroku/python/bin/crossbar”, line 9, in
  • Dec 31 11:04:22 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’)()
  • Dec 31 11:04:22 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
  • Dec 31 11:04:22 stormy-crag-5179 app/web.1: 2014-12-31 19:04:22+0000 [Controller 2] options.func(options)
  • Dec 31 11:04:22 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
  • Dec 31 11:04:22 stormy-crag-5179 app/web.1: 2014-12-31 19:04:22+0000 [Controller 2] node.start()
  • Dec 31 11:04:22 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
  • Dec 31 11:04:22 stormy-crag-5179 app/web.1: 2014-12-31 19:04:22+0000 [Controller 2] config = checkconfig.check_config_file(configfile, silence = True)
  • Dec 31 11:04:22 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
  • Dec 31 11:04:22 stormy-crag-5179 app/web.1: 2014-12-31 19:04:22+0000 [Controller 2] check_config(config, silence)
  • Dec 31 11:04:22 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
  • Dec 31 11:04:22 stormy-crag-5179 app/web.1: 2014-12-31 19:04:22+0000 [Controller 2] check_worker(worker, silence)
  • Dec 31 11:04:22 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
  • Dec 31 11:04:22 stormy-crag-5179 app/web.1: 2014-12-31 19:04:22+0000 [Controller 2] check_container(worker, silence)
  • Dec 31 11:04:22 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
  • Dec 31 11:04:22 stormy-crag-5179 app/web.1: 2014-12-31 19:04:22+0000 [Controller 2] check_container_component(component, silence)
  • Dec 31 11:04:22 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
  • Dec 31 11:04:22 stormy-crag-5179 app/web.1: 2014-12-31 19:04:22+0000 [Controller 2] check_container_transport(component[‘transport’])
  • Dec 31 11:04:22 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
  • Dec 31 11:04:22 stormy-crag-5179 app/web.1: 2014-12-31 19:04:22+0000 [Controller 2] check_connecting_transport_websocket(transport)
  • Dec 31 11:04:22 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
  • Dec 31 11:04:22 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)))
  • Dec 31 11:04:22 stormy-crag-5179 app/web.1: 2014-12-31 19:04:22+0000 [Controller 2] Exception: missing mandatory attribute ‘url’ in WebSocket transport item
  • Dec 31 11:04:22 stormy-crag-5179 app/web.1: 2014-12-31 19:04:22+0000 [Controller 2]
  • Dec 31 11:04:22 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’},
  • Dec 31 11:04:22 stormy-crag-5179 app/web.1: 2014-12-31 19:04:22+0000 [Controller 2] u’type’: u’websocket’}
  • Dec 31 11:04:23 stormy-crag-5179 heroku/web.1: Process exited with status 1
  • Dec 31 11:04:26 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.

···

On December 31, 2014 at 1:58:42 PM, Tobias Oberstein (tobias.o...@gmail.com) wrote:

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.

For more options, visit https://groups.google.com/d/optout.


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/54A4475D.5010207%40gmail.com.

For more options, visit https://groups.google.com/d/optout.

0 Likes

#18

Ok. Fuck. One last try:

          "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
                  }
                }
             }
          ]

···

Am 31.12.2014 um 20:10 schrieb Mattia Romeo:

Happens to the best of us :wink: Tried running it with the updated config
and now crossbar is complaining that the mandatory url field is missing:

0 Likes

#19

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.

···

On December 31, 2014 at 2:16:18 PM, Tobias Oberstein (tobias.o...@gmail.com) wrote:

Am 31.12.2014 um 20:10 schrieb Mattia Romeo:

Happens to the best of us :wink: 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",

               "endpoint": {

                  "type": "tcp",

                  "host": "127.0.0.1",

                  "port": 9000

              }

            }

         }

      ]
0 Likes

#20

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

···

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.

0 Likes