diff --git a/.gitignore b/.gitignore index 8ccc9d7..a57417d 100644 --- a/.gitignore +++ b/.gitignore @@ -65,6 +65,5 @@ system-user-*.json orbitdb ipfsdata .ipfsdata -ipfs-service-provider.sh !README.md diff --git a/README.md b/README.md index d5823cf..ce41258 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,10 @@ This project covers basic necessities of most APIs. ## Installation +### Development Environment + +A development environment will allow you modify the code on-the-fly and contribute to the code base of this repository. [PM2](https://www.npmjs.com/package/pm2) is recommended for running this code base as an IPFS Circuit Relay. + ```bash git clone https://github.com/Permissionless-Software-Foundation/ipfs-service-provider cd ipfs-service-provider @@ -44,6 +48,19 @@ npm install npm start ``` +### Production Environment + +The [docker](./production/docker) directory contains a Dockerfile for building a production deployment. However, there is currently [a bug](https://github.com/Permissionless-Software-Foundation/ipfs-service-provider/issues/38) preventing the Docker container from being used as a Circuit Relay. + +``` +docker-compose build --no-cache +docker-compose up -d +``` + +### Operation Notes + +- There is a memory leak in the version of js-ipfs. The app is currently configured to shut down every 8 hours to flush memory. It relies on a process manager like pm2, Docker, or systemd to restart the app after it shuts down, in order to ensure continuous operation. + ## Structure The file layout of this repository differs from the koa-api-boilerplate. Instead, it follows the file layout of [Clean Architecture](troutsblog.com/blog/clean-architecture). diff --git a/ipfs-service-provider.sh b/ipfs-service-provider.sh new file mode 100755 index 0000000..f6739fa --- /dev/null +++ b/ipfs-service-provider.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# Ports +export PORT=5001 # REST API port +export IPFS_TCP_PORT=5268 +export IPFS_WS_PORT=5269 + +#export ENABLE_CIRCUIT_RELAY=1 + +# Production database connection string. +#export DBURL=mongodb://localhost:27017/bch-service-dev + +export COORD_NAME=ipfs-serive-provider-generic +export MNEMONIC="churn aisle shield silver ladder swear hunt slim pen demand spoil veteran" + +export DEBUG_LEVEL=1 + +npm start