1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-11-13 16:54:53 +01:00
🧜‍♀️ THE Data Market
Go to file
2020-06-30 14:19:27 +02:00
.github refactor for Gatsby, update all the things 2020-06-30 11:28:49 +02:00
.storybook refactor for Gatsby, update all the things 2020-06-30 11:28:49 +02:00
api remove next.js from API routes 2020-06-30 13:00:16 +02:00
content front page cleanup 2020-06-30 13:43:02 +02:00
scripts first commit 2020-05-07 09:03:30 +03:00
src make Jest run 2020-06-30 14:19:27 +02:00
tests/unit make Jest run 2020-06-30 14:19:27 +02:00
.env.example transactions, job details 2020-06-02 12:15:21 +03:00
.eslintrc refactor Next.js pages into Gatsby pages 2020-06-30 12:56:50 +02:00
.gitignore refactor Next.js pages into Gatsby pages 2020-06-30 12:56:50 +02:00
.prettierrc make Gatsby start 2020-06-30 13:32:16 +02:00
.travis.yml make Gatsby start 2020-06-30 13:32:16 +02:00
gatsby-browser.js make global styles work 2020-06-30 13:39:48 +02:00
gatsby-config.js make Gatsby start 2020-06-30 13:32:16 +02:00
gatsby-node.js make Gatsby start 2020-06-30 13:32:16 +02:00
gatsby-ssr.js make global styles work 2020-06-30 13:39:48 +02:00
LICENSE first commit 2020-05-07 09:03:30 +03:00
package-lock.json make global styles work 2020-06-30 13:39:48 +02:00
package.json make global styles work 2020-06-30 13:39:48 +02:00
README.md refactor for Gatsby, update all the things 2020-06-30 11:28:49 +02:00
tsconfig.json make Gatsby start 2020-06-30 13:32:16 +02:00
vercel.json refactor for Gatsby, update all the things 2020-06-30 11:28:49 +02:00

banner

Ocean Marketplace

Build Status Now deployment Maintainability Test Coverage js oceanprotocol

Table of Contents

🤓 Resources

🏄 Get Started

The app is a React app built with Gatsby.js + TypeScript + CSS modules and will connect to Ocean components in Pacific by default.

To start local development:

git clone git@github.com:oceanprotocol/market.git
cd market

npm install
npm start

This will start the development server under http://localhost:8000.

To explore the generated GraphQL data structure fire up the accompanying GraphiQL IDE under http://localhost:8000/__graphql.

Local Spree components with Barge

If you prefer to connect to locally running components instead of remote connections to Ocean's network, you can spin up barge and use a local Spree network in another terminal before running npm start:

git clone git@github.com:oceanprotocol/barge.git
cd barge

# startup with local Spree node
./start_ocean.sh --no-commons

This will take some time on first start, and at the end you need to copy the generated contract artifacts out of the Docker container. To do so, use this script from the root of the app folder:

./scripts/keeper.sh

The script will wait for all contracts to be generated in the keeper-contracts Docker container, then will copy the artifacts in place into node_modules/@oceanprotocol/keeper-contracts/artifacts/.

Finally, set environment variables to use those local connections in .env in the app:

# modify env variables, Spree is enabled by default when using those files
cp .env.example .env

API

Files under /api are isolated and not part of Gatsby.

🦑 Environment variables

The ./src/config/ocean.ts file is setup to prioritize environment variables for setting each Ocean component endpoint. By setting environment variables, you can easily switch between Ocean networks the app connects to, without directly modifying ./src/config/ocean.ts.

For local development, you can use a .env file:

# modify env variables, Spree is enabled by default when using those files
cp .env.example .env

🎨 Storybook

Storybook is set up for this project and is used for UI development of components. Stories are created inside src/components/ alongside each component in the form of ComponentName.stories.tsx.

To run the Storybook server, execute in your Terminal:

npm run storybook

This will launch the Storybook UI with all stories loaded under localhost:4000.

Every deployment run will build and deploy the exported storybook under /storybook/, e.g. the current one matching master under https://dexfreight-ten.now.sh/storybook/.

Code Style

For linting and auto-formatting you can use from the root of the project:

# lint all js with eslint
npm run lint

# auto format all js & css with prettier, taking all configs into account
npm run format

👩‍🔬 Testing

Test suite for unit tests is setup with Jest as a test runner and:

To run all linting and unit tests:

npm test

For local development, you can start the test runner in a watch mode.

npm run test:watch

For analyzing the generated JavaScript bundle sizes you can use:

npm run analyze

🛳 Production

To create a production build, run from the root of the project:

npm run build
# serve production build
npm run serve

⬆️ Deployment

Every branch or Pull Request is automatically deployed by Vercel with their GitHub integration. A link to a deployment will appear under each Pull Request.

The latest deployment of the master branch is automatically aliased to xxx.

Manual Deployment

If needed, app can be deployed manually. Make sure to switch to Ocean Protocol org before deploying:

# first run
vercel login
vercel switch

# deploy
vercel
# switch alias to new deployment
vercel alias

🏗 Ocean Protocol Infrastructure

The following Aquarius & Brizo instances specifically for marketplace are deployed in Ocean Protocol's AWS K8:

Nile (Staging)

  • K8 namespace: market-nile
  • aquarius.nile.market.dev-ocean.com
  • brizo.nile.market.dev-ocean.com

Edit command with kubectl, e.g.:

kubectl edit deployment -n market-nile aquarius

Pacific (Production)

  • K8 namespace: market-pacific
  • aquarius.pacific.market.dev-ocean.com
  • brizo.pacific.market.dev-ocean.com

Edit command with kubectl, e.g.:

kubectl edit deployment -n market-pacific aquarius

🏛 License

Copyright 2020 Ocean Protocol Foundation Ltd.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.