GithubHelp home page GithubHelp logo

wardpeet / jsperf.com Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jsperf/jsperf.com

0.0 2.0 0.0 495 KB

jsperf.com v2. https://github.com/h5bp/lazyweb-requests/issues/174

JavaScript 85.43% Shell 0.49% Nginx 0.26% CSS 3.58% HTML 10.25%

jsperf.com's Introduction

jsperf.com

Build Status Test Coverage Code Climate

Chat on irc.freenode.net in the #jsperf channel.

How to run a local copy of jsPerf for testing/debugging

Prerequisites

  1. Clone the repository: git clone https://github.com/jsperf/jsperf.com.git
  2. Use the version of node for this project defined in .nvmrc: nvm install (More on nvm)
  3. Install dependencies: npm install
  4. Get a Browserscope.org API key by signing in and going to the settings page. (You'll need this in the last step)
  5. Register a new OAuth GitHub development application by going to your settings page in github. Take note to copy the "Client ID" and "Client Secret". The callback URL is simply the root url of the application, e.g., http://localhost:3000
  6. Setup environment configuration: npm run setup

Running the server

Docker

One-time Setup
  1. Install Docker Toolbox so you have docker and docker-compose
  2. Create a Data Volume Container to persist data: docker create -v /var/lib/mysql --name data-jsperf-mysql mysql /bin/true
  3. After completing the "Compose" steps below, setup database tables with: docker-compose run web node /code/setup/tables
Compose

docker-compose.yml orchestrates a load balancer (nginx), the app (this node project), and a database (mysql) with some additional services to help with continuous deployment. To start everything up, run: MYSQL_PASSWORD=$MYSQL_PASSWORD docker-compose up. Pressing ctrl+c or sending a similar interruption will stop all of the containers. To run the composed containers in the background, use the -d argument.

You can start additional app containers by running docker-compose scale web=3 where 3 is the total number of containers. The load balancer will automatically reconfigure itself to include the new containers. Similarly, you can scale down the containers by running docker-compose scale web=1 and the load balancer will, again, reconfigure itself accordingly.

Once you've built the images with docker-compose, you can manually run additional containers similar to how docker-compose scale would.

docker run -d --name jsperfcom_web_man \
--link jsperfcom_db_1:db \
--env-file .env \
--env SERVICE_3000_CHECK_HTTP=/health \
--env SERVICE_3000_CHECK_INTERVAL=1s \
jsperfcom_web

Local

You’ll need node.js and MySQL installed.

npm start

Testing

We use lab as our test utility and code as our assertion library. Lab lints with eslint using the semistandard style. 100% code coverage by unit tests is required. To run the test suite:

# everything
npm test

# directory
npm test -- test/server/web

# file
npm test -- test/server/web/contributors/index.js

If you'd just like to lint and save a little time, you can run npm run lint which skips the tests.

If you're missing code coverage, open coverage.html in the root of the project for a detailed visual report.

Gotchas

  • ES6 Template Strings are not supported by esprima which means you can't generate coverage reports which means npm test won't pass.

Debugging

If you'd like extra debugging information when running the server, run with the DEBUG environment variable set to * for everything including dependencies or jsperf* for only this project's debugging statements.

DEBUG=jsperf* npm start

To add more debugging, require the debug module and namespace according to the path to the file. For example, if you want to add debugging information in server/web/errors, the debug name would be jsperf:web:errors. This allows you to finely tune which debug statements you turn on.

To only turn on web debug statements and not services:

DEBUG=jsperf:web* npm start

jsperf.com's People

Contributors

maxbeatty avatar asilluron avatar mathiasbynens avatar jdalton avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.