Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
gate
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openmole
gate
Commits
85a1e847
Commit
85a1e847
authored
Dec 14, 2017
by
Julien Perret
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
documentation on how to run gate and a mongoDB (with docker)
parent
45d660d5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
10 deletions
+22
-10
README.md
README.md
+22
-1
Launcher.scala
server/src/main/scala/server/Launcher.scala
+0
-8
Servlet.scala
server/src/main/scala/server/Servlet.scala
+0
-1
No files found.
README.md
View file @
85a1e847
...
...
@@ -7,10 +7,31 @@ sbt
sbt> go
```
Then launch
e
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
server/src/main/scala/server/Launcher.scala
View file @
85a1e847
...
...
@@ -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
)
...
...
server/src/main/scala/server/Servlet.scala
View file @
85a1e847
...
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment