docklet/README.md

189 lines
7.1 KiB
Markdown
Raw Normal View History

2017-05-28 12:15:50 +08:00
# Docklet
2017-06-06 20:34:01 +08:00
https://unias.github.io/docklet
2016-03-31 17:21:56 +08:00
2016-04-08 15:48:37 +08:00
## Intro
Docklet is a cloud operating system for mini-datacener. Its goal is to
help multi-user share cluster resources effectively. In Docklet, every
user has their own private **virtual cluster (vcluster)**, which
consists of a number of virtual Linux container nodes distributed over
the physical cluster. Each vcluster is separated from others and can be
operated like a real physical cluster. Therefore, most applications,
especially those requiring a cluster environment, can run in vcluster
2017-05-28 12:15:50 +08:00
seamlessly.
2016-04-08 15:48:37 +08:00
Users manage and use their vcluster all through web. The only client
tool needed is a modern web browser supporting HTML5, like Safari,
Firefox, or Chrome. The integrated *jupyter notebook* provides a web
2017-05-28 12:15:50 +08:00
**Workspace**. In the Workspace, users can code, debug, test,
and runn their programs, even visualize the outputs online.
2016-04-08 15:48:37 +08:00
Therefore, it is ideal for data analysis and processing.
2017-05-28 12:15:50 +08:00
Docklet creates virtual nodes from a base image. Admins can
2016-04-08 15:48:37 +08:00
pre-install development tools and frameworks according to their
2017-05-28 12:15:50 +08:00
interests. The users are also free to install their specific software
2016-04-08 15:48:37 +08:00
in their vcluster.
Docklet only need **one** public IP address. The vclusters are
configured to use private IP address range, e.g., 172.16.0.0/16,
192.168.0.0/16, 10.0.0.0/8. A proxy is setup to help
2017-05-28 12:15:50 +08:00
users visit their vclusters behind the firewall/gateway.
The Docklet system runtime consists of four components:
- distributed file system server
- etcd server
2017-06-06 20:39:45 +08:00
- docklet supermaster, master
- docklet worker
2016-04-08 15:48:37 +08:00
## Install
2016-04-08 15:48:37 +08:00
Currently the Docklet system is recommend to run in Unbuntu 15.10+.
Ensure that python3.5 is the default python3 version.
2016-04-08 15:48:37 +08:00
Clone Docklet from github
```
2016-04-08 15:48:37 +08:00
git clone https://github.com/unias/docklet.git
```
2016-04-08 15:48:37 +08:00
Run **prepare.sh** from console to install depended packages and
2017-05-28 12:15:50 +08:00
generate necessary configurations.
2016-04-08 15:48:37 +08:00
A *root* users will be created for managing the Docklet system. The
password is recorded in `FS_PREFIX/local/generated_password.txt` .
2016-04-08 15:48:37 +08:00
## Config ##
The main configuration file of docklet is conf/docklet.conf. Most
2017-05-28 12:15:50 +08:00
default setting works for a single host environment.
First copy docklet.conf.template to get docklet.conf.
2016-04-08 15:48:37 +08:00
Pay attention to the following settings:
2017-05-28 12:15:50 +08:00
- NETWORK_DEVICE : the network interface to use.
2016-10-12 10:37:51 +08:00
- ETCD : the etcd server address. For distributed multi hosts
environment, it should be one of the ETCD public server address.
For single host environment, the default value should be OK.
- STORAGE : using disk or file to storage persistent data, for
single host, file is convenient.
- FS_PREFIX: the working dir of docklet runtime. default is
/opt/docklet.
- CLUSTER_NET: the vcluster network ip address range, default is
2017-05-28 12:15:50 +08:00
172.16.0.1/16. This network range should all be allocated to and
managed by docklet.
- PROXY_PORT : the listening port of configurable-http-proxy. It proxy
connections from exteral public network to internal private
container networks.
- PORTAL_URL : the portal of the system. Users access the system
by visiting this address. If the system is behind a firewall, then
2017-06-02 16:53:26 +08:00
a reverse proxy should be setup. Default is MASTER_IP:NGINX_PORT.
2017-05-28 12:15:50 +08:00
- NGINX_PORT : the access port of the public portal. User use this
port to visit docklet system.
- DISTRIBUTED_GATEWAY : whether the users' gateways are distributed
or not. Both master and worker must be set by same value.
2017-06-02 16:53:26 +08:00
- PUBLIC_IP : publick ip of this machine. If DISTRIBUTED_GATEWAY is True,
users' gateways can be setup on this machine. Users can visit this
machine by the public ip. default: IP of NETWORK_DEVICE.
- USER_IP : the ip of user server. default : localhost
- MASTER_IPS : tell the web server the ips of all the cluster master.
- OPEN_REGISTRY : whether allow user to register a new account.
- AUTH_KEY: the key to request users server from master, or to request
master from users server. Please set the same value on each machine.
Please don't use the default value.
- APPROVAL_RBT: whether to start the approval robot that will approve
beans applications from users automatically.
2016-04-08 15:48:37 +08:00
## Start ##
### distributed file system ###
For multi hosts distributed environment, a distributed file system is
2017-05-28 12:15:50 +08:00
needed to store global data. Currently, glusterfs has been tested.
Lets presume the file system server export filesystem as nfs
**fileserver:/pub** :
In each physical host to run docklet, mount **fileserver:/pub** to
**FS_PEFIX/global** .
2016-04-08 15:48:37 +08:00
For single host environment, nothing to do.
### etcd ###
2016-03-23 08:14:21 +08:00
For single host environment, start **tools/etcd-one-node.sh** . Some recent
Ubuntu releases have included **etcd** in the repository, just `apt-get
2017-05-28 12:15:50 +08:00
install etcd`, and it need not to start etcd manually. For others, you
2016-03-23 08:14:21 +08:00
should install etcd manually.
2016-04-08 15:48:37 +08:00
For multi hosts distributed environment, **must** start
**dep/etcd-multi-nodes.sh** in each etcd server hosts. This scripts
requires users providing the etcd server address as parameters.
2017-06-05 13:11:48 +08:00
### supermaster ###
2017-06-06 20:39:45 +08:00
2017-06-05 13:11:48 +08:00
Supermaster is a server consist of web server, user server and a master server instance.
If it is the first time you start docklet, run `bin/docklet-supermaster init`
to init and start a docklet master, web server and user server. Otherwise, run `bin/docklet-supermaster start`.
When you start a supermaster,you don't need to start an extra master in the same cluster.
### master ###
2017-06-06 20:39:45 +08:00
A master manages all the workers in one data center. Docklet can manage
several data centers, each data center has one master server. But
a docklet system will only have one supermaster.
First, select a server with 2 network interface card, one having a
public IP address/url, e.g., docklet.info; the other having a private IP
address, e.g., 172.16.0.1. This server will be the master.
If it is the first time you start docklet, run `bin/docklet-master init`
2017-05-28 12:15:50 +08:00
to init and start docklet master. Otherwise, run `bin/docklet-master start`,
which will start master in recovery mode in background using
conf/docklet.conf. (Note: if docklet will run in the distributed gateway mode
and recovery mode, please start the workers first.)
2017-06-05 13:11:48 +08:00
Please fill the USER_IP and USER_PORT in conf/docklet.conf, it is the ip and port of user server.
By default, it is `localhost` and `9100`
You can check the daemon status by running `bin/docklet-master status`
The master logs are in **FS_PREFIX/local/log/docklet-master.log** and
**docklet-web.log**.
### worker ###
2016-04-08 15:48:37 +08:00
Worker needs a basefs image to create containers.
2017-05-28 12:15:50 +08:00
You can create such an image with `lxc-create -n test -t download`,
then copy the rootfs to **FS_PREFIX/local**, and rename `rootfs`
to `basefs`.
2017-05-28 12:15:50 +08:00
Note the `jupyerhub` package must be installed for this image. And the
start script `tools/start_jupyter.sh` should be placed at
`basefs/home/jupyter`.
You can check and run `tools/update-basefs.sh` to update basefs.
Run `bin/docklet-worker start`, will start worker in background.
2016-10-12 10:37:51 +08:00
You can check the daemon status by running `bin/docklet-worker status`.
2016-10-12 10:37:51 +08:00
The log is in **FS_PREFIX/local/log/docklet-worker.log**.
Currently, the worker must be run after the master has been started.
2016-04-08 15:48:37 +08:00
## Usage ##
2017-05-28 12:15:50 +08:00
Open a browser, visiting the address specified by PORTAL_URL ,
e.g., ` http://docklet.info/ `
That is it.
2016-04-08 15:48:37 +08:00
# Contribute #
Contributions are welcome. Please check [devguide](doc/devguide/devguide.md)