rickyrauch / Balloons.IO

Balloons.IO is a web multi-room chat server and client ready to use. It’s built with the help of node.JS, Express, Socket.IO and Redis. Balloons uses PassportJS for authentication with Twitter and Facebook
http://balloons.io
2.36k stars 491 forks source link

Nodejitsu support, per-environment configuration, ability to remove Facebook/Twitter from config #70

Closed jwietelmann closed 11 years ago

jwietelmann commented 12 years ago

Separated config files on a per-environment basis

Consolidated the config require statements down to just one.

Made sure that the Redis client object gets passed to all the correct places (otherwise you get weird errors where some node_redis operations try to use the default client options instead of those from the config).

Made it so that the application doesn't bomb out when either Twitter or Facebook is missing from the config.

Added a Nodejitsu config sample and then some Nodejitsu-required stuff to package.json.

Updated the README to reflect the new configuration file structure.

jwietelmann commented 12 years ago

To explain some of my reasoning a little more: 1) I needed separate Facebook keys and callbacks for development and production, 2) I didn't want to use Twitter so it seems silly to have to leave the config for it in order to run Balloons, 3) Nodejitsu doesn't use the REDISTOGO_URL env variable, 4) In some instances, Balloons seemed to be trying to use default node_redis client options instead of the existing client on Nodejitsu.

This should fix all of that and make deploying to Nodejitsu and configuring multiple environments require a lot less hacking.

cristiandouce commented 12 years ago

Thanks! I'll run it myself and merge as soon as I can! Great work!

themgt commented 12 years ago

I've been playing with getting Balloons.IO working on Pogoapp and found that the Socket.IO RedisStore is still using the default redis connections (you need to actually pass it 2/3 separate RedisClient objects, like: io.set('store', new sio.RedisStore({ redisPub: pubClient, redisSub: subClient, redisClient: redisClient }));

(see https://groups.google.com/forum/?fromgroups=#!topic/socket_io/nREq36wZi18)

I updated jwietelmann's fork a bit to support that (I hope): https://github.com/themgt/Balloons.IO/commit/9712508f0a9a5ecdbb33859787377e45f488ca18

cristiandouce commented 12 years ago

@themgt & @jwietelmann Have you tried and successfully run BalloonsIO with those changes?

I wasn´t able to run any... It just doesn´t work when I merge this changes locally. Could you review this?

jwietelmann commented 12 years ago

@cristiandouce My own fork runs just fine for me locally. But I have had issues on Nodejitsu recently that I think may be related to the things @themgt is trying to address. I have not tried his fork though.

themgt commented 12 years ago

cristiandouce - Yeah I've run it locally & have it running (for now, only FB-login) against a remote redis DB (the app & DB are in separate LXC containers): http://balloons.a.pogoapp.com

cristiandouce commented 12 years ago

@themgt With twitter it throws me this: http://d.pr/n/PSlR I "successfully" connected with facebook login... but on the browser throws me this: http://d.pr/i/kmnS I guess websockets are not allowed in pogoapp.

The fact is that I ran a merge locally and was not able to connect with twitter. Is there any config option missing on "config/sample.json"? @jwietelmann the same with your merge into Balloons.IO/master.

jwietelmann commented 12 years ago

@cristiandouce Forgive me for asking, but did you follow the changes I made to the README? I just did a fresh clone of my repo and it worked perfectly.

cristiandouce commented 12 years ago

@jwietelmann I copied my old "config.json" to "config/development.json" if that's what you are asking. And that's the point of my question: Is there some "sample" config key missing on "config/sample.json"? (for local configuration... maybe that wasn't implicit...)

But never mind. I cloned your repo and made it work, which leads me to worry about why doesn't it work when I perform a merge with current master branch. Will check out soon.

themgt commented 11 years ago

I've done a small fork of the current master, resolving just this issue where sio.RedisStore defaults to creating a separate subscriber client connected to local redis if a separate subscriber client connection isn't provided (see the google groups link above). I believe this is needed to fix issue #71 also - without it I still see balloons.io trying to connect to a non-existent local redis server

pull request 72, really just this commit: https://github.com/themgt/Balloons.IO/commit/ad2e93f4c5e4ca3b2c404ab3167e190aebb3fe24

btw yeah, no WebSockets support on pogoapp yet