README ¶
h2 - a microservices platform
The microservices architecture is a powerful way to organize and run large codebases - however, without appropriate tooling, it can also introduce tremendous complexity.
At Hailo, we already have that tooling, and as avid users of free and open source software, thought about giving back to the community and encourage people dive into the amazing world of microservices.
This project is still in its infancy, but - we hope - it is already useful enough for people who are willing to get their hands dirty!
What's included now?
A set of core services required to run and call services
What's the use of services if you can't call them, huh? You can run a service, connect to your h2 cluster (or to anyone else's if they are reckless enough), call other services, call your service or any other from the outside world (through http), etc.
Libraries that have automatic access to infrastructure
Cassandra? NSQ? A thin wrapper around these libraries are provided, to make them autoload config, and listen to config changes.
Configuration
A config service and its pair, a config dashboard, provide you an easy way to set or read config data either manually or from services.
User management
The login service handles authentication, user roles, sessions and more. Users web is an easy way to manage users.
Hshell
Hshell is the goto tool to interact with services and their endpoints. List services, their endpoints, call the endpoints and see the returned data.
What's coming up?
A debugger only works within a single process, where is your god now? Fear not, distributed tracing enables you to visualize all the service calls happening on your cluster!
How to know that your services are healthy? The monitoring service collects metrics from standard and custom healthchecks and the monitoring web visualizes the information.
View and search services logs from your browser.
Your system is flooded with errors but reading the logs is very hard, needles are getting lost in the haystack... but the errors service groups and counts messages so you easily see what's going on.
You get a call from a robot at 3am telling you that you won't get more sleep tonight, what do you do? Platform events let you see all config changes, deployments and more.
You don't have time to build a fully fledged frontend for your app? The playground let's you write and share short frontend scripts that talk to the backend easily.
Installation
Pre-prerequisites
- Git
- Install Go and configure your GOPATH. If you don't know how to you can follow https://golang.org/doc/code.html
- Bazaar - Go needs it
- Cassandra CLI tool named cqlsh. You can install it via pip.
- Docker
sudo easy_install pip
sudo pip install cqlsh
Creating the Docker machine
- Run
docker-machine create --driver virtualbox --virtualbox-memory "2048" h2
to create docker machine. (The amount of memory is important - Cassandra might fail to start with less.)
- Get its ip by typing
docker-machine ip h2
. - Update your
/etc/hosts
file with the ip of h2 machine to enable the web apps.
192.168.59.103 hlabs.com
192.168.59.103 hshell.hlabs.com
192.168.59.103 login.hlabs.com
192.168.59.103 homescreen.hlabs.com
192.168.59.103 playground.hlabs.com
192.168.59.103 dev-config.hlabs.com
192.168.59.103 users.hlabs.com
Replace 192.168.59.103 with your h2 machine's ip.
Setting up Docker containers
- Checkout the h2 repo to your local.
- Go to
docker
folder and run
bash docker/build.sh
docker-compose up
Bootstrapping the platform
- You have to run some Cassandra CQL commands once the cassandra container is running (you can try running the cassandra container only with
docker-compose up cassandra
)
cqlsh $(docker-machine ip h2) -f bootstrap/schemas.cql
Connecting to the cluster
Go to scripts
directory.
source setenv.sh $(docker-machine ip h2)
sudo bash copy.sh
Running example service
Step into example
directory and run
go get
sudo -E go run main.go
Once you get everything up and running successfully, you should be able to access http://hshell.hlabs.com ( default username is admin and password is Password1 )
Try listing all services running using ls
command. You should see com.hailocab.service.template
in the list. To run the example endpoint of it
- Run
cd com.hailocab.service.template
- Run
execute foo {}
- You should get a response like
{
"baz": "There are 7 services running on your h2 cluster"
}
Known issues
- The homescreen & users web login page does not work. Use the hshell one to get around this.
- The hlabs domain is hardcoded in the nginx config and in the web discovery binary.
Troubleshooting
You can see the problems and solutions in docs/troubleshooting.md
file.
Directories ¶
Path | Synopsis |
---|---|
proto/foo
Package com_hailocab_service_template_foo is a generated protocol buffer package.
|
Package com_hailocab_service_template_foo is a generated protocol buffer package. |
i/cassandra/timeseries
Offers up a recipe built on Gossie to make dealing with time indexes simple.
|
Offers up a recipe built on Gossie to make dealing with time indexes simple. |
i/dedupe
Package dedupe provides an interface to dedupe anything.
|
Package dedupe provides an interface to dedupe anything. |
i/memcache
This is an implementation of DeduperStorage interface for memcache.
|
This is an implementation of DeduperStorage interface for memcache. |
i/trace
Trace package facilitates the recording of trace events which allow us to follow a request right the way through the H2 platform
|
Trace package facilitates the recording of trace events which allow us to follow a request right the way through the H2 platform |
i/zookeeper
Package to interface Hailo systems and config with Zookeeper
|
Package to interface Hailo systems and config with Zookeeper |
proto
|
|
discovery/proto
Package com_hailocab_kernel_discovery is a generated protocol buffer package.
|
Package com_hailocab_kernel_discovery is a generated protocol buffer package. |
discovery/proto/endpoints
Package com_hailocab_kernel_discovery_endpoints is a generated protocol buffer package.
|
Package com_hailocab_kernel_discovery_endpoints is a generated protocol buffer package. |
discovery/proto/instances
Package com_hailocab_kernel_discovery_instances is a generated protocol buffer package.
|
Package com_hailocab_kernel_discovery_instances is a generated protocol buffer package. |
discovery/proto/register
Package com_hailocab_kernel_discovery_register is a generated protocol buffer package.
|
Package com_hailocab_kernel_discovery_register is a generated protocol buffer package. |
discovery/proto/servicedown
Package com_hailocab_kernel_discovery_servicedown is a generated protocol buffer package.
|
Package com_hailocab_kernel_discovery_servicedown is a generated protocol buffer package. |
discovery/proto/services
Package com_hailocab_kernel_discovery_services is a generated protocol buffer package.
|
Package com_hailocab_kernel_discovery_services is a generated protocol buffer package. |
discovery/proto/serviceup
Package com_hailocab_kernel_discovery_serviceup is a generated protocol buffer package.
|
Package com_hailocab_kernel_discovery_serviceup is a generated protocol buffer package. |
discovery/proto/unregister
Package com_hailocab_kernel_discovery_unregister is a generated protocol buffer package.
|
Package com_hailocab_kernel_discovery_unregister is a generated protocol buffer package. |
login
Package com_hailocab_service_login is a generated protocol buffer package.
|
Package com_hailocab_service_login is a generated protocol buffer package. |
login/auth
Package com_hailocab_service_login_auth is a generated protocol buffer package.
|
Package com_hailocab_service_login_auth is a generated protocol buffer package. |
login/authas
Package com_hailocab_service_login_authas is a generated protocol buffer package.
|
Package com_hailocab_service_login_authas is a generated protocol buffer package. |
login/changeids
Package com_hailocab_service_login_changeids is a generated protocol buffer package.
|
Package com_hailocab_service_login_changeids is a generated protocol buffer package. |
login/changepassword
Package com_hailocab_service_login_changepassword is a generated protocol buffer package.
|
Package com_hailocab_service_login_changepassword is a generated protocol buffer package. |
login/createuser
Package com_hailocab_service_login_createuser is a generated protocol buffer package.
|
Package com_hailocab_service_login_createuser is a generated protocol buffer package. |
login/deletesession
Package com_hailocab_service_login_deletesession is a generated protocol buffer package.
|
Package com_hailocab_service_login_deletesession is a generated protocol buffer package. |
login/deleteuser
Package com_hailocab_service_login_deleteuser is a generated protocol buffer package.
|
Package com_hailocab_service_login_deleteuser is a generated protocol buffer package. |
login/endpointauth
Package com_hailocab_service_login_endpointauth is a generated protocol buffer package.
|
Package com_hailocab_service_login_endpointauth is a generated protocol buffer package. |
login/expirepassword
Package com_hailocab_service_login_expirepassword is a generated protocol buffer package.
|
Package com_hailocab_service_login_expirepassword is a generated protocol buffer package. |
login/grantservice
Package com_hailocab_service_login_grantservice is a generated protocol buffer package.
|
Package com_hailocab_service_login_grantservice is a generated protocol buffer package. |
login/grantuser
Package com_hailocab_service_login_grantuser is a generated protocol buffer package.
|
Package com_hailocab_service_login_grantuser is a generated protocol buffer package. |
login/listsessions
Package com_hailocab_service_login_listsessions is a generated protocol buffer package.
|
Package com_hailocab_service_login_listsessions is a generated protocol buffer package. |
login/listusers
Package com_hailocab_service_login_listusers is a generated protocol buffer package.
|
Package com_hailocab_service_login_listusers is a generated protocol buffer package. |
login/logoutuser
Package com_hailocab_service_login_logoutuser is a generated protocol buffer package.
|
Package com_hailocab_service_login_logoutuser is a generated protocol buffer package. |
login/proto
Package com_hailocab_service_login is a generated protocol buffer package.
|
Package com_hailocab_service_login is a generated protocol buffer package. |
login/proto/auth
Package com_hailocab_service_login_auth is a generated protocol buffer package.
|
Package com_hailocab_service_login_auth is a generated protocol buffer package. |
login/proto/authas
Package com_hailocab_service_login_authas is a generated protocol buffer package.
|
Package com_hailocab_service_login_authas is a generated protocol buffer package. |
login/proto/changeids
Package com_hailocab_service_login_changeids is a generated protocol buffer package.
|
Package com_hailocab_service_login_changeids is a generated protocol buffer package. |
login/proto/changepassword
Package com_hailocab_service_login_changepassword is a generated protocol buffer package.
|
Package com_hailocab_service_login_changepassword is a generated protocol buffer package. |
login/proto/createuser
Package com_hailocab_service_login_createuser is a generated protocol buffer package.
|
Package com_hailocab_service_login_createuser is a generated protocol buffer package. |
login/proto/deletesession
Package com_hailocab_service_login_deletesession is a generated protocol buffer package.
|
Package com_hailocab_service_login_deletesession is a generated protocol buffer package. |
login/proto/deleteuser
Package com_hailocab_service_login_deleteuser is a generated protocol buffer package.
|
Package com_hailocab_service_login_deleteuser is a generated protocol buffer package. |
login/proto/endpointauth
Package com_hailocab_service_login_endpointauth is a generated protocol buffer package.
|
Package com_hailocab_service_login_endpointauth is a generated protocol buffer package. |
login/proto/expirepassword
Package com_hailocab_service_login_expirepassword is a generated protocol buffer package.
|
Package com_hailocab_service_login_expirepassword is a generated protocol buffer package. |
login/proto/grantservice
Package com_hailocab_service_login_grantservice is a generated protocol buffer package.
|
Package com_hailocab_service_login_grantservice is a generated protocol buffer package. |
login/proto/grantuser
Package com_hailocab_service_login_grantuser is a generated protocol buffer package.
|
Package com_hailocab_service_login_grantuser is a generated protocol buffer package. |
login/proto/listsessions
Package com_hailocab_service_login_listsessions is a generated protocol buffer package.
|
Package com_hailocab_service_login_listsessions is a generated protocol buffer package. |
login/proto/listusers
Package com_hailocab_service_login_listusers is a generated protocol buffer package.
|
Package com_hailocab_service_login_listusers is a generated protocol buffer package. |
login/proto/logoutuser
Package com_hailocab_service_login_logoutuser is a generated protocol buffer package.
|
Package com_hailocab_service_login_logoutuser is a generated protocol buffer package. |
login/proto/readlogin
Package com_hailocab_service_login_readlogin is a generated protocol buffer package.
|
Package com_hailocab_service_login_readlogin is a generated protocol buffer package. |
login/proto/readsession
Package com_hailocab_service_login_readsession is a generated protocol buffer package.
|
Package com_hailocab_service_login_readsession is a generated protocol buffer package. |
login/proto/readuser
Package com_hailocab_service_login_readuser is a generated protocol buffer package.
|
Package com_hailocab_service_login_readuser is a generated protocol buffer package. |
login/proto/readusermulti
Package com_hailocab_service_login_readusermulti is a generated protocol buffer package.
|
Package com_hailocab_service_login_readusermulti is a generated protocol buffer package. |
login/proto/revokeservice
Package com_hailocab_service_login_revokeservice is a generated protocol buffer package.
|
Package com_hailocab_service_login_revokeservice is a generated protocol buffer package. |
login/proto/revokeuser
Package com_hailocab_service_login_revokeuser is a generated protocol buffer package.
|
Package com_hailocab_service_login_revokeuser is a generated protocol buffer package. |
login/proto/sessionread
Package com_hailocab_service_login_sessionread is a generated protocol buffer package.
|
Package com_hailocab_service_login_sessionread is a generated protocol buffer package. |
login/proto/setpasswordhash
Package com_hailocab_service_login_setpasswordhash is a generated protocol buffer package.
|
Package com_hailocab_service_login_setpasswordhash is a generated protocol buffer package. |
login/proto/updateuserroles
Package com_hailocab_service_login_updateuserroles is a generated protocol buffer package.
|
Package com_hailocab_service_login_updateuserroles is a generated protocol buffer package. |
login/readlogin
Package com_hailocab_service_login_readlogin is a generated protocol buffer package.
|
Package com_hailocab_service_login_readlogin is a generated protocol buffer package. |
login/readsession
Package com_hailocab_service_login_readsession is a generated protocol buffer package.
|
Package com_hailocab_service_login_readsession is a generated protocol buffer package. |
login/readuser
Package com_hailocab_service_login_readuser is a generated protocol buffer package.
|
Package com_hailocab_service_login_readuser is a generated protocol buffer package. |
login/readusermulti
Package com_hailocab_service_login_readusermulti is a generated protocol buffer package.
|
Package com_hailocab_service_login_readusermulti is a generated protocol buffer package. |
login/revokeservice
Package com_hailocab_service_login_revokeservice is a generated protocol buffer package.
|
Package com_hailocab_service_login_revokeservice is a generated protocol buffer package. |
login/revokeuser
Package com_hailocab_service_login_revokeuser is a generated protocol buffer package.
|
Package com_hailocab_service_login_revokeuser is a generated protocol buffer package. |
login/sessionread
Package com_hailocab_service_login_sessionread is a generated protocol buffer package.
|
Package com_hailocab_service_login_sessionread is a generated protocol buffer package. |
login/setpasswordhash
Package com_hailocab_service_login_setpasswordhash is a generated protocol buffer package.
|
Package com_hailocab_service_login_setpasswordhash is a generated protocol buffer package. |
login/updateuserroles
Package com_hailocab_service_login_updateuserroles is a generated protocol buffer package.
|
Package com_hailocab_service_login_updateuserroles is a generated protocol buffer package. |