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.
Development environment is configured using docker-compose.
First make sure to create your own .env:
cp .env.sample .envDocker 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-permissionsFinally, spin up docker containers with:
docker-compose up --build -d- Rest API is available at http://localhost:8000
- Grafana dashboard is available at http://localhost:5000
When finished remove the containers with:
docker-compose downDocker 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 packagesNote 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 -dLocal 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:clientTo update the dashboard, click Ctrl+S > Copy JSON to clipboard and overwrite the file in monitoring/grafana/provisioning/dashboards/ipfs-pinner.json.
For CI/CD we are using GitHub Actions.
Currently we have 3 workflows:
- For automated tests -> on every non-master commit
- For deploying to staging server -> on every commit in the
developmentbranch
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.
For pushing the Grafana dashboard on any change in development/master branch.