librelist archives

« back to archive

Running everything on one port

Running everything on one port

From:
Justin Clift
Date:
2012-09-22 @ 19:05
Hi all,

Just submitted a new pull request with concept code to
run everything over just one port:

  https://github.com/browserquest/BrowserQuest/pull/12

*Please don't merge it to master yet*

Was more putting that there to attract
feedback/attention. :)

With this commit, now only the server needs to be
started.

  i.e.  $ node server/js/main.js

The server also serves up the client files, and has
special treatment for the shared/ and client/ config
files, so no touching of them is needed, but it
should all still work.

Would really like some feedback and thoughts on the
patch, as I reckon this makes this way easier to set
up, but the code is pretty literal (no style nor
elegance whatsoever).  Also, I'm new to Node.js, so
there are probably much better ways to do some of
this. :)  (am open to suggestions)

Regards and best wishes,

Justin Clift

--
Aeolus Community Manager
http://www.aeolusproject.org

Re: [browserquest] Running everything on one port

From:
Brynn
Date:
2012-09-22 @ 19:12
Pretty cool stuff, Justin, good work! I imagine a lot of us are going
to have less than perfect code, it's probably okay as long as we
document well. It can always be cleaned up in the future.

On Sat, Sep 22, 2012 at 12:05 PM, Justin Clift <jclift@redhat.com> wrote:
> Hi all,
>
> Just submitted a new pull request with concept code to
> run everything over just one port:
>
>   https://github.com/browserquest/BrowserQuest/pull/12
>
> *Please don't merge it to master yet*
>
> Was more putting that there to attract
> feedback/attention. :)
>
> With this commit, now only the server needs to be
> started.
>
>   i.e.  $ node server/js/main.js
>
> The server also serves up the client files, and has
> special treatment for the shared/ and client/ config
> files, so no touching of them is needed, but it
> should all still work.
>
> Would really like some feedback and thoughts on the
> patch, as I reckon this makes this way easier to set
> up, but the code is pretty literal (no style nor
> elegance whatsoever).  Also, I'm new to Node.js, so
> there are probably much better ways to do some of
> this. :)  (am open to suggestions)
>
> Regards and best wishes,
>
> Justin Clift
>
> --
> Aeolus Community Manager
> http://www.aeolusproject.org
>

Re: [browserquest] Running everything on one port

From:
Steve Gricci
Date:
2012-09-22 @ 20:08
(Note: I haven't taken a good look at the branch in question yet, also, I 
just joined this list.)

That'll definitely make development easier. :) 

Correct me if I'm wrong but, while this is certainly 
something that'll help in the short term, this should
be more of a preference / command line option.

I've looked over the archive of this list and didn't see
a mention of this, but is there a plan for eventual
public deployment of this code?

Having Node.js serve the static HTML / assets will
certainly be a limiting factor if so.  During the initial
launch of BrowserQuest by Mozilla, they had many
issue with scaling and had to resort to hosting a lot
of the assets on Content Delivery Networks (CDN).

Just a thought.

Great work! 


On Saturday, September 22, 2012 at 1:12 PM, Brynn wrote:

> Pretty cool stuff, Justin, good work! I imagine a lot of us are going
> to have less than perfect code, it's probably okay as long as we
> document well. It can always be cleaned up in the future.
> 
> On Sat, Sep 22, 2012 at 12:05 PM, Justin Clift <jclift@redhat.com 
(mailto:jclift@redhat.com)> wrote:
> > Hi all,
> > 
> > Just submitted a new pull request with concept code to
> > run everything over just one port:
> > 
> > https://github.com/browserquest/BrowserQuest/pull/12
> > 
> > *Please don't merge it to master yet*
> > 
> > Was more putting that there to attract
> > feedback/attention. :)
> > 
> > With this commit, now only the server needs to be
> > started.
> > 
> > i.e. $ node server/js/main.js
> > 
> > The server also serves up the client files, and has
> > special treatment for the shared/ and client/ config
> > files, so no touching of them is needed, but it
> > should all still work.
> > 
> > Would really like some feedback and thoughts on the
> > patch, as I reckon this makes this way easier to set
> > up, but the code is pretty literal (no style nor
> > elegance whatsoever). Also, I'm new to Node.js, so
> > there are probably much better ways to do some of
> > this. :) (am open to suggestions)
> > 
> > Regards and best wishes,
> > 
> > Justin Clift
> > 
> > --
> > Aeolus Community Manager
> > http://www.aeolusproject.org
> > 
> 
> 
> 

