Skip to content

Latest commit

 

History

History
147 lines (104 loc) · 5.54 KB

deployment.md

File metadata and controls

147 lines (104 loc) · 5.54 KB

Release and Deploy

The whole stack consists of:

arc

infra

migration

release

  1. Merge everything you want to deploy to master
  2. Create a branch from master called v{version}. The version if of the form {arc_version}-v{migration_version}, for examle 0.0.1-rc.14-v5
  3. Change the version number in package.json and package-lock.json and commit the result
  4. Create a new release by running npm run prepare-release and npm run release. This will upload a new docker image to https://hub.docker.com/r/daostack/migration/tags
  5. Commit the changes and create a pull request.

Consult the https://github.com/daostack/migration/blob/master/README.md for further instructions.

deploy

npm run pre-release has options to deploy contracts to rinkeby and main net.

subgraph

release

  1. Merge everything you want to deploy into master
  2. Create a branch from master called v{version}. The version is of form X.Y.Z (i.e. normal semantic release version)
  3. Change the version number in package.json and package-lock.json and commit the result
  4. If there is a new migration version:
    1. change the @doastack/migration version in package.json to the new version, and run npm install.
    2. Change the ganache:image value in docker-compose.yml.
    3. Commit the results and make sure the tests pass on travis.
  5. Create a new release by running ./release.sh. This will upload new docker images to https://hub.docker.com/r/daostack/subgraph-postgres/tags and to https://hub.docker.com/r/daostack/subgraph-ipfs/tags . The tags of these docker images are of the form {ganache|..}-{migration-version}-{subgraph-version}.
  6. Commit the changes and create a pull request.

deploy

Deploy Subgraph

To deploy the subgraph, please follow the instructions below:

  1. If you are deploying to The Graph for the first time, start with installing the Graph CLI: npm install -g @graphprotocol/graph-cli Then follow this by logging into your Graph Explorer account using: graph auth https://api.thegraph.com/deploy/ <ACCESS_TOKEN>

It is also recommended to read this guide: https://thegraph.com/docs/deploy-a-subgraph

  1. Decide which version of the subgraph you want to deploy, and checkout the corresponding tag:

git checkout git checkout ganache-0.0.1-rc.19-v3-0.0.19

And install the package:

npm ci

  1. Create a .env file like the following:
network="rinkeby"
subgraph="v19"
ethereum_node="https://rinkeby.infura.io/v3/69b4a42f71a8446e8b167062e3d5e317"
postgres_password='letmein'
ipfs_port=5002
graph_node="http://localhost:8620"
ipfs_node="http://localhost:5002"
  1. Run: npm run deploy

where is what

TODO: use policy to publish subgraphs to https://rinkeby.subgraph.daostack.io/subgraphs/name/v${subgraph-version}, for example: https://rinkeby.subgraph.daostack.io/subgraphs/name/v0-0-6 (replace dots with dashes)

client

release

  1. Merge everything you want to deploy into master
  2. Create a branch from master called v{version}. The version is of form X.Y.Z (i.e. normal semantic release version)
  3. Make sure tests pass on travis
  4. If there is a new subgraph version:
  5. Update package.json and change
  6. Update version in package.json and package-lock.json desired version <version>
  7. Run npm i
  8. Commit your changes git ci package.json package-lock.json -m "publish version <version>"
  9. Create a git tag for this version: git tag <version_number> && git push --tag
  10. Publish the package on npmjs.org: npm publish

alchemy Server

  1. Merge everything you want to deploy into master
  2. Push to production: git push production master (assuming you have a git remote setup called production which points to the production Heroku server)
  3. heroku run node server/migrate.js --app=daostack-alchemy
  4. git tag <version_number>
  5. git push —tags

Alchemy Client (the frontend application)

https://github.com/daostack/alchemy

deploy to staging

The dev branch is automaticlly deployed to staging.

deploy to production

For production: we deploy from dev to production by:

  1. Make sure the settings (specifically graphqlHttpProvider and graphqlWSProvider are using the correct URLs)
  2. Merge dev into the master branch
  3. In heroku, do a manual deployment

Worst case deployment :-)

If the stack has changed (say a contract update) we need to run through the following steps:

  1. Update migration and create a new release and docker image
  2. Update subgraph with new latest migration and create a new release and docker images
  3. Update client with latest subgraph and docker images of the previous steps, and create a new release
  4. Update alchemy with latest client version
  5. To staging:
    1. Deploy contracts to Rinkeby
    2. Deploy subgraph to rinkeby.subgraph.daostack.io
    3. Update subgraph URL in the alchemy source code
    4. Commit and push to staging
  6. To Production:
    1. Deploy contracts to main net
    2. Deploy new subgraph to subgraph.daostack.io
    3. Update subgraph URL in the alchemy source code
    4. Commit and push to master