Skip to content

Latest commit

 

History

History
109 lines (59 loc) · 3.84 KB

installing.md

File metadata and controls

109 lines (59 loc) · 3.84 KB

Installing and running PrairieLearn

Method 1: Docker with built-in PrairieLearn

This is the easiest way to get started.

  1. Install Docker. Note that on Windows there are several versions of Docker available, depending on which Windows version you have. You might also need to enable virtualization in the BIOS.

  2. Run PrairieLearn with:

     docker run -it --rm -p 3000:3000 prairielearn/prairielearn
    

    This will run PrairieLearn with the example course.

  3. Open a web browser and connect to http://localhost:3000/pl

  4. When you are finished with PrairieLearn, type Control-C on the commandline where your ran the server to stop it.

  5. To use your own course, point Docker to the correct directory (replace the precise path with your own):

     docker run -it --rm -p 3000:3000 -v C:\GitHub\pl-tam212:/course prairielearn/prairielearn
    

    or

     docker run -it --rm -p 3000:3000 -v /Users/mwest/git/pl-tam212:/course prairielearn/prairielearn
    

    If you are using Docker for Windows then you will need to first give Docker permission to access the C: drive (or whichever drive your course directory is on). This can be done by right-clicking on the Docker "whale" icon in the taskbar, choosing "Settings", and granting shared access to the C: drive.

    If you're in the root of your course directory already, you can substitute %cd% (on Windows) or $PWD (everything else) for /path/to/course.

Upgrading PrairieLearn with Docker

To obtain the latest version of PrairieLearn at any time, run:

docker pull prairielearn/prairielearn

After this, run PrairieLearn using the same commands as above.

Running Commands in Docker

If needed, you can run the container with a different command:

docker run -it --rm -p 3000:3000 -v /path/to/course:/course prairielearn/prairielearn COMMAND

This can be used to, e.g., run scripts distributed with PrairieLearn.

Method 2: Docker with local copy of PrairieLearn

If you want to do development of PrairieLearn itself (not just question writing), then you'll need a local copy of PrairieLearn.

  1. Clone PrairieLearn from the main repository:

     git clone https://github.com/PrairieLearn/PrairieLearn.git
    
  2. Run it with:

     docker run --rm -p 3000:3000 -v /path/to/PrairieLearn:/PrairieLearn prairielearn/prairielearn
    

Method 3: Fully local installation

To install PrairieLearn locally you should:

  1. Install the pre-requisites:

On OS X these can be installed with MacPorts or Homebrew. On Linux these should all be standard packages from the OS distrbution.

Note that with MacPorts you need to select the active version of PostgreSQL, for example port select postgresql postgresql96.

  1. Clone the latest code:

     git clone https://github.com/PrairieLearn/PrairieLearn.git
    
  2. Install the backend libraries:

     cd PrairieLearn
     npm install
    
  3. Create the database (one time only):

     initdb -D ~/defaultdb
    
  4. Run the database:

     pg_ctl -D ~/defaultdb -l ~/logfile start
    
  5. Create the file PrairieLearn/config.json with the path of your local course repository:

     {
         "courseDirs": [
             "/Users/mwest/git/pl-tam212",
             "exampleCourse"
         ]
     }
    
  6. Run the server:

     cd PrairieLearn
     node server
    

    This should end with PrairieLearn server ready and will remain running in the foreground, so this terminal can't be used for anything else. Stopping or restarting the server can be done with Crtl-C.

  7. In a web-browswer go to http://localhost:3000/pl