Skip to content

openhive-network/denser

Repository files navigation

Denser

Decentralized social media app for Hive Blockchain ⛓️ Successor to hive/condenser> aka hive.blog.

Introduction

The project consists of three apps:

  • auth
  • blog
  • wallet

Prerequisites

  • Node.js >= 20.0.0 & <21.0.0

If you have Volta installed, the 20.11.1 version of Node.js in pinned in the main package.json file.

Building

We are using pnpm for building the project. If you do not have pnpm, you can install it via

npm install -g pnpm

Next, you can run following commands install the dependencies and build the apps

pnpm install
pnpm run build

You can build the apps separately using commands:

pnpm run build:blog
pnpm run build:wallet
pnpm run build:auth

Running

The following commands start the blog app on port 3000, the wallet app on port 4000 and the auth app on port 5000:

pnpm run start:blog
pnpm run start:wallet
pnpm run start:auth

Testing

To run tests use the following commands:

pnpm run all:pw:test:local

You can run the test for only the blog or only the wallet apps using one of the following commands:

pnpm run blog:pw:test:local
pnpm run wallet:pw:test:local

Dockerisation

Build

To build Docker images use the following commands:

scripts/build_instance.sh --app-scope='@hive/auth' --app-path='/apps/auth' --app-name='auth' "$(pwd)"
scripts/build_instance.sh --app-scope='@hive/blog' --app-path='/apps/blog' --app-name='blog' "$(pwd)"
scripts/build_instance.sh --app-scope='@hive/wallet' --app-path='/apps/wallet' --app-name='wallet' "$(pwd)"

All the options available can be displayed by running scripts/build_instance.sh --help.

Startup

To start Docker images run the following commands:

scripts/run_instance.sh \
    --image="registry.gitlab.syncad.com/hive/denser/auth:latest" \
    --app-scope="@hive/auth" \
    --app-path="/apps/auth" \
    --api-endpoint="https://api.hive.blog" \
    --images-endpoint="https://images.hive.blog/" \
    --name="denser-auth" \
    --port=5000 \
    --detach
scripts/run_instance.sh \
    --image="registry.gitlab.syncad.com/hive/denser/blog:latest" \
    --app-scope="@hive/blog" \
    --app-path="/apps/blog" \
    --api-endpoint="https://api.hive.blog" \
    --images-endpoint="https://images.hive.blog/" \
    --name="denser-blog" \
    --port=3000 \
    --detach
scripts/run_instance.sh \
    --image="registry.gitlab.syncad.com/hive/denser/wallet:latest" \
    --app-scope="@hive/wallet" \
    --app-path="/apps/wallet" \
    --api-endpoint="https://api.hive.blog" \
    --images-endpoint="https://images.hive.blog/" \
    --name="denser-wallet" \
    --port=4000 \
    --detach

They will start the auth app on port 5000, the blog app on port 3000 and the wallet app on port 4000. The containers will delete themselves once stopped.

All the options available can be displayed by running scripts/run_instance.sh --help.

Alternatively, you can use the Composefile - ports will be the same as above:

pushd docker
docker compose up --detach

If you wish to change parameters (like API endpoints or ports) when using the Composefile, edit the accompanying .env file

To stop and delete the containers use command docker compose down.

SSL on development machine

You can put your server-key.pem and server-cert.pem into ./ssl directory (it is gitignored). Then you can use commands like npm run devssl:blog to start application on development server in SSL mode. Use mkcert or any other similar tool to generate server certificates. See also https://vercel.com/guides/access-nextjs-localhost-https-certificate-self-signed and issue #329.