Merge remote-tracking branch 'origin/master'

This commit is contained in:
bay1ts 2017-11-29 17:14:01 +08:00
commit 6ce80195d6
8 changed files with 115 additions and 89 deletions

View File

@ -1,73 +1,55 @@
# Rainbond
<img src="https://github.com/goodrain/rainbond/blob/master/docs/rainbond_logo.png" width="30%">
<img src="https://github.com/goodrain/rainbond/blob/master/docs/rainbond_logo.png" width="40%">
----
Rainbond is the first opensource enterprise application management platform (serverless PaaS) in China. It integrates CI/CD automation application building system, microservice architecture application management system and fully-automatic computing resource management system, to provide best practice of application-centic philosophy.
Rainbond is first open source production level serverless PaaS in China. It integrates Kubernetes based containers management, CI/CD methods and multiple data center resource management, to provide full management solution of cloud native application, build connection system of application and infrastructure, application and application, infrastructure and infrastructure.
Rainbond is cutting edge application management platform with complete ecosystem, based on [Kubernetes](https://github.com/kubernetes/kubernetes) and [Docker](https://github.com/moby/moby), has been optimized and verified for 5 five years.
We choose to open source and embrace the community, absorbing best ideas and practices to further improve and enhance Rainbond, enabling more enterprise and individuals to enjoy "application-centric" experience.
5 years of optimizing and verifying makes Rainbond a cutting edge serverless PaaS with complete ecosystem and concept. We choose to open source and embrace the community, absorbing best ideas and practices to further improve and enhance Rainbond, enabling more enterprise and individuals to enjoy "application-centric" experience.
----
## [中文Readme](https://github.com/goodrain/rainbond/blob/master/docs/Readme_cn.md)
## Quick Start
[Design Concept](http://www.rainbond.com/docs/stable/getting-started/design-concept.html) -- -- [Architecture](http://www.rainbond.com/docs/stable/getting-started/architecture.html) -- -- [User Scenario](getting-started/scenario-microservice.html) -- -- [Installation Requirement](http://www.rainbond.com/docs/stable/getting-started/pre-install.html) -- --[中文Readme](https://github.com/goodrain/rainbond/blob/master/docs/Readme_cn.md)
1. [Install Rainbond Data Center]()
2. [Install Rainbond Application Console]()
3. [Build Your First Application](http://www.rainbond.com/docs/stable/getting-started/how-to-create-app.html)
----
## To start using Rainbond
## Quick Build
1. [Install Rainbond](http://www.rainbond.com/docs/stable/getting-started/pre-install.html)
2. [Create First Application](http://www.rainbond.com/docs/stable/user-app-docs/addapp/addapp-code.html)
3. [Build Microservice Architecture](http://www.rainbond.com/docs/stable/user-app-docs/addapp/addapp-cloud_framework.html)
Quickly build Rainbond components in two ways:
## To start developing Rainbond
This repository includes core components of Rainbond Data Center, you can build it in two ways:
##### Golang
```
$go get -d github.com/goodrain/rainbond
$cd $GOPATH/src/github.com/goodrain/rainbond
$make all
$make build
```
##### Docker
```
$git clone https://github.com/goodrain/rainbond.git
$cd rainbond
$make all-image
$make images
```
##### BUG Submission
##### BUG Fix
Bug found in learning and using, please visit [ISSUES](https://github.com/goodrain/rainbond/issues) to find similar Bug and solutions. If there is no similar result, please create a new issure.
Bug found in learning and using, please visit [ISSUES](https://github.com/goodrain/rainbond/issues) to find similar Bug and solutions. If there is no similar result, please create a new issue.
## [Rainbond Architecture](http://www.rainbond.com/docs/stable/getting-started/architecture.html)
## [Architecture](http://www.rainbond.com/docs/stable/getting-started/architecture.html)
### Architecture
<img src="https://github.com/goodrain/rainbond/blob/master/docs/rainbond_architecture.png" href="http://www.rainbond.com/docs/stable/getting-started/architecture.html">
### Rainbond Structure
Rainbond consisted of [Rainbond Data Center](https://github.com/goodrain/rainbond) and [Rainbond Resource Console](https://github.com/goodrain/rainbond-ui)(Enterprise edition available), seamlessly docked with 好雨云市, enabling hyper-converged computing pools.
* [Rainbond Data Center](https://github.com/goodrain/rainbond)
Rainbond Data Center consisted of [a series of distributed components](http://www.rainbond.com/docs/stable/platform-maintenance/add-management-node/component-introduction/overview.html), enabling resource-oriented Rainbond node abstraction, application-oriented storage, network and computing resources. With plug-in, distributed and software-defined principles, Rainbond can build unified application runtime environment on any computing environment, includes public cloud, private cloud, IDC and industry computing cloud.
* [Rainbond Application Console](https://github.com/goodrain/rainbond-ui)
Rainbond Application Console is Web console that interfaces with multiple Rainbond Data Centers, to provide application lifecycle management capabilities.
<img src="https://github.com/goodrain/rainbond/blob/master/docs/rainbond_architecture.png" href="http://www.rainbond.com/docs/stable/getting-started/architecture.html">
## Community
### Rainbond QQ Group
### QQ Group:
- 477016432(Group 1)
- 453475798(Group 2)
- 419331946(Group 3)
- 477016432 (Group 1)
- 453475798 (Group 2)
- 419331946 (Group 3)
### Documentation
### [Documentation](http://www.rainbond.com/docs/stable/)
- [Development](http://doc.goodrain.com/cloudbang-community-install/247616)
- [Installation](http://www.rainbond.com/docs/stable/getting-started/pre-install.html)
- [Manual](http://www.rainbond.com/docs/stable/user-app-docs/addapp/addapp-image.html)
- [Maintenance](http://www.rainbond.com/docs/stable/platform-maintenance/overview/overview.html)
- Docs: https://www.rainbond.com/docs
- Blog: https://www.rainbond.com/blog

View File

@ -1,74 +1,58 @@
# 云帮
<img src="https://github.com/goodrain/rainbond/blob/master/docs/rainbond_logo.png">
<img src="https://github.com/goodrain/rainbond/blob/master/docs/rainbond_logo.png" width="40%">
----
云帮Rainbond是国内首个开源企业级应用管理平台(无服务器PaaS)集CI/CD自动化应用构建系统、微服务架构应用管理系统、全自动计算资源管理系统于一身提供“以应用为中心”理念的最佳实践
好雨云帮Rainbond是国内首个开源的生产级无服务器PasS平台深度整合基于Kubernetes的容器管理、多类型CI/CD应用构建与交付、多数据中心的资源管理等技术提供完整的云原生应用管理解决方案构建出应用、基础设施之间的互联互通生态体系
云帮深度整合[Kubernetes](https://github.com/kubernetes/kubernetes)、 [Docker](https://github.com/moby/moby)等顶级容器生态开源项目,并历经超过五年的生产运营打磨和验证,形成目前理念最新、生态最完整的应用管理平台。
如今,我们选择开源、拥抱社区,期望吸收最好的想法和实践,进一步完善和提升云帮,让更多企业和个人用户享受“以应用为中心”的技术体验。
Rainbond历经超过五年的生产运营打磨和验证形成目前理念最新、生态最完整的无服务器PasS平台。如今我们选择开源、拥抱社区期望吸收最好的想法和实践进一步完善和提升云帮让更多企业和个人用户享受“以应用为中心”的技术体验。
----
[设计理念](http://www.rainbond.com/docs/stable/getting-started/design-concept.html) -- -- [技术架构](http://www.rainbond.com/docs/stable/getting-started/architecture.html) -- -- [应用场景](getting-started/scenario-microservice.html) -- -- [系统安装](http://www.rainbond.com/docs/stable/getting-started/pre-install.html)
## 快速开始
----
## 使用Rainbond
1. [安装云帮数据中心]().
2. [安装云帮应用控制台]().
3. [创建你的第一个应用](http://www.rainbond.com/docs/stable/getting-started/how-to-create-app.html).
1. [安装Rainbond](http://www.rainbond.com/docs/stable/getting-started/pre-install.html)
2. [创建第一个应用](http://www.rainbond.com/docs/stable/user-app-docs/addapp/addapp-code.html)
3. [快速构建微服务架构](http://www.rainbond.com/docs/stable/user-app-docs/addapp/addapp-cloud_framework.html)
## 快速构建
## 开发Rainbond
通过两种方式快速构建云帮组件
本仓库具有Rainbond数据中心核心组件通过两种方式快速构建:
##### Golang开发环境
```
$go get -d github.com/goodrain/rainbond
$cd $GOPATH/src/github.com/goodrain/rainbond
$make all
$make build
```
##### Docker环境
```
$git clone https://github.com/goodrain/rainbond.git
$cd rainbond
$make all-image
$make images
```
##### BUG提交
##### BUG与建议
在学习和使用中发现Bug请移步[ISSUES](https://github.com/goodrain/rainbond/issues)查找类似Bug及其修复方案。若无类似问题请新建Issue。
## [云帮架构](http://www.rainbond.com/docs/stable/getting-started/architecture.html)
## [Rainbond架构](http://www.rainbond.com/docs/stable/getting-started/architecture.html)
### 架构
### 组件架构图
<img src="https://github.com/goodrain/rainbond/blob/master/docs/rainbond_architecture.png" href="http://www.rainbond.com/docs/stable/getting-started/architecture.html">
### 云帮构成
云帮由[云帮数据中心](https://github.com/goodrain/rainbond) 和[云帮应用控制台](https://github.com/goodrain/rainbond-ui) 云帮资源控制台(企业版提供)构成,并无缝对接好雨云市,以此实现超融合计算池。
* [云帮数据中心](https://github.com/goodrain/rainbond)
云帮数据中心由[一系列分布式组件](http://www.rainbond.com/docs/stable/platform-maintenance/add-management-node/component-introduction/overview.html)构成面向资源抽象云帮节点面向应用抽象存储、网络以及计算资源。本着插件化、分布式、软件定义一切的设计原则云帮可在任何计算环境公有云私有云IDC行业计算之上构建统一的应用运行环境。
* [云帮应用控制台](https://github.com/goodrain/rainbond-ui)
云帮应用控制台是一个Web控制台对接多个云帮数据中心提供应用的全生命周期管理功能。
## 社区支持
### 云帮用户交流群(QQ)
### Rainbond用户交流群(QQ)
- 477016432(1群)
- 453475798(2群)
- 419331946(3群)
### 文档支持
- [云帮开发文档](http://doc.goodrain.com/cloudbang-community-install/247616)
- [安装文档](http://www.rainbond.com/docs/stable/getting-started/pre-install.html)
- [使用文档](http://www.rainbond.com/docs/stable/user-app-docs/addapp/addapp-image.html)
- [平台维护](http://www.rainbond.com/docs/stable/platform-maintenance/overview/overview.html)
### [项目文档支持](http://www.rainbond.com/docs/stable/)
文档地址https://www.rainbond.com/docs
博客地址https://blog.goodrain.com/

View File

@ -1,8 +1,8 @@
#!/bin/bash
if [ "$1" = "bash" ];then
if [ "$1" = "debug" ];then
exec /bin/bash
elif [ "$1" = "version" ];then
echo ${RELEASE_DESC}
else
exec /run/rainbond-worker
exec /run/rainbond-worker $@
fi

View File

@ -128,6 +128,7 @@ type TenantServicePluginRelationDao interface {
DeleteALLRelationByPluginID(pluginID string) error
GetALLRelationByServiceID(serviceID string) ([]*model.TenantServicePluginRelation, error)
GetRelateionByServiceIDAndPluginID(serviceID, pluginID string) (*model.TenantServicePluginRelation, error)
CheckSomeModelPluginByServiceID(serviceID, pluginModel string) (bool, error)
}
//TenantServiceRelationDao TenantServiceRelationDao
@ -251,6 +252,7 @@ type ServiceStatusDao interface {
GetTenantStatus(tenantID string) ([]*model.TenantServiceStatus, error)
GetTenantServicesStatus(serviceIDs []string) ([]*model.TenantServiceStatus, error)
}
//CodeCheckResultDao CodeCheckResultDao
type CodeCheckResultDao interface {
Dao
@ -260,10 +262,10 @@ type CodeCheckResultDao interface {
//AppPublishDao AppPublishDao
type AppPublishDao interface {
Dao
GetAppPublish(serviceKey,appVersion string) (*model.AppPublish, error)
GetAppPublish(serviceKey, appVersion string) (*model.AppPublish, error)
}
//AppPublishDao AppPublishDao
//EventDao EventDao
type EventDao interface {
Dao
GetEventByEventID(eventID string) (*model.ServiceEvent, error)
@ -275,4 +277,4 @@ type VersionInfoDao interface {
Dao
GetVersionByEventID(eventID string) (*model.VersionInfo, error)
GetVersionByServiceID(serviceID string) ([]*model.VersionInfo, error)
}
}

View File

@ -137,10 +137,11 @@ func (t *TenantPluginVersionEnv) TableName() string {
//TenantServicePluginRelation TenantServicePluginRelation
type TenantServicePluginRelation struct {
Model
VersionID string `gorm:"column:version_id;size:32"`
PluginID string `gorm:"column:plugin_id;size:32"`
ServiceID string `gorm:"column:service_id;size:32"`
Switch bool `gorm:"column:switch;default:false"`
VersionID string `gorm:"column:version_id;size:32"`
PluginID string `gorm:"column:plugin_id;size:32"`
ServiceID string `gorm:"column:service_id;size:32"`
PluginModel string `gorm:"column:plugin_model;size:24"`
Switch bool `gorm:"column:switch;default:false"`
}
//TableName 表名

View File

@ -358,6 +358,18 @@ func (t *TenantServicePluginRelationDaoImpl) DeleteRelationByServiceIDAndPluginI
serviceID).Delete(relation).Error
}
//CheckSomeModelPluginByServiceID 检查是否绑定了同种插件
func (t *TenantServicePluginRelationDaoImpl) CheckSomeModelPluginByServiceID(serviceID, pluginModel string) (bool, error) {
var relations []*model.TenantServicePluginRelation
if err := t.DB.Where("service_id=? and plugin_model=?", serviceID, pluginModel).Find(&relations).Error; err != nil {
return false, err
}
if len(relations) == 1 {
return true, nil
}
return false, nil
}
//DeleteALLRelationByServiceID 删除serviceID所有插件依赖 一般用于删除应用时使用
func (t *TenantServicePluginRelationDaoImpl) DeleteALLRelationByServiceID(serviceID string) error {
relation := &model.TenantServicePluginRelation{

View File

@ -75,6 +75,17 @@ func (k *K8sServiceBuild) Build() ([]*v1.Service, error) {
if err != nil {
return nil, fmt.Errorf("find service port from db error %s", err.Error())
}
crt, err := k.checkUpstreamPluginRelation()
if err != nil {
return nil, fmt.Errorf("get service upstream plugin relation error, %s", err.Error())
}
pp := make(map[interface{}]int)
if crt {
ports, pp, err = k.CreateUpstreamPluginMappingPort(ports)
}
if err != nil {
return nil, fmt.Errorf("create upstream port error, %s", err.Error())
}
var services []*v1.Service
//创建分端口的负载均衡Service
if ports != nil && len(ports) > 0 {
@ -92,6 +103,40 @@ func (k *K8sServiceBuild) Build() ([]*v1.Service, error) {
if k.replicationType == model.TypeStatefulSet {
services = append(services, k.createStatefulService(ports))
}
if crt {
services, _ = k.CreateUpstreamPluginMappingService(services, pp)
}
return services, nil
}
func (k *K8sServiceBuild) checkUpstreamPluginRelation() (bool, error) {
return k.dbmanager.TenantServicePluginRelationDao().CheckSomeModelPluginByServiceID(
k.serviceID,
model.UpNetPlugin)
}
//CreateUpstreamPluginMappingPort 检查是否存在upstream插件接管入口网络
func (k *K8sServiceBuild) CreateUpstreamPluginMappingPort(ports []*model.TenantServicesPort) (
[]*model.TenantServicesPort,
map[interface{}]int,
error) {
//start from 65301
pp := make(map[interface{}]int)
for i := range ports {
port := ports[i]
pp[65300+i] = port.ContainerPort
port.ContainerPort = 65300 + i
}
return ports, pp, nil
}
//CreateUpstreamPluginMappingService 增加service plugin mapport 标签
func (k *K8sServiceBuild) CreateUpstreamPluginMappingService(services []*v1.Service, pp map[interface{}]int) (
[]*v1.Service,
error) {
for _, service := range services {
service.Labels["origin_port"] = fmt.Sprintf("%d", pp[service.Spec.Ports[0].Port])
}
return services, nil
}

View File

@ -77,7 +77,7 @@ function build::image() {
docker build -t hub.goodrain.com/${BASE_NAME}/rbd-$1:${VERSION} -f Dockerfile.release .
docker tag hub.goodrain.com/${BASE_NAME}/rbd-$1:${VERSION} ${BASE_NAME}/rbd-$1:${VERSION}
docker tag hub.goodrain.com/${BASE_NAME}/rbd-$1:${VERSION} ${BASE_NAME}/rbd-$1
docker push ${BASE_NAME}/rbd-$1
#docker push ${BASE_NAME}/rbd-$1
rm -f ./Dockerfile.release
rm -f ./${BASE_NAME}-$1
}