Re: Heroku Mongoid config and how it works

2010-09-30 Thread Bradley
Well I'm still baffled then.  You said above that the only thing set
was the MONGO_HQ url, was that when you did a `heroku config` because
in that instance you're right, I only see MONGOHQ_URL.  Is that to
mean then that these are the only environment vars set by Heroku
itself??  Because as I mentioned above, when I `heroku console` my ENV
has all the MONGOID_xx vars...

I grep'd through the whole mongoid project and as I say I only found
the yml file referencing these env vars, but nothing that's actually
creating them.  I guess I'll just have to leave it at that and keep
using it as I am.

On Sep 30, 1:03 pm, Oren Teich  wrote:
> Nope - the only thing an add-on does is set one config var -
> MONOGHQ_URL in this case.  No other magic.  Some add-ons like new
> relic will also install a gem or plugin, but mongo hq isn't one of
> them.  Those are the only actions an add-on can take.
>
> Oren
>
>
>
> On Wed, Sep 29, 2010 at 7:55 PM, Bradley  wrote:
> > It's interesting, after searching through the source of the gem,
> > there's a mongoid.yml in a generator that references the same env vars
> > for the db connection (MONGOID_HOST, MONGOID_PORT... etc), and yet I
> > don't see the gem creating these anywhere.  So I'm still confused as
> > to where these were generated.  It MUST be part of heroku in some
> > way... no?  maybe the mongohq addon?
>
> > On Sep 27, 11:47 am, John Barnette  wrote:
> >> On Sep 27, 2010, at 8:44 AM, Chris Hanks wrote:
>
> >> > On Sep 27, 6:51 am, Abel Tamayo  wrote:
> >> >> It seems MongoMapper is more popular around here. At least it's the 
> >> >> solution
> >> >> I'm using and works flawlessly with Heroku.
> >> >> On Mon, Sep 27, 2010 at 2:33 PM, Bradley  
> >> >> wrote:
> >> >>> no one has a comment on this?  I thought it'd be a fairly straight
> >> >>> forward answer.
>
> >> Why bother with the YML file?
>
> >> require "mongoid"
> >> require "uri"
>
> >> url = URI.parse ENV["MONGODB_URL"]
> >> MONGO = Mongo::Connection.new(url.host, url.port).db url.path[1..-1]
>
> >> if url.user && url.password
> >>   unless MONGO.authenticate url.user, url.password
> >>     raise "Couldn't authenticate MongoDB: #{url.to_s}"
> >>   end
> >> end
>
> >> Mongoid.configure do |config|
> >>   config.autocreate_indexes = true
> >>   config.master = MONGO
> >>   config.persist_in_safe_mode = false
> >>   config.raise_not_found_error = false
> >> end
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Heroku" group.
> > To post to this group, send email to her...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > heroku+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/heroku?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Heroku" group.
To post to this group, send email to her...@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.



Re: Heroku Mongoid config and how it works

2010-09-30 Thread Oren Teich
Nope - the only thing an add-on does is set one config var -
MONOGHQ_URL in this case.  No other magic.  Some add-ons like new
relic will also install a gem or plugin, but mongo hq isn't one of
them.  Those are the only actions an add-on can take.

Oren

On Wed, Sep 29, 2010 at 7:55 PM, Bradley  wrote:
> It's interesting, after searching through the source of the gem,
> there's a mongoid.yml in a generator that references the same env vars
> for the db connection (MONGOID_HOST, MONGOID_PORT... etc), and yet I
> don't see the gem creating these anywhere.  So I'm still confused as
> to where these were generated.  It MUST be part of heroku in some
> way... no?  maybe the mongohq addon?
>
> On Sep 27, 11:47 am, John Barnette  wrote:
>> On Sep 27, 2010, at 8:44 AM, Chris Hanks wrote:
>>
>> > On Sep 27, 6:51 am, Abel Tamayo  wrote:
>> >> It seems MongoMapper is more popular around here. At least it's the 
>> >> solution
>> >> I'm using and works flawlessly with Heroku.
>> >> On Mon, Sep 27, 2010 at 2:33 PM, Bradley  
>> >> wrote:
>> >>> no one has a comment on this?  I thought it'd be a fairly straight
>> >>> forward answer.
>>
>> Why bother with the YML file?
>>
>> require "mongoid"
>> require "uri"
>>
>> url = URI.parse ENV["MONGODB_URL"]
>> MONGO = Mongo::Connection.new(url.host, url.port).db url.path[1..-1]
>>
>> if url.user && url.password
>>   unless MONGO.authenticate url.user, url.password
>>     raise "Couldn't authenticate MongoDB: #{url.to_s}"
>>   end
>> end
>>
>> Mongoid.configure do |config|
>>   config.autocreate_indexes = true
>>   config.master = MONGO
>>   config.persist_in_safe_mode = false
>>   config.raise_not_found_error = false
>> end
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Heroku" group.
> To post to this group, send email to her...@googlegroups.com.
> To unsubscribe from this group, send email to 
> heroku+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/heroku?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Heroku" group.
To post to this group, send email to her...@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.



