• This repository has been archived on 15/Oct/2022
  • Stars
    star
    239
  • Rank 168,763 (Top 4 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 7 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A Dat-hosting service for multiple users

Hashbase

Hashbase is a public peer service for Dat archives. It provides a HTTP-accessible interface for creating an account and uploading Dats. It was created to power a content-community for the Beaker Browser

Links:

Setup

On some platforms, you will need to have the following dependencies installed:

make
g++
python
autoconf
libtool

Clone this repository, then run

npm install
cp config.defaults.yml config.development.yml

Modify config.development.yml to fit your needs, then start the server with npm start.

Configuration

Before deploying the service, you absolutely must modify the following config.

Basics

dir: ./.hashbase              # where to store the data
brandname: Hashbase           # the title of your service
hostname: hashbase.local      # the hostname of your service
proxy: true                   # is there a reverse proxy (eg nginx) in front of the server?
port: 8080                    # the port to run the service on
rateLimiting: true            # rate limit the HTTP requests?
csrf: true                    # use csrf tokens?
defaultDiskUsageLimit: 100mb  # default maximum disk usage for each user
defaultNamedArchivesLimit: 25 # how many names can a user take?
bandwidthLimit:
  up: 1mb                     # maximum bytes/s upload speed
  down: 1mb                   # maximum bytes/s download speed

Lets Encrypt

You can enable lets-encrypt to automatically provision TLS certs using this config:

letsencrypt:
  debug: false          # debug mode? must be set to 'false' to use live config
  agreeTos: true
  email: '[email protected]'  # email to register domains under

If enabled, port will be ignored and the server will register at ports 80 and 443.

Admin Account

The admin user has its credentials set by the config yaml at load. If you change the password while the server is running, then restart the server, the password will be reset to whatever is in the config.

admin:
  email: '[email protected]'
  password: myverysecretpassword

HTTP Sites

Hashbase can host the archives as HTTP sites. This has the added benefit of enabling dat-dns shortnames for the archives.

sites: per-archive

This will host archives at archivename.hostname. By default, HTTP Sites are disabled.

Closed Registration

For a private instance, use closed registration with a whitelist of allowed emails:

registration:
  open: false
  allowed:
    - [email protected]
    - [email protected]

Reserved Usernames

Use reserved usernames to blacklist usernames which collide with frontend routes, or which might be used maliciously.

registration:
  reservedNames:
    - admin
    - root
    - support
    - noreply
    - users
    - archives

Monitoring

pm2: false         # set to true if you're using https://keymetrics.io/
alerts:
  diskUsage: 10gb  # when to trigger an alert on disk usage

Session Tokens

Hashbase uses Json Web Tokens to manage sessions. You absolutely must replace the secret with a random string before deployment.

sessions:
  algorithm: HS256                # probably dont update this
  secret: THIS MUST BE REPLACED!  # put something random here
  expiresIn: 1h                   # how long do sessions live?

Jobs

Hashbase runs some jobs periodically. You can configure how frequently they run.

# processing jobs
jobs:
  popularArchivesIndex: 30s  # compute the index of archives sorted by num peers
  userDiskUsage: 5m          # compute how much disk space each user is using
  deleteDeadArchives: 5m     # delete removed archives from disk

Cache sizes (advanced)

You can tweak hashbase's memory usage to trade speed against memory usage.

# cache settings
cache:
  metadataStorage: 65536   # number of memory slots
  contentStorage: 65536    # number of memory slots
  tree: 65536              # number of memory slots

Emailer

Hashbase relies on NodeMailer to send out mails (for example: required to verify a new user). The email property of the configuration will be passed as-is to NodeMailer.

In the default configuration we use the stub transport which offers a code API for tests.

# email settings
email:
  transport: stub
  sender: '"Hashbase" <[email protected]>'

hashbase has a dependency on the ses and smtp transport, which means you can use those out-of-the-box. For other transports you need to install those first.

Tests

Run the tests with

npm test

To run the tests against a running server, specify the env var:

REMOTE_URL=http://{hostname}/ npm test

License

MIT

More Repositories

1

beaker

An experimental peer-to-peer Web browser
JavaScript
6,750
star
2

homebase

Self-deployable tool for hosting hyper:// websites
JavaScript
406
star
3

webdb

The Web is your database.
JavaScript
399
star
4

fritter

A peer-to-peer social feed app. (proof of concept)
JavaScript
364
star
5

dathttpd

Replaced by Homebase! See https://github.com/beakerbrowser/homebase.
JavaScript
280
star
6

explore

A curated list of peer-to-peer websites and apps
HTML
181
star
7

unwalled.garden

Schemas for a p2p social-media network built on the Dat Web.
HTML
131
star
8

dat-photos-app

A peer-to-peer photos app
JavaScript
86
star
9

libfritter

Methods for Fritter, a Dat-based Twitter clone
JavaScript
47
star
10

beaker-core

Beaker browser's core software [outdated]
JavaScript
45
star
11

pauls-dat-api

Library of functions that make working with dat / hyperdrive easier.
JavaScript
44
star
12

beaker.social

A social networking app built on Beaker's unwalled.garden open standards.
JavaScript
40
star
13

bkr

Beaker headless runtime for the hyper:// space network.
JavaScript
39
star
14

beakerbrowser.com

Source code for https://beakerbrowser.com
HTML
39
star
15

dat-node

A toolkit for writing Dat-based services in nodejs
JavaScript
37
star
16

dat-rssreader-app

Read RSS feeds for blogs hosted over dat://
JavaScript
25
star
17

dat-archive-map-reduce

Index files in Dat archives with map-reduce to create queryable data views.
JavaScript
23
star
18

beaker.dev

Developer portal for templates, tutorials, and news
JavaScript
19
star
19

dat-pinning-service-client

Client API for Dat pinning services
JavaScript
14
star
20

social

Peer-to-peer social media
JavaScript
13
star
21

dat-ephemeral-ext-msg

Methods for DEP-0000: Ephemeral Message (Extension Message)
JavaScript
11
star
22

beaker-profiles-api

An API for reading and writing profile archives as used by Beaker.
JavaScript
11
star
23

beaker-browser.gitbook.io

This repo mirrors the content in beaker-browser.gitbook.io
11
star
24

dat-editor-app

A simple but well-featured code editor
JavaScript
11
star
25

beaker.network

A social aggregator application
JavaScript
10
star
26

docs.beakerbrowser.com

Beaker Browser documentation site
JavaScript
9
star
27

p2p-web-workshop

A collection of resources for running a peer-to-peer Web workshop
9
star
28

hyperdrive.network

An application for viewing and modifying Hyperdrives. Requires a Hyperdrive-enabled browser.
JavaScript
9
star
29

webterm

Specs and discussions for the Webterm environment
9
star
30

userlist

A simple service for listing your profile drive under your Twitter username.
JavaScript
8
star
31

beaker-uplink

Peer-to-peer bookmark sharing.
JavaScript
8
star
32

beaker-sidebar-app

Web application that drives Beaker's sidebar view
JavaScript
8
star
33

beaker-editor-app

In-browser editor application.
JavaScript
8
star
34

dat-legacy-tools

Tools to access legacy dats stored in Beaker
JavaScript
7
star
35

pauls-dat-api2

DatArchive implementation for Dat 2.0
JavaScript
7
star
36

beaker-reader

Publish and read blogposts.
JavaScript
7
star
37

dat-wysiwywiki-app

A wiki app with a wysiwyg interface
JavaScript
7
star
38

beaker-compare-app

A builtin app for comparing, diffing, and merging two dats
JavaScript
6
star
39

pauls-hyper-mirror

A simple seeding servce
JavaScript
6
star
40

beaker-user-website-template

The template for new user websites.
JavaScript
5
star
41

beaker-library-app

The Beaker "Library" app
JavaScript
5
star
42

beaker.cloud

An open-source dat server that scales
5
star
43

record-protocols-spec

(Dead Spec) A standard for building interoperable applications on the Web.
5
star
44

pauls-embedded-analytics

A sqlite-backed embedded analytics module for nodejs.
JavaScript
5
star
45

beaker-search-app

The Beaker "Search" app
JavaScript
5
star
46

beaker-virtual-fs

An object-oriented files interface used by Beaker to render the user's filesystem
JavaScript
5
star
47

dat-serve-resolve-path

Beaker's method to find the file to serve in dat:// requests
JavaScript
4
star
48

dat-nexus-app

A social feeds and profiles application
JavaScript
4
star
49

beaker-bookmarks-app

The Beaker "Bookmarks" app
JavaScript
4
star
50

beaker-app-stdlib

Assets which are reused across Beaker apps
JavaScript
4
star
51

viewer-apps

Beaker's builtin hyperdrive-viewer applications
JavaScript
3
star
52

hypercloud-ui-hashbase

Hashbase UI module for hypercloud [DEPRECATED]
CSS
3
star
53

library-tools

Module for managing the library.json file (spec: beakerbrowser.com/library)
JavaScript
3
star
54

beaker-error-constants

Module containing the errors used by beaker and its submodules
JavaScript
3
star
55

basic-user-site-template

Template used to create new user sites
JavaScript
3
star
56

uwg-bash

Bash CLI tools for reading/writing Unwalled Garden data
3
star
57

beaker-start-app

The Beaker "Start Page" app
JavaScript
2
star
58

beaker-analytics-server

Server to collect Beaker usage pings.
JavaScript
2
star
59

dat-workshop-server

A server for the "dat workshop" application (created for the Decentralized Web Summit 2018)
HTML
2
star
60

datignore

A module for reading and using .datignore files
JavaScript
2
star
61

builtin-pages-lib

Some common library code for Beaker's builtin pages.
JavaScript
2
star
62

beaker-index

An indexer driven from the beaker userlist
JavaScript
2
star
63

beaker-profile-app

The Beaker "Profile" App
JavaScript
2
star
64

beaker-feed-app

The Beaker "Feed" App
JavaScript
2
star
65

dat-session-data-ext-msg

Methods for DEP-0006: Session Data (Extension Message)
JavaScript
2
star
66

discussions

Repo for having org-wide discussions.
2
star
67

dat-archive-file-diff

Get line-by-line diffs of text files in Dat archives
JavaScript
1
star
68

dat-nexus-api

API for interacting with Dat Nexus profiles
JavaScript
1
star
69

simple-cloud-announcer

A fork of discovery-swarm that announces a peer and waits for connections.
JavaScript
1
star
70

assets

Images, logos, etc
1
star
71

site-schema.org

A machine-readable description format used to validate and describe the file structures of websites.
1
star