Skip to content

A place to manage our events and other activites around the London community

Notifications You must be signed in to change notification settings

lsug-dojo/lsug-website

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Prerequisites
=============

Install play on MacOS using homebrew
------------------------------------
brew install --devel play

Importing the project in IntelliJ IDEA v. 12.x
----------------------------------------------
0/ Make sure you have the scala plugin install

1/ Install sbt
brew install sbt

2/ Install gen-idea sbt plugin [https://github.com/mpeltonen/sbt-idea]
Add the following lines to ~/.sbt/plugins/build.sbt or PROJECT_DIR/project/plugins.sbt
addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.2.0")

3/ Create idea project files
./sbt gen-idea

4/ Open project in IDEA

This is your new Play 2.0 application
=====================================

Optional Environment Variables
------------------------------

The app can run with the default settings from conf/application.conf. 

export LSUG_MEETUP_GROUP_ID="..."
export LSUG_MEETUP_KEY="..."

# for http://lsug.org
export LSUG_MEETUP_ID="8hb7m06tmkrv44thc9q2qvtcc3"

# alternatively for http://localhost:9000
export LSUG_MEETUP_ID="6uaao0sbsmt6u6rj17v4lu5u9"

export LSUG_MONGODB_DEFAULT_URI="..."


Environment Variables on Heroku
-------------------------------

You can configure environment variables in heroku and use "foreman start" locally to run the app as it would run on heroku.

https://devcenter.heroku.com/articles/config-vars


Configuring MongoLabs with Play
-------------------------------

How to configure MongoDB with Play when running MongoLabs addon in Heroku.

Heroku gives you a default name for your database.  If you look in the configuraiton for your Heroku application then you can see the URI

heroku config

or

herok config ¦ grep mongo

 This will give you a URI that is also set in the environment variable MONGOLAB_URI.

Is it enough to just add this to the Procfile for you Play app

 -Dmongodb.uri=$MONGOLAB_URI

Or do you also need to include it in your play framework configuration in config/application.conf

# MongoURI
# ~~~~~
# a MongoURI can also be used http://www.mongodb.org/display/DOCS/Connections
# mongodb.default.uri = "mongodb://127.0.0.1:27017,mongodb.org:1337/salat-test"


Using the universal resource indicator directly in the application.conf will work when running play2 / mongo application on your development machine and heroku.  However, there is an obvious issue that you may not want to change the contents of your app on heroku and use the same db for both environments leads to this issue.

If you have a seperate mongodb locally, then you have more scope for experimenting.


You can have different configs for local and heroku, but its not as nice as having a common configuation.  It can also lead to deploying the wrong config to github / heroku with unpleasent side effects.


If you assume you have mongo also running locally, in theory so long as you have the same database name and are using the defaults, then it should work by having a common configuration.

mongodb.default.uri="mongodb://127.0.0.1:27017/dbname"


Can you just get the Procfile to set things up.  This would require the running of the program to send an environment variable to the play framework when run.

About

A place to manage our events and other activites around the London community

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages