Skip to content

Latest commit

 

History

History
94 lines (63 loc) · 2.65 KB

README.md

File metadata and controls

94 lines (63 loc) · 2.65 KB

IPFS Pinner

This service provides a blockchain-based authentication wrapper for ipfs requests.

This is a mono-repo with the following packages:

  • client: Client library for integrating into other projects.
  • server: Exposes the REST API.
  • shared: Libraries shared among other sub-repos.
  • worker: Background worker for veryfing and cleaning uploaded files.

Local Docker setup

Development environment is configured using docker-compose.

First make sure to create your own .env:

cp .env.sample .env

Docker setup includes a Grafana dashboard for logs and metrics, which requires a Docker plugin:

docker plugin install  grafana/loki-docker-driver:latest --alias loki --grant-all-permissions

Finally, spin up docker containers with:

docker-compose up --build -d

When finished remove the containers with:

docker-compose down

Development and testing

Docker compose is set up using nodemon with some local volume mounts for quicker development (src, test and shared/build, see docker-compose.yaml for details)

Repos can be built locally using:

yarn lerna bootstrap
yarn build:shared # shared only
yarn build        # all packages

Note that nodemon cannot pick up changed files from shared sub-repo after yarn build:shared, so you need to restart the containers:

docker-compose down
docker-compose up -d

Local tests can then be run using:

docker-compose exec test yarn test:server
docker-compose exec test yarn test:worker
docker-compose exec test yarn test:client

Grafana dashboard updates

To update the dashboard, click Ctrl+S > Copy JSON to clipboard and overwrite the file in monitoring/grafana/provisioning/dashboards/ipfs-pinner.json.

CI/CD

For CI/CD we are using GitHub Actions.

Currently we have 3 workflows:

1. Staging CI/CD

  • For automated tests -> on every non-master commit
  • For deploying to staging server -> on every commit in the development branch

2. Production CI/CD

For automated tests and deploying to production when creating v* tags in the master branch.

Deployments can be triggered using lerna:

yarn lerna version [ major | minor | patch ]

Note that publishing to NPM requires adding NPM_TOKEN with Publish permission in repo secrets.

3. Dashboard CI/CD

For pushing the Grafana dashboard on any change in development/master branch.