Re: Heroku Mongoid config and how it works

2010-09-29 Thread Bradley
It's interesting, after searching through the source of the gem,
there's a mongoid.yml in a generator that references the same env vars
for the db connection (MONGOID_HOST, MONGOID_PORT... etc), and yet I
don't see the gem creating these anywhere.  So I'm still confused as
to where these were generated.  It MUST be part of heroku in some
way... no?  maybe the mongohq addon?

On Sep 27, 11:47 am, John Barnette  wrote:
> On Sep 27, 2010, at 8:44 AM, Chris Hanks wrote:
>
> > On Sep 27, 6:51 am, Abel Tamayo  wrote:
> >> It seems MongoMapper is more popular around here. At least it's the 
> >> solution
> >> I'm using and works flawlessly with Heroku.
> >> On Mon, Sep 27, 2010 at 2:33 PM, Bradley  
> >> wrote:
> >>> no one has a comment on this?  I thought it'd be a fairly straight
> >>> forward answer.
>
> Why bother with the YML file?
>
> require "mongoid"
> require "uri"
>
> url = URI.parse ENV["MONGODB_URL"]
> MONGO = Mongo::Connection.new(url.host, url.port).db url.path[1..-1]
>
> if url.user && url.password
>   unless MONGO.authenticate url.user, url.password
>     raise "Couldn't authenticate MongoDB: #{url.to_s}"
>   end
> end
>
> Mongoid.configure do |config|
>   config.autocreate_indexes = true
>   config.master = MONGO
>   config.persist_in_safe_mode = false
>   config.raise_not_found_error = false
> end

-- 
You received this message because you are subscribed to the Google Groups 
"Heroku" group.
To post to this group, send email to her...@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.



Re: Heroku Mongoid config and how it works

2010-09-29 Thread John Barnette
On Sep 27, 2010, at 8:44 AM, Chris Hanks wrote:
> On Sep 27, 6:51 am, Abel Tamayo  wrote:
>> It seems MongoMapper is more popular around here. At least it's the solution
>> I'm using and works flawlessly with Heroku.
>> On Mon, Sep 27, 2010 at 2:33 PM, Bradley  wrote:
>>> no one has a comment on this?  I thought it'd be a fairly straight
>>> forward answer.

Why bother with the YML file?

require "mongoid"
require "uri"

url = URI.parse ENV["MONGODB_URL"]
MONGO = Mongo::Connection.new(url.host, url.port).db url.path[1..-1]

if url.user && url.password
  unless MONGO.authenticate url.user, url.password
raise "Couldn't authenticate MongoDB: #{url.to_s}"
  end
end

Mongoid.configure do |config|
  config.autocreate_indexes = true
  config.master = MONGO
  config.persist_in_safe_mode = false
  config.raise_not_found_error = false
end


-- 
You received this message because you are subscribed to the Google Groups 
"Heroku" group.
To post to this group, send email to her...@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.



Re: Heroku Mongoid config and how it works

2010-09-27 Thread Oren Teich
I'm not sure what's going on, but Heroku doesn't do any magic like
that.  When you add the mongohq addon, the only url that is set is the
MONGOHQ_URL.  I just tested it on one of my apps, added mongohq, and
there is nothing set for MONGOID_*.  Perhaps that's a feature that the
mongoid gem itself provides?

Oren

On Mon, Sep 27, 2010 at 5:43 PM, Chris Hanks
 wrote:
