#Deployment
##Before deployment
- Install nodejs v5.xx.xx
- Install iisnode for IIS 7.x/8.x: x86 or x64
- Install URL Rewrite for IIS
- Install Mongo DB 2.6.7 (or latest)
##Deployment
-
Run Mongo DB as win service
-
Create "statements" and "results" collection within "lrs" DB.
use lrs db.createCollection("statements"); db.createCollection("results");
-
Create indexes for most frequently used filter properties:
use lrs db.statements.ensureIndex({ "context.extensions.http://easygenerator/expapi/course/id" : 1}); db.statements.ensureIndex({ "context.extensions.http://easygenerator/expapi/learningpath/id" : 1}); db.statements.ensureIndex({ "verb.id" : 1}); db.statements.ensureIndex({ "context.registration" : 1}); db.results.ensureIndex({ "id" : 1, "last_activity": -1 }); db.results.ensureIndex({ "attempt_id" : 1 });
-
Clone this Git repository locally
-
Run
npm install
in the root -
Create
web.config
file in the root to register iisnode module as a handler for ourapp.js
file and to configure URL rewriting module:<configuration> <system.webServer> <handlers> <add name="iisnode" path="app.js" verb="*" modules="iisnode" /> </handlers> <rewrite> <rules> <rule name="lrsApp"> <match url="/*" /> <action type="Rewrite" url="app.js" /> </rule> </rules> </rewrite> <defaultDocument enabled="true"> <files> <add value="app.js" /> </files> </defaultDocument> <httpErrors existingResponse="PassThrough"></httpErrors> </system.webServer> <appSettings> <add key="IP" value="127.0.0.1" /> <add key="PORT" value="80" /> </appSettings> </configuration>
-
Create 'iisnode.yml' file in the root to override default node run options and to specify
--harmony
flagnodeProcessCommandLine: node.exe --harmony #full path can be used here as well
-
Copy folder to the server (without
.git
andpackage.json
:)) -
Create Web site in IIS and add corresponding site bindings and permissions
-
To generate results into results collection from existing data in statements collection install "co" module via npm and run:
node migration/exec.js
If your mongodb instance is hosted under a non-default location, set the DBHOST
and DBNAME
environment variables, and the lrs will connect to mongodb://${DBHOST}/${DBNAME}
instead.
For example, in the IIS config, simply add <app key="DBHOST" value="..." />
and <app key="DBNAME" value="..." />
to the <appSettings>
element.
Image available at https://hub.docker.com/r/janeklb/easygenerator-lrs/ Requires separate mongodb instance.