Git Product home page Git Product logo

precog's Introduction

Precog

Previously known as Git-Jekyll Preview.

Preview your static websites built with CircleCI before making them live. Use it to check your plain static or Jekyll-generated websites before you make them live to Github Pages or to your own server. Requires configured and working CircleCI artifacts.

Try it live at precog.mapzen.com.

Basic Usage

  1. Add your repo to CircleCI using Add Projects button at https://circleci.com/dashboard.

  2. Edit circle.yml to generate build artifacts and help Precog find them:

    • Tell CircleCI where to find a directory of statically-built files. For example, Jekyll creates a _site folder by default:

      general:
        artifacts:
          - "_site"
      

      Precog will look only in the first named directory. Try to include an index.html.

    • Alternatively, copy all statically-built files to $CIRCLE_ARTIFACTS directory after tests are complete:

      test:
        override:
          - make dist
          - cp -Lr dist $CIRCLE_ARTIFACTS/
      

To have Precog populate Github pull requests with direct links to previews, see Using Webhooks below.

Status, Contact

Precog is mostly a singleton-app, built only to be run at a single location. For the time being, it's not intended for general redeployment but improvements for precog.mapzen.com are welcomed.

Michal Migurski is currently maintainer.

Install

The application is a Flask-based Python server. OAuth is used for authentication; put your client ID and secret in environment variables GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET, and your CircleCI developer key in CIRCLECI_TOKEN.

To run for testing:

python make-it-so.py

To run in production, with Gunicorn:

gunicorn make-it-so:app

Using Webhooks

Precog can accept push and pull requests from Github to generate direct links to commit previews for you, and show them as a successful status check in Github’s pull request interface:

screenshot of webhook results in use

This must be enabled separately for each repository, and requires a Github personal access token to write results back to the Github Status API.

  1. Generate a personal access token that Precog will use to update statuses in your repository. Give it a descriptive name like “Precog Status Updates: {repo name}” so you can figure out what it is later. Give it repo scope access.

  2. Make a random alphanumeric secret that will ensure only requests from the right repository will be acted on. PasswordsGenerator.net is a good place to make random secrets.

  3. Add or update configuration settings in Precog’s environment variables, each called WEBHOOK_CONFIG_{something} and containing settings for each repository Precog should listen for:

     WEBHOOK_CONFIG_blog: mapzen/blog:xxy:xyx
     WEBHOOK_CONFIG_style: mapzen/styleguide:xyy:yxx
     WEBHOOK_CONFIG_yours: {your repo}:{secret}:{token}
    

    Currently, this must be done by talking to Lou or Mike.

  4. Add a webhook to the Github repository, using the payload URL https://precog.mapzen.com/hook, the secret from earlier, and the application/json content type. Send just the Pull Request and Push events.

precog's People

Contributors

migurski avatar mcfunley avatar ajb avatar daguar avatar

Watchers

 avatar 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.