LaTeX to online interactive materials.
To set up a server on arch, one can as root
pacman -S nodejs npm git mongodb nginx redis
systemctl enable mongodb
systemctl start mongodb
systemctl enable nginx
systemctl start nginx
systemctl enable redis
systemctl start redis
and then as a regular user
git clone https://github.com/XimeraProject/server.git
cd server
npm install
To quickly set up a server using Ubuntu Linux 16.04 LTS (which is availble on AWS and a t2.small is sufficient), you can:
sudo apt-get install nginx mongodb libcurl4-gnutls-dev libgit2-dev
curl -sL https://deb.nodesource.com/setup_7.x -o nodesource_setup.sh
sudo bash nodesource_setup.sh
sudo apt-get install nodejs
sudo ln /usr/bin/nodejs /usr/bin/node
git clone https://github.com/XimeraProject/server.git
cd server
npm install
BUILD_ONLY=true npm install nodegit
If you want to install it on Windows, set 'Setting up a server on Windows' below.
-
Install
g++
,nodejs
andmongodb
on your computer (under Debian, may also neednodejs-legacy
package) -
Run an instance of mongo server:
mongod --dbpath <insert-your-path>
You may have to make the path. For example,
mkdir -p /tmp/data/db
mongod --dbpath /tmp/data/db
-
Fetch and unpack the sample database Unpack the tarball:
tar xfzv database.tar.gz
This creates a directory containing BSON and JSON files
-
Import the database into mongo:
mongorestore <path-to-db-directory-with-BSON-files>
-
Clone the repository:
git clone https://github.com/kisonecat/ximera
-
Create file
.env
with content:XIMERA_MONGO_URL=127.0.0.1 XIMERA_MONGO_DATABASE=test XIMERA_COOKIE_SECRET=thisismysecretcookieyoushouldchangethis COURSERA_CONSUMER_KEY=thisisacourserakey COURSERA_CONSUMER_SECRET=courserasecretkey LTI_KEY=myltikey LTI_SECRET=myltisecret GITHUB_WEBHOOK_SECRET=githubwebhooksecret
This file will be loaded by the dotenv
package.
Note that if you used a different database name, you should set XIMERA_MONGO_DATABASE to the name of your database.
-
Go into the
ximera
directory within thekisonecat
repository and usenpm
to install all other js scripts needed by the servercd <path-to-ximera> npm install (you may be required to answer a prompt or two) openssl genrsa -out private_key.pem 2048
If you are having trouble installing the canvas package and are on a Debian-based distribution, you can try sudo apt-get install libcairo2-dev libjpeg-dev libgif-dev
You should run gulp with the following commands
node ./node_modules/bower/bin/bower install
npm install
cd ../..
mkdir -p components/syntaxhighlighter/amd
node node_modules/requirejs/bin/r.js -convert components/syntaxhighlighter/scripts components/syntaxhighlighter/amd
-
Run the
ximera
serverapps.js
using:node app.js
-
View the
ximera
server in your web browser atlocalhost:3000
Before we get started, I must inform that I implemented a portable version of the server. You may need to make minor variations to the environment variables if you install it formally (meaning into the Windows registry).
-
Download the necessary programs.
- Download nodejs. I downloaded the Windows binary (.exe) version into my working directory. Choose 32-bit or 64-bit based on your system.
- Download mongodb. I downloaded the
zip
version portable version and decompressed it into a subfolder of my working directory, rather than themsi
installer. - Download the most recent version of npm and decompress it.
- Download the sample database. It will be a
.tar.gz
file. You will need to decompress it. I good utility to use is 7zip. This will create a folder calledtest
which should contain a bunch of.BSON
and.JSON
files.
-
Clone the ximera server repository by running
git clone https://github.com/kisonecat/ximera
in the command prompt in your working directory. An easy way to get to the command prompt from the windows file explorer is to hold down Shift and right click on the folder and select 'Open command window here'. -
Make a batchfile with the following lines.
:: change to wherever node.exe resides. Use %~dp0 for the path of the location of this batch file. SET NodejsPath=%~dp0 :: change to whereever npm.cmd resides. SET NPMPath=%~dp0 :: This is the folder where the mongod.exe file lives, within the mongdb directory. %~dp0 heads it off because it is a subfolder of %~dp0. SET MongoDBPath=%~dp0mongodb-win32-x86_64-2008plus-2.6.3\bin :: Implement these into the system path, for this session. SET Path=%path%%NodejsPath%;%NPMPath%;%MongoDBPath% SET XIMERA_MONGO_URL=127.0.0.1 SET XIMERA_MONGO_DATABASE=test SET XIMERA_COOKIE_SECRET=thisismysecretcookieyoushouldchangethis SET COURSERA_CONSUMER_KEY=thisisacourserakey SET COURSERA_CONSUMER_SECRET=courserasecretkey SET LTI_KEY=myltikey SET LTI_SECRET=myltisecret SET GITHUB_WEBHOOK_SECRET=githubwebhooksecret
-
Open the command window and run the following commands
- Run the batch file you created typing in the name of the batch file.
- Change to the ximera server folder:
cd ximera
- Run
npm install
to install all the other js scripts needed by the server. This will take a while. I get the error line:npm ERR! not ok code 0
. Just ignore it. - Run an instance of mongo as by running:
mongod --dbpath .
(dont forget the period)
-
Without closing that command window, open another one
- Run the batch file again.
- Import the test database into mongo by running:
mongorestore ./test/
, changing the path appropriately. The Windows UAC will pop up. You will need administrator access to bypass it. - Change to the ximera server folder:
cd ximera
- Run
app.js
:node app.js
. You will have another UAC pop up asking whether to give node public network access.
-
Open the browser and type in
localhost:3000
into the command line and you should get this:
The css files are missing (if you noticed, after you opened your browser, in the command window you got the error LESS file error : 'bootstrap.less' wasn't found
)