GithubHelp home page GithubHelp logo

abought / jam-setup Goto Github PK

View Code? Open in Web Editor NEW

This project forked from samchrisinger/jam-setup

0.0 3.0 0.0 10 KB

A basic script for bootstrapping JamDB namespaces and collections.

License: Apache License 2.0

JavaScript 100.00%

jam-setup's Introduction

Description and Usage

This is a pretty minimal set of scripts for creating new namespaces and collections in JamDB.

Getting a token

Creating a new namespace requires a special token that needs to be generated via the jam CLI on the JamDB server itself. Running: jam token system-system-system will create a jwt (expires in 3 hours) that can be used in the steps below.

Run cp config/default.yml config/local.yml to create a local settings file. This gives something like:

stage:
  JAM_TOKEN: CHANGEME
  JAM_URL: https://staging-metadata.osf.io
  COLLECTIONS_PATH: ./collections.js

prod:
  JAM_TOKEN: CHANGEME
  JAM_URL: https://metadata.osf.io
  COLLECTIONS_PATH: ./collections.js

You'll need to replace the value of JAM_TOKEN with the token generated above (for the appropriate environment).

collections.js

The exports of this module will be module be used to determine which collections will be created under the bootstrapped namespace. This file should be structured like:

module.exports = [{
    id: 'experiments',
    attrs: {
         // optional: state: 'mongo',
         // optional: schema: {},
         permissions: {
              '*': READ
         }
    }
}, ...
];

Adding the state field will allow you to specify which backend JamDB will use for a given collection (generally this is not needed!).

Adding the schema attribute will allow you to provided a JSON Schema that JamDB will use to validate all new and updated documents.

Running

First: npm install

Open a node.js shell (node) run:

> var Client = require('./client.js');
undefined
> var client = new Client(<your_environment>);
undefined
> client.bootstrap(<your_namespace>, 'user-osf-<your-osf-guid>');

jam-setup's People

Contributors

abought avatar samchrisinger avatar

Watchers

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