Monday, 21 May 2012

How-to: Set up MongoHQ in Grails

So I'm using MongoHQ for my running my integration tests, and I figured out how to map the connection string to the grails config.

Consider this MongoHQ config that you got when you signed up:


mongodb://cloudbees:password@flame.mongohq.com:27029/


The corresponding config would look like this:




 
1:     test {   
2:        dataSource {   
3:          dbCreate = "update"   
4:          url = "jdbc:h2:mem:testDb;MVCC=TRUE"   
5:        }   
6:        grails {   
7:          mongo {   
8:             host = "flame.mongohq.com"   
9:             port = 27029   
10:             username = "cloudbees"   
11:             password = "password"   
12:             databaseName = ""   
13:             options {   
14:               autoConnectRetry = true   
15:               connectTimeout = 300   
16:             }   
17:          }   
18:        }   
19:     }   
 


But wait! The initial password they gave you needed to be changed in order for it to work (at least for me anyways). To change your password, login to MongoHQ and change it.



Hopefully that helps someone!

2 comments:

  1. I had a hiccup today with MongoHQ and Cloudbees. I had to actually create another other than 'cloudbees' to make it work. Hope someone finds this useful.

    ReplyDelete
    Replies
    1. Another user other than cloudbees, such as 'bob'

      Delete