> I guess they wanted the MongoHQ addon to "just work" with Mongoid in
> addition to MongoMapper.
>
>
> On Sep 27, 4:58 pm, Bradley  wrote:
>> ya you're right, those env vars exist.
>>
>> i wonder why the docs on this are so sparse, and how the author of
>> this template found this out.  I haven't been able to locate anything
>> that gives an indication that this is happening.
>>
>> On Sep 27, 11:44 am, Chris Hanks 
>> wrote:
>>
>>
>>
>> > Heroku might be breaking up the ENV['MONGOHQ_URL'] into those
>> > components for you. Try "heroku console" from your command line and
>> > then "ENV['MONGOID_HOST']" to see if it's present.
>>
>> > On Sep 27, 6:51 am, Abel Tamayo  wrote:
>>
>> > > It seems MongoMapper is more popular around here. At least it's the 
>> > > solution
>> > > I'm using and works flawlessly with Heroku.
>>
>> > > On Mon, Sep 27, 2010 at 2:33 PM, Bradley  
>> > > wrote:
>> > > > no one has a comment on this?  I thought it'd be a fairly straight
>> > > > forward answer.
>>
>> > > > On Sep 22, 7:11 pm, Bradley  wrote:
>> > > > > I just used a template for a new rails app that sets up everything 
>> > > > > for
>> > > > > use with Mongoid.  The mongoid.yml file looks like this:
>>
>> > > > > production:
>> > > > >   host: <%= ENV['MONGOID_HOST'] %>
>> > > > >   port: <%= ENV['MONGOID_PORT'] %>
>> > > > >   username: <%= ENV['MONGOID_USERNAME'] %>
>> > > > >   password: <%= ENV['MONGOID_PASSWORD'] %>
>> > > > >   database: <%= ENV['MONGOID_DATABASE'] %>
>>
>> > > > > I added the MONGOHQ_URL config var to my app (with the string given
>> > > > > from mongohq), deployed and it worked!  My question is...    HOW?
>>
>> > > > > I don't get how adding that single URL has all of a sudden given me
>> > > > > these 5 environment variables.  I searched through the heroku docs on
>> > > > > mongo and they pretty sparse.  Nowhere does it mention that I might
>> > > > > use these particular env vars.  So how does this happen?
>>
>> > > > --
>> > > > You received this message because you are subscribed to the Google 
>> > > > Groups
>> > > > "Heroku" group.
>> > > > To post to this group, send email to her...@googlegroups.com.
>> > > > To unsubscribe from this group, send email to
>> > > > heroku+unsubscr...@googlegroups.com
>> > > > .
>> > > > For more options, visit this group at
>> > > >http://groups.google.com/group/heroku?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Heroku" group.
> To post to this group, send email to her...@googlegroups.com.
> To unsubscribe from this group, send email to 
> heroku+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/heroku?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Heroku" group.
To post to this group, send email to her...@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.



Re: Heroku Mongoid config and how it works

2010-09-27 Thread Chris Hanks
I guess they wanted the MongoHQ addon to "just work" with Mongoid in
addition to MongoMapper.


On Sep 27, 4:58 pm, Bradley  wrote:
> ya you're right, those env vars exist.
>
> i wonder why the docs on this are so sparse, and how the author of
> this template found this out.  I haven't been able to locate anything
> that gives an indication that this is happening.
>
> On Sep 27, 11:44 am, Chris Hanks 
> wrote:
>
>
>
> > Heroku might be breaking up the ENV['MONGOHQ_URL'] into those
> > components for you. Try "heroku console" from your command line and
> > then "ENV['MONGOID_HOST']" to see if it's present.
>
> > On Sep 27, 6:51 am, Abel Tamayo  wrote:
>
> > > It seems MongoMapper is more popular around here. At least it's the 
> > > solution
> > > I'm using and works flawlessly with Heroku.
>
> > > On Mon, Sep 27, 2010 at 2:33 PM, Bradley  
> > > wrote:
> > > > no one has a comment on this?  I thought it'd be a fairly straight
> > > > forward answer.
>
> > > > On Sep 22, 7:11 pm, Bradley  wrote:
> > > > > I just used a template for a new rails app that sets up everything for
> > > > > use with Mongoid.  The mongoid.yml file looks like this:
>
> > > > > production:
> > > > >   host: <%= ENV['MONGOID_HOST'] %>
> > > > >   port: <%= ENV['MONGOID_PORT'] %>
> > > > >   username: <%= ENV['MONGOID_USERNAME'] %>
> > > > >   password: <%= ENV['MONGOID_PASSWORD'] %>
> > > > >   database: <%= ENV['MONGOID_DATABASE'] %>
>
> > > > > I added the MONGOHQ_URL config var to my app (with the string given
> > > > > from mongohq), deployed and it worked!  My question is...    HOW?
>
> > > > > I don't get how adding that single URL has all of a sudden given me
> > > > > these 5 environment variables.  I searched through the heroku docs on
> > > > > mongo and they pretty sparse.  Nowhere does it mention that I might
> > > > > use these particular env vars.  So how does this happen?
>
> > > > --
> > > > You received this message because you are subscribed to the Google 
> > > > Groups
> > > > "Heroku" group.
> > > > To post to this group, send email to her...@googlegroups.com.
> > > > To unsubscribe from this group, send email to
> > > > heroku+unsubscr...@googlegroups.com
> > > > .
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/heroku?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Heroku" group.
To post to this group, send email to her...@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.



