/simulations

A repository for all our simulations

Primary LanguageJavaScriptGNU Affero General Public License v3.0AGPL-3.0

OpenStax Simulations

This repository holds all simulations that will be embedded into OpenStax textbooks.

Demo here

Building and Deploying

Pre-Build Setup:

  • First install node dependencies by running npm install.
  • Install grunt-cli globally by running npm install -g grunt-cli to make things simpler.

Building:

  • To build all the simulations and place their dist folders into a single top-level dist folder for serving, run grunt dist from the repository root.

Deploying

  • To build and deploy all simulations to github-pages, run grunt deploy.

Development

Hosting

The simulations can be hosted for development with any web host, but two options are documented here:

  1. Using Node.js
  2. Using Nginx

Both methods will create a server whose web root is this repository root; therefore, to access a specific simulation in dev mode, simply point your browser to

http://localhost:PORT/simulations/SIM-NAME/src

where PORT and SIM-NAME are replaced by appropriate values. Example:

http://localhost:8080/simulations/wave-interference/src

Node.js Hosting

  1. Follow the Pre-Build Setup under Building and Deploying
  2. Run grunt dev from the repository root.
  3. Open up http://localhost:8080 in your browser to view a list of simulations.

Nginx Hosting

  1. Install nginx

  2. Set up a virtual host pointing to your moving-man/src directory. You can follow a tutorial like this one, but when you get to the part where you're defining a server config, do something like this (replacing path-to-simulations appropriately):

     server {
       listen 8080;
       server_name $hostname;
       root /path-to-simulations/simulations/;
       index index.html;
       try_files $uri $uri/ /index.html;
     }
    
  3. Run sudo nginx to start the server.

  4. Open up http://localhost:8080 in your browser to view a list of simulations.

License

This software is subject to the provisions of the GNU Affero General Public License Version 3.0 (AGPL). See license.txt for details. Copyright (c) 2013 Rice University.