Re: [browserquest] Running everything on one port

From:
Justin Clift
Date:
2012-09-23 @ 03:02
On 23/09/2012, at 6:08 AM, Steve Gricci wrote:
> (Note: I haven't taken a good look at the branch in question yet, also, 
I just joined this list.)
> 
> That'll definitely make development easier. :)
> 
> Correct me if I'm wrong but, while this is certainly 
> something that'll help in the short term, this should
> be more of a preference / command line option.

Yep, definitely agree.  The initial idea I'm thinking of
at the moment, is to add a field to the server/config.json
file.

It has these ones right now:

    "port": 8000,
    "debug_level": "info",
    "nb_players_per_world": 200,
    "nb_worlds": 5,
    "map_filepath": "./server/maps/world_server.json",
    "metrics_enabled": false

So, adding a true/false one there, called "use_one_port",
and defaulting to true.  Defaulting to true because it'll
be an easier setup for majority of users.

I'll need to add some kind of check for the value there
are startup, so the right behaviour occurs.

Oh, and will need to update our docs accordingly. :)


> I've looked over the archive of this list and didn't see
> a mention of this, but is there a plan for eventual
> public deployment of this code?

Personally, I'd really really like there to be.  As you
mention, we haven't really thought through that yet.

Brynn has suggested we register a domain name like
projectbq.com (or.org), and put relevant website type
stuff there.  It shouldn't be too hard to have subdomains
off that for running servers, and there are several
places around we can get (low resource usage) free
servers from.

If our hosting server requirements start to get
tricky (ie lots of users), we may need to get creative,
like looking for sponsorship (Mozilla?) or something.

It _might_ be possible to have the main
browserquest.mozilla.org site be updated to run with
our code releases.  I'm kind of expecting we'd need to
present a _very good_ case to them for that though.
(no idea)


> Having Node.js serve the static HTML / assets will
> certainly be a limiting factor if so.  During the initial
> launch of BrowserQuest by Mozilla, they had many
> issue with scaling and had to resort to hosting a lot
> of the assets on Content Delivery Networks (CDN).

Yeah saw that, thus the same desire to have this new
code be optional. :)


> Just a thought.
> 
> Great work!

Thanks Steve. :)

Regards and best wishes,

Justin Clift

--
Aeolus Community Manager
http://www.aeolusproject.org

Re: [browserquest] Running everything on one port

From:
Justin Clift
Date:
2012-09-24 @ 07:59
On 23/09/2012, at 5:12 AM, Brynn wrote:
> Pretty cool stuff, Justin, good work! I imagine a lot of us are going
> to have less than perfect code, it's probably okay as long as we
> document well. It can always be cleaned up in the future.


Just updated the pull request with what (should) be working final code:

  https://github.com/browserquest/BrowserQuest/pull/12/files

Does someone have Node.js 0.6.x series around they could test it on
quickly?  I only have Node.js 0.8.x series available here.

Quickest way would be to clone the source branch for the request:

  $ git clone git://github.com/justinclift/BrowserQuest.git -b oneport
  $ cd BrowserQuest; npm install -d; node server/js/main.js

If it works for 0.6.x series of Node.js too, then cool, hit the Merge
button on the pull request. :)

Regards and best wishes,

Justin Clift

--
Aeolus Community Manager
http://www.aeolusproject.org

Re: [browserquest] Running everything on one port

From:
Justin Clift
Date:
2012-09-24 @ 10:33
On 24/09/2012, at 5:59 PM, Justin Clift wrote:
> On 23/09/2012, at 5:12 AM, Brynn wrote:
>> Pretty cool stuff, Justin, good work! I imagine a lot of us are going
>> to have less than perfect code, it's probably okay as long as we
>> document well. It can always be cleaned up in the future.
> 
> Just updated the pull request with what (should) be working final code:
> 
>  https://github.com/browserquest/BrowserQuest/pull/12/files
> 
> Does someone have Node.js 0.6.x series around they could test it on
> quickly?  I only have Node.js 0.8.x series available here.

It turned out getting Node.js 0.6.x installed here was pretty easy after
all.  So I confirmed it works, then merged the pull request. :)

+ Justin

--
Aeolus Community Manager
http://www.aeolusproject.org