Re: Heroku Mongoid config and how it works

2010-09-27 Thread Bradley
ya you're right, those env vars exist.

i wonder why the docs on this are so sparse, and how the author of
this template found this out.  I haven't been able to locate anything
that gives an indication that this is happening.

On Sep 27, 11:44 am, Chris Hanks 
wrote:
> Heroku might be breaking up the ENV['MONGOHQ_URL'] into those
> components for you. Try "heroku console" from your command line and
> then "ENV['MONGOID_HOST']" to see if it's present.
>
> On Sep 27, 6:51 am, Abel Tamayo  wrote:
>
>
>
> > It seems MongoMapper is more popular around here. At least it's the solution
> > I'm using and works flawlessly with Heroku.
>
> > On Mon, Sep 27, 2010 at 2:33 PM, Bradley  wrote:
> > > no one has a comment on this?  I thought it'd be a fairly straight
> > > forward answer.
>
> > > On Sep 22, 7:11 pm, Bradley  wrote:
> > > > I just used a template for a new rails app that sets up everything for
> > > > use with Mongoid.  The mongoid.yml file looks like this:
>
> > > > production:
> > > >   host: <%= ENV['MONGOID_HOST'] %>
> > > >   port: <%= ENV['MONGOID_PORT'] %>
> > > >   username: <%= ENV['MONGOID_USERNAME'] %>
> > > >   password: <%= ENV['MONGOID_PASSWORD'] %>
> > > >   database: <%= ENV['MONGOID_DATABASE'] %>
>
> > > > I added the MONGOHQ_URL config var to my app (with the string given
> > > > from mongohq), deployed and it worked!  My question is...    HOW?
>
> > > > I don't get how adding that single URL has all of a sudden given me
> > > > these 5 environment variables.  I searched through the heroku docs on
> > > > mongo and they pretty sparse.  Nowhere does it mention that I might
> > > > use these particular env vars.  So how does this happen?
>
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > > "Heroku" group.
> > > To post to this group, send email to her...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > heroku+unsubscr...@googlegroups.com
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/heroku?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Heroku" group.
To post to this group, send email to her...@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.



Re: Heroku Mongoid config and how it works

2010-09-27 Thread Chris Hanks
Heroku might be breaking up the ENV['MONGOHQ_URL'] into those
components for you. Try "heroku console" from your command line and
then "ENV['MONGOID_HOST']" to see if it's present.



On Sep 27, 6:51 am, Abel Tamayo  wrote:
> It seems MongoMapper is more popular around here. At least it's the solution
> I'm using and works flawlessly with Heroku.
>
>
>
> On Mon, Sep 27, 2010 at 2:33 PM, Bradley  wrote:
> > no one has a comment on this?  I thought it'd be a fairly straight
> > forward answer.
>
> > On Sep 22, 7:11 pm, Bradley  wrote:
> > > I just used a template for a new rails app that sets up everything for
> > > use with Mongoid.  The mongoid.yml file looks like this:
>
> > > production:
> > >   host: <%= ENV['MONGOID_HOST'] %>
> > >   port: <%= ENV['MONGOID_PORT'] %>
> > >   username: <%= ENV['MONGOID_USERNAME'] %>
> > >   password: <%= ENV['MONGOID_PASSWORD'] %>
> > >   database: <%= ENV['MONGOID_DATABASE'] %>
>
> > > I added the MONGOHQ_URL config var to my app (with the string given
> > > from mongohq), deployed and it worked!  My question is...    HOW?
>
> > > I don't get how adding that single URL has all of a sudden given me
> > > these 5 environment variables.  I searched through the heroku docs on
> > > mongo and they pretty sparse.  Nowhere does it mention that I might
> > > use these particular env vars.  So how does this happen?
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Heroku" group.
> > To post to this group, send email to her...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > heroku+unsubscr...@googlegroups.com
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/heroku?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Heroku" group.
To post to this group, send email to her...@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.



