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:
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.
Before deploying the service, you absolutely must modify the following config.
dir: ./.hashbase # where to store the databrandname: Hashbase # the title of your servicehostname: hashbase.local # the hostname of your serviceproxy: true # is there a reverse proxy (eg nginx) in front of the server?port: 8080# the port to run the service onrateLimiting: true # rate limit the HTTP requests?csrf: true # use csrf tokens?defaultDiskUsageLimit: 100mb # default maximum disk usage for each userYou 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 configemail: '[email protected]'# email to register domains underIf enabled, port will be ignored and the server will register at ports 80 and 443.
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: myverysecretpasswordHashbase can host the archives as HTTP sites. This has the added benefit of enabling dat-dns shortnames for the archives. There are two possible schemes:
sites: per-userPer-user will host archives at username.hostname/archivename, in a scheme similar to GitHub Pages. If the archive-name is == to the username, it will be hosted at username.hostname.
Note that, in this scheme, a DNS shortname is only provided for the user archive (username.hostname).
sites: per-archivePer-archive will host archives at archivename-username.hostname. If the archive-name is == to the username, it will be hosted at username.hostname.
By default, HTTP Sites are disabled.
For a private instance, use closed registration with a whitelist of allowed emails:
registration: open: falseallowed: - [email protected] - [email protected]Use reserved usernames to blacklist usernames which collide with frontend routes, or which might be used maliciously.
registration: reservedNames: - admin - root - support - noreply - users - archivespm2: false # set to true if you're using https://keymetrics.io/alerts: diskUsage: 10gb # when to trigger an alert on disk usageHashbase 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 thissecret: THIS MUST BE REPLACED! # put something random hereexpiresIn: 1h# how long do sessions live?Hashbase runs some jobs periodically. You can configure how frequently they run.
# processing jobsjobs: popularArchivesIndex: 30s# compute the index of archives sorted by num peersuserDiskUsage: 5m# compute how much disk space each user is usingdeleteDeadArchives: 5m# delete removed archives from diskTodo, sorry
Run the tests with
npm test To run the tests against a running server, specify the env var:
REMOTE_URL=http://{hostname}/ npm test MIT