From f0151e336cf9e80a24211b102d15bd3895a6a05b Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Fri, 16 Nov 2018 11:12:28 +0100 Subject: [PATCH 1/6] setup deployment --- .travis.yml | 3 +++ README.md | 20 ++++++++++++++++++ package.json | 3 ++- scripts/deploy.sh | 52 +++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 77 insertions(+), 1 deletion(-) create mode 100755 scripts/deploy.sh diff --git a/.travis.yml b/.travis.yml index cb673f33..55903909 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,9 @@ script: - npm test - 'if [ "$TRAVIS_SECURE_ENV_VARS" = "true" ]; then npm run build; fi' +after_success: + - npm run deploy + notifications: email: false diff --git a/README.md b/README.md index 7aa8cc53..cd3ad481 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ - [Linting & formatting](#linting--formatting) - [Editor setup: VS Code](#editor-setup-vs-code) - [GitHub GraphQL API](#github-graphql-api) +- [Deployment](#deployment) - [Authors](#authors) - [License](#license) @@ -271,6 +272,25 @@ query { } ``` +## Deployment + +Automatic deployments are triggered upon successful tests & builds on Travis: + +- push to `master` initiates a live deployment +- any Pull Request, and subsequent pushes to it, initiates a beta deployment + +The deploy command simply calls the [`scripts/deploy.sh`](scripts/deploy.sh) script, syncing the contents of the `public/` folder to S3: + +```bash +npm run deploy +``` + +Requires authorization against AWS with [one of the various ways](https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/setting-credentials-node.html), on Travis this is done with those environment variables: + +- `AWS_ACCESS_KEY_ID` +- `AWS_SECRET_ACCESS_KEY` +- `AWS_DEFAULT_REGION` + ## Authors - Troy McConaghy ([@ttmc](https://github.com/ttmc)) - [Ocean Protocol](https://oceanprotocol.com) diff --git a/package.json b/package.json index 66811ff1..0efa2159 100755 --- a/package.json +++ b/package.json @@ -18,7 +18,8 @@ "lint:md": "markdownlint './**/*.{md,markdown}' --ignore './{node_modules,external,public}/**/*'", "lint:yml": "prettier '**/*.{yml,yaml}' --list-different", "lint": "run-p --continue-on-error lint:js lint:css lint:md lint:yml", - "test": "npm run lint" + "test": "npm run lint", + "deploy": "./scripts/deploy.sh" }, "dependencies": { "@oceanprotocol/art": "^1.0.2", diff --git a/scripts/deploy.sh b/scripts/deploy.sh new file mode 100755 index 00000000..e8853bdb --- /dev/null +++ b/scripts/deploy.sh @@ -0,0 +1,52 @@ +#!/usr/bin/env bash +# +# required environment variables: +# AWS_ACCESS_KEY_ID +# AWS_SECRET_ACCESS_KEY +# AWS_DEFAULT_REGION +AWS_S3_BUCKET="docs.oceanprotocol.com" +AWS_S3_BUCKET_BETA="beta.docs.oceanprotocol.com" +SITEMAP_URL="https%3A%2F%2Fdocs.oceanprotocol.com%2Fsitemap.xml" + +# +set -e; + +function s3sync { + aws s3 sync ./public s3://"$1" --exclude "*.html" --exclude "*.xml" --cache-control max-age=31536000,public,immutable --delete --acl public-read --quiet + + aws s3 sync ./public s3://"$1" --exclude "*" --include "*.html" --include "*.xml" --cache-control max-age=0,no-cache,no-store,must-revalidate --delete --acl public-read --quiet +} + +## +## check for pull request against master +## +if [ "$TRAVIS_PULL_REQUEST" != "false" ] && [ "$TRAVIS_BRANCH" == "master" ]; then + + s3sync $AWS_S3_BUCKET_BETA + +## +## check for master push which is no pull request +## +elif [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] || [ "$TRAVIS" != true ]; then + + s3sync $AWS_S3_BUCKET + + # ping search engines + # returns: HTTP_STATUSCODE URL + # curl -sL -w "%{http_code} %{url_effective}\\n" \ + # "http://www.google.com/webmasters/tools/ping?sitemap=$SITEMAP_URL" -o /dev/null \ + # "http://www.bing.com/webmaster/ping.aspx?siteMap=$SITEMAP_URL" -o /dev/null + + echo "---------------------------------------------" + echo " ✓ done deployment " + echo "---------------------------------------------" + + exit; + +else + + echo "---------------------------------------------" + echo " nothing to deploy " + echo "---------------------------------------------" + +fi From a979a422069fb8b693b1487e0171c6688dbd9dac Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Fri, 16 Nov 2018 11:19:43 +0100 Subject: [PATCH 2/6] install awscli on Travis --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 55903909..ec49a2f2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,8 @@ script: - 'if [ "$TRAVIS_SECURE_ENV_VARS" = "true" ]; then npm run build; fi' after_success: + - pip install --user awscli + - export PATH=$PATH:$HOME/.local/bin - npm run deploy notifications: From 658f24cca60abb7c3f8016f30c1b332bb40f6474 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Fri, 16 Nov 2018 12:55:41 +0100 Subject: [PATCH 3/6] mention deployment urls in deployment --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index cd3ad481..a5ff4c71 100644 --- a/README.md +++ b/README.md @@ -277,7 +277,9 @@ query { Automatic deployments are triggered upon successful tests & builds on Travis: - push to `master` initiates a live deployment + -> [docs.oceanprotocol.com](https://docs.oceanprotocol.com) - any Pull Request, and subsequent pushes to it, initiates a beta deployment + -> [beta.docs.oceanprotocol.com](https://beta.docs.oceanprotocol.com) The deploy command simply calls the [`scripts/deploy.sh`](scripts/deploy.sh) script, syncing the contents of the `public/` folder to S3: From 9f45667a83b27a83827d6cf80634c71903a31c25 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Fri, 16 Nov 2018 13:12:52 +0100 Subject: [PATCH 4/6] intro update --- content/concepts/introduction.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/content/concepts/introduction.md b/content/concepts/introduction.md index a44f04a2..9bfefdab 100644 --- a/content/concepts/introduction.md +++ b/content/concepts/introduction.md @@ -15,15 +15,21 @@ Through blockchain technology and tokens, Ocean Protocol connects data providers By bringing together decentralized blockchain technology, a data sharing framework, and an ecosystem for data and related services, Ocean Protocol is committed to kick-starting a new Data Economy that touches every single person, company and device, giving power back to data owners, enabling people to reap value from data to better our world. +## Mission Statement + +Society is becoming increasingly reliant on data, especially with the advent of AI. However, a small handful of organizations with both massive data assets and AI capabilities attained worrying levels of control which is a danger to a free and open society. + +Ocean Protocol aims to unlock data, for more equitable outcomes for users of data, using a thoughtful application of both technology and governance. + ## Papers There are more details on the [Ocean Protocol home page](https://oceanprotocol.com/#papers), and in the whitepapers: -- [Technical Whitepaper](https://oceanprotocol.com/tech-whitepaper.pdf) -- [Business Whitepaper](https://oceanprotocol.com/business-whitepaper.pdf) -- [Reference Marketplace Framework](https://oceanprotocol.com/marketplace-framework.pdf) +- [Technical Whitepaper](https://oceanprotocol.com/tech-whitepaper.pdf) - This paper presents Ocean Protocol. Ocean is a decentralized protocol and network of artificial intelligence (AI) data/services. It incentivizes for a vast supply of relevant AI data/services. +- [Business Whitepaper](https://oceanprotocol.com/business-whitepaper.pdf) - This document presents a summary of the business model and ecosystem of Ocean Protocol. In addition, it describes the logic behind the Ocean utility token and the economic incentives driving the Protocol. It is complementary to the technical whitepaper for Ocean Protocol. +- [Marketplace Framework](https://oceanprotocol.com/marketplace-framework.pdf) - This document presents a summary of the core marketplace attributes and components required to facilitate the successful deployment of the decentralized data exchange protocol and network called Ocean Protocol. ## More Information From cb91917ca39a7ce928cfc71e32b9ca19232dc4ae Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Fri, 16 Nov 2018 13:17:47 +0100 Subject: [PATCH 5/6] remove test readme from aquarius --- content/concepts/components.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/concepts/components.md b/content/concepts/components.md index 17c967e6..527aa6da 100644 --- a/content/concepts/components.md +++ b/content/concepts/components.md @@ -11,7 +11,7 @@ Aquarius provides an API to an off-chain database ("OceanDB") to store and manag The off-chain database might be MongoDB, Elasticsearch or BigchainDB. - + ## Brizo From efc05d058dbdb12a85d93bbd50a6881449b0cc5a Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Fri, 16 Nov 2018 13:49:46 +0100 Subject: [PATCH 6/6] fix yaml frontmatter examples --- README.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 7aa8cc53..dbc70592 100644 --- a/README.md +++ b/README.md @@ -78,21 +78,25 @@ All Markdown files should use 1. The file must begin with a section called YAML frontmatter that looks like this: - ```yaml + ```md + --- title: This is the Title in Title Case description: A short description of the page. --- + Markdown content begins here. ``` For external documents in other repos, defining the `slug` and `section` is required: - ```yaml + ```md + --- title: This is the Title in Title Case description: A short description of the page. slug: /concepts/architecture/ section: concepts --- + Markdown content begins here. ``` @@ -101,8 +105,8 @@ All Markdown files should use 2. Don't include the page title or description in the Markdown section. That is, don't begin the Markdown content with `# This is the Title in Title Case`. Just write as if that were already there. 3. start your heading levels with `h2`, so `## My heading` 4. Internal links to other docs pages should be: - - to the _full absolute URL_, such as https://docs.oceanprotocol.com/hello/you-are-awesome/ or https://github.com/oceanprotocol/dev-ocean/blob/master/doc/development/style-guides.md or - to a absolute URL without the host, that looks like `/concepts/terminology/` with slashes on the beginning and end, and with no `.md` or `.html` at the end (before the last slash). + - when linking from external repos, to the _full absolute URL_, such as `https://docs.oceanprotocol.com/hello/you-are-awesome/` 5. no TOC please, this will be generated automatically from all headings 6. for images and media, you can keep them in the original repo. Images will be automatically grabbed by the docs site on querying. When doing that, docs site will generate all sorts of image sizes to handle proper responsive images, so no need to keep an eye on image dimensions or file sizes