Re: Heroku Mongoid config and how it works

2010-09-27 Thread Abel Tamayo
It seems MongoMapper is more popular around here. At least it's the solution
I'm using and works flawlessly with Heroku.

On Mon, Sep 27, 2010 at 2:33 PM, Bradley  wrote:

> no one has a comment on this?  I thought it'd be a fairly straight
> forward answer.
>
> On Sep 22, 7:11 pm, Bradley  wrote:
> > I just used a template for a new rails app that sets up everything for
> > use with Mongoid.  The mongoid.yml file looks like this:
> >
> > production:
> >   host: <%= ENV['MONGOID_HOST'] %>
> >   port: <%= ENV['MONGOID_PORT'] %>
> >   username: <%= ENV['MONGOID_USERNAME'] %>
> >   password: <%= ENV['MONGOID_PASSWORD'] %>
> >   database: <%= ENV['MONGOID_DATABASE'] %>
> >
> > I added the MONGOHQ_URL config var to my app (with the string given
> > from mongohq), deployed and it worked!  My question is...HOW?
> >
> > I don't get how adding that single URL has all of a sudden given me
> > these 5 environment variables.  I searched through the heroku docs on
> > mongo and they pretty sparse.  Nowhere does it mention that I might
> > use these particular env vars.  So how does this happen?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Heroku" group.
> To post to this group, send email to her...@googlegroups.com.
> To unsubscribe from this group, send email to
> heroku+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/heroku?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Heroku" group.
To post to this group, send email to her...@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.



Re: Heroku Mongoid config and how it works

2010-09-27 Thread Bradley
no one has a comment on this?  I thought it'd be a fairly straight
forward answer.

On Sep 22, 7:11 pm, Bradley  wrote:
> I just used a template for a new rails app that sets up everything for
> use with Mongoid.  The mongoid.yml file looks like this:
>
> production:
>   host: <%= ENV['MONGOID_HOST'] %>
>   port: <%= ENV['MONGOID_PORT'] %>
>   username: <%= ENV['MONGOID_USERNAME'] %>
>   password: <%= ENV['MONGOID_PASSWORD'] %>
>   database: <%= ENV['MONGOID_DATABASE'] %>
>
> I added the MONGOHQ_URL config var to my app (with the string given
> from mongohq), deployed and it worked!  My question is...    HOW?
>
> I don't get how adding that single URL has all of a sudden given me
> these 5 environment variables.  I searched through the heroku docs on
> mongo and they pretty sparse.  Nowhere does it mention that I might
> use these particular env vars.  So how does this happen?

-- 
You received this message because you are subscribed to the Google Groups 
"Heroku" group.
To post to this group, send email to her...@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.



Heroku Mongoid config and how it works

2010-09-22 Thread Bradley
I just used a template for a new rails app that sets up everything for
use with Mongoid.  The mongoid.yml file looks like this:


production:
  host: <%= ENV['MONGOID_HOST'] %>
  port: <%= ENV['MONGOID_PORT'] %>
  username: <%= ENV['MONGOID_USERNAME'] %>
  password: <%= ENV['MONGOID_PASSWORD'] %>
  database: <%= ENV['MONGOID_DATABASE'] %>


I added the MONGOHQ_URL config var to my app (with the string given
from mongohq), deployed and it worked!  My question is...HOW?

I don't get how adding that single URL has all of a sudden given me
these 5 environment variables.  I searched through the heroku docs on
mongo and they pretty sparse.  Nowhere does it mention that I might
use these particular env vars.  So how does this happen?

-- 
You received this message because you are subscribed to the Google Groups 
"Heroku" group.
To post to this group, send email to her...@googlegroups.com.
To unsubscribe from this group, send email to 
heroku+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/heroku?hl=en.