The teach.org publishing service for X-Ray Goggles and Thimble
NOTE: If you add any new dependencies to
package.json, make sure you are running npm version 5 or above before you run
npm install so that the
package-lock.json gets regenerated. Also make sure that you commit the
Installation and Use
- Clone the publish.webmaker.org repository
$ git clone https://github.com/mozilla/publish.webmaker.org.git
- Install the dependencies
$ npm install
If you also want to run the tests, install the lab testing utility globally
$ npm install -g lab
3a) Copy the distributed environment file via command line, or manually using a code editor:
$ npm run env OR, if you are on Windows $ COPY env.dist .env
- Create your postgres database, then run migrations and seeds.
$ createdb publish $ npm run knex
N.B. If you would like to create a custom name for your database, you may. However, you
will need to update the
DATABASE_URL env variable in the
.env file in order to
reflect that change.
$ npm install knex -g
Also note that subsequent test runs require an empty
publish database. Test runs will not automatically clear the database for you for data-integrity reasons, so you will need to either manually clear the tables using your preferred PostgreSQL administration utility, or drop and recreate the database:
$ dropdb publish $ createdb publish
- Run the server at the default log level (
$ npm start
The server's log level can be set in the environment or the .env file using
LOG_LEVEL=* with one of
If none is given
info is used.
- To run the style checker, use
npm run jscs.
- To run the hinter, use
npm run jshint.
- To run both, use
npm run lint.
This project uses
noxmox to allow for development without Amazon S3 credentials. By default emulation is turned on. To view published projects, the project runs a
mox-server for you that taps into the files that
noxmox writes to disk. Publish will store a reference to this server based on the
PUBLIC_PROJECT_ENDPOINT environment variable, which defaults to
To use an actual S3 bucket, ensure that the related environment variables are set to allow it:
# S3 publish/unpublish # (enter your own info plz) export AWS_ACCESS_KEY_ID="your_key" export AWS_SECRET_ACCESS_KEY="your_secret" export AWS_BUCKET="your_bucket" # S3 emulation export S3_EMULATION=false # Endpoint for published projects export PUBLIC_PROJECT_ENDPOINT="http://your-public-endpoint.com"
Exporting a project
If you need to export a project from the database (for debugging purposes for e.g.), you can do so by using the
scripts/export node command line utility provided.
You can run it using:
node scripts/export <project_id> [options]
[options] is replaced with the allowed configuration options for the export utility.
This will export the project as a tarball and also has the ability to generate a text file that contains details about the project.
For more documentation and a list of allowed options, run:
node scripts/export --help