The HAT Personal Microserver
This repository contains an implementation of the Hub-of-All-Things HAT Microserver project.
The current project version is here.
The Hub-of-All-Things is a HAT Microserver for individuals to own, control and share their data.
A Personal Microserver (“the HAT”) is a personal single tenant (“the individual self”) technology system that is fully individual self-service, to enable an individual to define a full set of “meta-data” defined as a specific set of personal data, personal preferences and personal behaviour events.
The HAT enables individuals to share the correct information (quality and quantity), with the correct people, in the correct situations for the correct purposes and to gain the benefits.
The HAT microserver is the technology base of the Persona Data Server.
This HAT Microserver implementation is written in Scala (2.12.11) uses the following technology stack:
HAT runs as a combination of a backing PostgreSQL database (with a public schema for flattened data storage) and a software stack that provides logic to work with the schema using HTTP APIs.
To run it from source in a development environment two sets of tools are required:
> git clone https://github.com/Hub-of-all-Things/HAT2.0.git
> cd HAT2.0
> git submodule init
> git submodule update
127.0.0.1 bobtheplumber.hat.org
127.0.0.1 bobtheplumber.example.com
There are 2 ways of doing this.
> createdb testhatdb1
> createuser testhatdb1
> psql postgres -c "GRANT CREATE ON DATABASE testhatdb1 TO testhatdb1"
docker-compose
A docker-compose.yml file has been included in this project to boot up a dockerized postgresql instance.
If you do use this method, you need to create a .env
file. The included .env.example
will work as is.
If you make a change, do make the corresponding change to ./hat/conf/dev.conf
Then
> make docker-db
You can stop the database with
> make docker-db-stop
> make run-dev
Go to http://bobtheplumber.example.com:9000
You're all set!
Your best source of information on how the development environment could be customised is the hat/conf/dev.conf
configuration file. Make sure you run the project locally with the configuration enabled (using the steps above)
or it will just show you the message that the HAT could not be found.
Among other things, the configuration includes:
Specifically, it has 4 major sections:
play.modules {
enabled += "org.hatdex.hat.modules.DevHatInitializationModule"
}
devhatMigrations = [
"evolutions/hat-database-schema/11_hat.sql",
"evolutions/hat-database-schema/12_hatEvolutions.sql",
"evolutions/hat-database-schema/13_liveEvolutions.sql",
"evolutions/hat-database-schema/14_newHat.sql"]
devhats
list sets out the list of HATs that are served by the current server, for each including owner details to be
initialised with and database access credentials. Each specified database must exist before launching the server but
are initialised with the right schema at start timehat
section lists all corresponding HAT configurations to serve, here you could change the HAT domain name, owner's
email address or public/private keypair used by the HAT for its token operationsThe HAT solution is easy deployable on top of Kubernetes via Helm 3 chart.
HAT including HAT Schema and API is licensed under AGPL - GNU AFFERO GENERAL PUBLIC LICENSE