Commit 85a1e847 authored by Julien Perret's avatar Julien Perret

documentation on how to run gate and a mongoDB (with docker)

parent 45d660d5
......@@ -7,10 +7,31 @@ sbt
sbt> go
```
Then launche the jetty server:
Then launch the jetty server:
```jshelllanguage
project server // in sbt mode
run
```
This will use the default MongoDB configuration (mongodb://openmole:rocks@localhost:27017/openmole?login).
You can launch the jetty server with your own URI:
```jshelllanguage
project server // in sbt mode
run mongodb://myuser:mypassword@myhost:myport/mydb?mycollection
```
You need to have a MongoDB running with the corresponding user declared in the *admin* database (by convention).
To run a mongoDB using docker (you need to forward the port):
```jshelllanguage
docker pull mongo
docker run --name some-mongo -d mongo -p 27017:27017
```
Then, create the user (openmole by defaut):
```jshelllanguage
mongo
use admin
db.createUser({ user: 'openmole', pwd: 'rocks', roles: [ { role: "userAdminAnyDatabase", db: "admin" } ] });
```
Then, browse [localhost:8080](localhost:8080)
\ No newline at end of file
......@@ -18,22 +18,14 @@ object Launcher extends App {
val mongoDBArguments = "mongoDBArguments"
val option = args.headOption
val mongoURI = new URI(option.getOrElse("mongodb://openmole:rocks@localhost:27017/openmole?login"))
println(mongoURI)
val mongoDB = {
println("TTTT userinfo = " + mongoURI.getUserInfo)
val userInfos = mongoURI.getUserInfo.split(':')
val user = userInfos(0)
val password = userInfos(1)
val host = mongoURI.getHost
println("TTTT host = " + host)
val port = mongoURI.getPort
println(port)
println("TTTT path=" + mongoURI.getPath)
val db = mongoURI.getPath.drop(1)
println("TTTT query=" + mongoURI.getQuery)
val dataSet = mongoURI.getQuery
//if (mongoURI.getHost== null || mongoURI.getHost.isEmpty) None
//else Some(MongoDB(host, port, db, dataSet))
MongoDB(user, password, host, port, db, dataSet)
}
val server = new Server(8080)
......
......@@ -45,7 +45,6 @@ class Servlet(mongoDB: MongoDB) extends ScalatraServlet with AuthenticationSuppo
findInMongo(User(login)).isDefined
}
def findInMongo(user: User) = {
val mongoData = getMongoData(user)
mongoData.collection.findOne(mongoData.userSession)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment