https://github.com/sonm-io/insonmnia
The platform
https://github.com/sonm-io/insonmnia
containers docker golang sonm
Last synced: 6 months ago
JSON representation
The platform
- Host: GitHub
- URL: https://github.com/sonm-io/insonmnia
- Owner: sonm-io
- License: apache-2.0
- Created: 2017-05-07T16:41:09.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-07-19T08:38:24.000Z (almost 9 years ago)
- Last Synced: 2024-06-20T02:13:39.413Z (about 2 years ago)
- Topics: containers, docker, golang, sonm
- Language: Go
- Homepage:
- Size: 2.53 MB
- Stars: 44
- Watchers: 25
- Forks: 10
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# inSONMnia
[](https://travis-ci.org/sonm-io/insonmnia)
It's an early **alpha** version of the platform for [SONM.io](https://sonm.io) project.
For now it has lots of unfinished task. The main idea is to show that such platform can be implemented and to chose a techstack for future implementation.
# What is it here?
This repository contains code for Hub, Miner and CLI.
# Where can I get it?
A docker container contained every CLI, Miner, Hub can be found on public DockerHub: [sonm/insonmnia](https://hub.docker.com/r/sonm/insonmnia/)
```bash
docker pull sonm/insonmnia
```
If you want it's easy to build all the components. You need *golang > 1.8*:
```bash
make build
```
Also there is a Dockerfile to build a container:
```bash
docker build .
```
# Roadmap
Look at milestone https://github.com/sonm-io/insonmnia/milestones
# How to run
## Hub
To start a hub it's needed to expose a couple of ports.
*10001* handles gRCP requests from CLI
*10002* is used to handle communication with miners
```bash
docker run --rm -p 10002:10002 -p 10001:10001 sonm/insonmnia sonmhub
```
## Miner
To run Miner from the container you need to pass docker socket inside and specify IP of the HUB
```bash
docker run --net host -e DOCKER_API_VERSION=1.24 -v /run:/var/run sonm/insonmnia:alpha3 sonmminer -h
```
## CLI commands
CLI sends commands to a hub. A hub must be pointed via *--hub=*. Port is usually *10001*.
### ping
Just check that a hub is reachable and alive.
```bash
sonmcli --hub ping
OK
```
### list
List shows a list of miners connected to a hub with tasks assigned to them.
**NOTE: later each miner will have a unique signed ID instead of host:port**
```bash
sonmcli --hub list
Connected Miners
{
" --timeout=3000s start --image schturmfogel/sonm-q3:alpha --miner=
```
The result would look like:
```
ID , Endpoint [27960/tcp-> 27960/udp->]
```
+ **jobid** is an unique name for the task. Later it can be used to specify a task for various operations.
+ **Endpoint** describes mapping of exposed ports (google for Docker EXPOSE) to the real ports of a miner
**NOTE**: later STUN will be used for UDP packets and LVS (ipvs) or userspace proxy (like SSH tunnel) for TCP. Miners who have a public IPv4 or can be reached via IPv6 would not need this proxy. The proxy is intended to get through NAT.
### stop a container
To stop the task just provide the *jobid*
```bash
sonmcli --hub stop
```
# How to cook a container
Dockerfile for the image should follow several requirements:
+ *ENTRYPOINT* or *CMD* or both must present
+ Network ports should be specified via *EXPOSE*
# Technical overview
Technologies we use right now:
+ *golang* is the main language. Athough golang has disadvantages, we believe that its model is good for fast start and the code is easy to understand. The simplicity leads to less errors. Also it makes easy to contribute to a project as a review process is very clean.
+ *Docker* is a heart of an isolation in our platform. We rely on security features **(It's not 100% safe!)**, metrics, ecosystem it provides. The cool thing Docker is supported by many platforms. Also Docker works a lot on a unikernel approach for container based applications, which opens a huge field for security and portability improvements.
+ *whisper* as a discovery protocol
+ Until the epoch of IPv6 begins we should bring a way to get through NAT. The solution depends on a concrete transport layer. For example, different approaches should be used for UDP (e.g. STUN) and TCP (naive userspace proxy). Each approach has its own overhead and the best fit solution depends on a task.
+ *gRPC* is an API protocol between components. It's very easy to extend, supports traffic compression, flexible auth model, supported by many language. It's becoming more and more popular as a technology for RPC.
## Hub
Hub provides public gRPC-based API. proto files can be found in proto dir.
## Miner
Miner is expected to discover a Hub using Whisper. Later the miner connects to the hub via TCP. Right now a Miner must have a *public IP address*. Hub sends orders to the miner via gRPC on top of the connection. Hub pings the miner from time to time.