From a037646acaec8f6d3f7a17ab6219177a58cefca2 Mon Sep 17 00:00:00 2001 From: Chris Troutner Date: Fri, 17 Sep 2021 11:17:10 -0700 Subject: [PATCH 1/2] fix(startup script): Added startup script --- .gitignore | 1 - README.md | 17 +++++++++++++++++ ipfs-service-provider.sh | 18 ++++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100755 ipfs-service-provider.sh 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 From 86283195c5a23a27d99c232bbbbf861e44d4d424 Mon Sep 17 00:00:00 2001 From: Chris Troutner Date: Fri, 17 Sep 2021 11:18:26 -0700 Subject: [PATCH 2/2] slight tweek to README --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ce41258..9c7d777 100644 --- a/README.md +++ b/README.md @@ -43,9 +43,10 @@ A development environment will allow you modify the code on-the-fly and contribu ```bash git clone https://github.com/Permissionless-Software-Foundation/ipfs-service-provider cd ipfs-service-provider +./install-mongo-sh sudo npm install -g node-pre-gyp npm install -npm start +./ipfs-service-provider.sh ``` ### Production Environment