JavaScript TypeScript Other
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.circleci set to build from master Mar 12, 2018
.vscode [dev] Make yarn tsc pass, by fixing small typescript errors and movin… Jul 12, 2018
bin switch cache to memcached driver Jun 13, 2018
docs Initial attempt in adding connection to exchange Jun 19, 2018
hokusai add ./scripts/run-goreplay.sh and use env vars GOREPLAY_PORT and GORE… Aug 15, 2018
patches [package] Upgrade to graphql-js 0.13 Feb 8, 2018
scripts bugfix in scripts/create-heapsnapshot.sh Aug 16, 2018
src Add artworksConnection to notification bundles, for use in grid compo… Aug 17, 2018
.babelrc Remove rewire May 2, 2018
.dockerignore update .dockerignore Feb 28, 2018
.env.example Merge branch 'master' into add-stress Jun 22, 2018
.env.test Rename remaining stresses :) Jun 26, 2018
.eslintignore Implement node interface for message type Jun 26, 2017
.eslintrc.json tweaked rules, fixed warning Jun 5, 2018
.gitignore add appmetrics resourceRegistry.log to .gitignore Jun 18, 2018
.nvmrc Strengthen the Typing around APIs/loaders Oct 7, 2017
Dockerfile update to Dockerfile - chown mc binary to deploy user Aug 16, 2018
LICENSE license file Nov 20, 2015
Procfile.dev switch cache to memcached driver Jun 13, 2018
README.md Simplify access token retrieval instructions Aug 14, 2018
dangerfile.ts Adds danger local to the commit hook, and uses fail instead Jul 16, 2018
global.d.ts [persisted queries] Lookup queries in JSON as initial implementation. Apr 9, 2018
index.js [dev] Make sure app is fully started on initial request. Aug 16, 2018
package.json Removes the danger check on a push Jul 27, 2018
redis.conf [cache] Switch from memcache to redis to get rid of memjs. Feb 15, 2018
tsconfig.json WIP on typing the loader Mar 27, 2018
wallaby.js Update and wrap up May 2, 2018
yarn.lock Merge master Jul 25, 2018

README.md

Metaphysics CircleCI

Metaphysics is a GraphQL-compliant API that wraps various Artsy APIs. You can try it here against our staging API.

It is built on express, express-graphql, and graphql. With graphiql providing a sandbox to work with.

It is currently used in production all over the place in Artsy.net, and the Artsy iOS App

Meta

Getting Setup

Read and run setup script:

$ cat bin/setup
$ bin/setup

Set up your .env file based on .env.example. For Artsy staff, grab the keys/secrets from 1Password.

Docker and Kubernetes setup

  • Install Docker for Mac and Hokusai

    $ brew tap caskroom/cask && brew cask install docker
    $ pip install hokusai
    

    If you are using your system Python distribution, you may need to run this as:

    $ sudo pip install hokusai --ignore-installed
    
  • Configure Hokusai

    $ export AWS_ACCESS_KEY_ID={{ MY_AWS_ACCESS_KEY_ID }}
    $ export AWS_SECRET_ACCESS_KEY={{ MY_AWS_SECRET_ACCESS_KEY }}
    $ hokusai configure --kubectl-version {{ kubectl_version }} --s3-bucket {{ kubectl_config_s3_bucket }} --s3-key {{ kubectl_config_s3_key }}
    $ hokusai check
    

    Artsy staff should find follow the instructions in https://github.com/artsy/potential/blob/master/platform/Kubernetes.md#hokusai

Development

To start up a development server, run:

yarn install
npm run dev

Setting up your local GraphiQL

We recommend the graphiql.app client for testing queries locally.

You will need to set up headers with both:

  • x-access-token - Evaluate sd.CURRENT_USER.accessToken in a dev console on staging.artsy.net (sign in first, obvs).
  • x-user-id - As above, but sd.CURRENT_USER.id.

Testing

  • Run tests in the Docker Compose test stack via Hokusai:

    $ hokusai test
    
  • Or, to run tests locally: npm test to run the entire suite npm run watch to spin up the test watcher

Docs

Deployment

PRs merged to the master branch are automatically deployed to staging. The release on staging can be promoted to production via the command hokusai pipeline promote. See Hokusai's docs on the Staging -> Production pipeline for more details.

Interacting with the staging and production deployments

Use hokusai staging commands to interact with the staging environment.

Use hokusai production commands to interact with the production environment.