[REV] merge branch

This commit is contained in:
barnettZQG 2018-06-14 10:49:31 +08:00
commit d9f59ae562
6 changed files with 57 additions and 39 deletions

View File

@ -75,17 +75,17 @@ Rainbond is under the LGPL-3.0 license, see [LICENSE](https://github.com/goodrai
Thanks for the following open source project
* [kubernetes](https://github.com/kubernetes/kubernetes)
* [docker/moby](https://github.com/moby/moby)
* [heroku buildpack](https://github.com/heroku)
* [openresty](https://github.com/openresty/)
* [calico](https://github.com/projectcalico)
* [midonet](https://github.com/midonet/midonet)
* [etcd](https://github.com/coreos/etcd)
* [prometheus](https://github.com/prometheus/prometheus)
* [glusterfs](https://github.com/gluster/glusterfs)
* [ceph](https://github.com/ceph/ceph)
* [cockroachDB](https://github.com/cockroachdb/cockroach)
* [mysql](https://github.com/mysqljs/mysql)
* [Kubernetes](https://github.com/kubernetes/kubernetes)
* [Docker/Moby](https://github.com/moby/moby)
* [Heroku Buildpacks](https://github.com/heroku?utf8=%E2%9C%93&q=buildpack&type=&language=)
* [OpenResty](https://github.com/openresty/)
* [Calico](https://github.com/projectcalico)
* [Midonet](https://github.com/midonet/midonet)
* [Etcd](https://github.com/coreos/etcd)
* [Prometheus](https://github.com/prometheus/prometheus)
* [GlusterFS](https://github.com/gluster/glusterfs)
* [Ceph](https://github.com/ceph/ceph)
* [CockroachDB](https://github.com/cockroachdb/cockroach)
* [MySQL](https://github.com/mysql/mysql-server)
* [Weave Scope](https://github.com/weaveworks/scope)
* [Ant Design](https://github.com/ant-design/ant-design)

View File

@ -16,8 +16,11 @@ import (
"github.com/goodrain/rainbond/mq/api/grpc/pb"
"github.com/pkg/errors"
"github.com/tidwall/gjson"
"regexp"
)
var re = regexp.MustCompile(`\s`)
type AppAction struct {
MQClient pb.TaskQueueClient
staticDir string
@ -160,7 +163,7 @@ func unicode2zh(uText string) (context string) {
}
context = strings.TrimSpace(context)
context = re.ReplaceAllString(context, "")
return context
}

View File

@ -37,8 +37,11 @@ import (
"github.com/pkg/errors"
"github.com/tidwall/gjson"
"gopkg.in/yaml.v2"
"regexp"
)
var re = regexp.MustCompile(`\s`)
//ExportApp Export app to specified format(rainbond-app or dockercompose)
type ExportApp struct {
EventID string `json:"event_id"`
@ -654,7 +657,7 @@ func buildToLinuxFileName(fileName string) string {
}
fileName = strings.Replace(fileName, ":", "--", -1)
fileName = strings.TrimSpace(fileName)
fileName = re.ReplaceAllString(fileName, "")
return fileName
}

View File

@ -29,11 +29,12 @@ import (
)
type Config struct {
EtcdEndpoints []string
LogLevel string
AdvertiseAddr string
BindIp string
Port int
EtcdEndpointsLine string
EtcdEndpoints []string
LogLevel string
AdvertiseAddr string
BindIp string
Port int
StartArgs []string
ConfigFile string
@ -87,11 +88,12 @@ func NewConfig() *Config {
host, _ := os.Hostname()
config := &Config{
EtcdEndpoints: []string{"http://127.0.0.1:2379"},
AdvertiseAddr: host + ":9999",
BindIp: host,
Port: 9999,
LogLevel: "info",
EtcdEndpointsLine: "http://127.0.0.1:2379",
EtcdEndpoints: []string{},
AdvertiseAddr: host + ":9999",
BindIp: host,
Port: 9999,
LogLevel: "info",
ConfigFile: "/etc/prometheus/prometheus.yml",
LocalStoragePath: "/prometheusdata",
@ -119,7 +121,7 @@ func NewConfig() *Config {
}
func (c *Config) AddFlag(cmd *pflag.FlagSet) {
cmd.StringArrayVar(&c.EtcdEndpoints, "etcd-endpoints", c.EtcdEndpoints, "etcd endpoints list.")
cmd.StringVar(&c.EtcdEndpointsLine, "etcd-endpoints", c.EtcdEndpointsLine, "etcd endpoints list.")
cmd.StringVar(&c.AdvertiseAddr, "advertise-addr", c.AdvertiseAddr, "advertise address, and registry into etcd.")
}
@ -173,6 +175,16 @@ func (c *Config) AddPrometheusFlag(cmd *pflag.FlagSet) {
}
func (c *Config) CompleteConfig() {
// parse etcd urls line to array
for _, url := range strings.Split(c.EtcdEndpointsLine, ",") {
c.EtcdEndpoints = append(c.EtcdEndpoints, url)
}
if len(c.EtcdEndpoints) < 1 {
logrus.Error("Must define the etcd endpoints by --etcd-endpoints")
os.Exit(17)
}
// parse values from prometheus options to config
ipPort := strings.TrimLeft(c.AdvertiseAddr, "shttp://")
ipPortArr := strings.Split(ipPort, ":")

View File

@ -70,8 +70,8 @@ func (e *App) toScrape() *prometheus.ScrapeConfig {
return &prometheus.ScrapeConfig{
JobName: e.Name(),
ScrapeInterval: model.Duration(1 * time.Minute),
ScrapeTimeout: model.Duration(30 * time.Second),
ScrapeInterval: model.Duration(5 * time.Second),
ScrapeTimeout: model.Duration(4 * time.Second),
MetricsPath: "/app/metrics",
ServiceDiscoveryConfig: prometheus.ServiceDiscoveryConfig{
StaticConfigs: []*prometheus.Group{

View File

@ -73,17 +73,17 @@ Rainbond遵循LGPL-3.0 license协议发布详情查看[LICENSE](https://githu
感谢以下开源项目
* [kubernetes](https://github.com/kubernetes/kubernetes)
* [docker/moby](https://github.com/moby/moby)
* [heroku buildpack](https://github.com/heroku)
* [openresty](https://github.com/openresty/)
* [calico](https://github.com/projectcalico)
* [midonet](https://github.com/midonet/midonet)
* [etcd](https://github.com/coreos/etcd)
* [prometheus](https://github.com/prometheus/prometheus)
* [glusterfs](https://github.com/gluster/glusterfs)
* [ceph](https://github.com/ceph/ceph)
* [cockroachDB](https://github.com/cockroachdb/cockroach)
* [mysql](https://github.com/mysqljs/mysql)
* [Kubernetes](https://github.com/kubernetes/kubernetes)
* [Docker/Moby](https://github.com/moby/moby)
* [Heroku Buildpacks](https://github.com/heroku?utf8=%E2%9C%93&q=buildpack&type=&language=)
* [OpenResty](https://github.com/openresty/)
* [Calico](https://github.com/projectcalico)
* [Midonet](https://github.com/midonet/midonet)
* [Etcd](https://github.com/coreos/etcd)
* [Prometheus](https://github.com/prometheus/prometheus)
* [GlusterFS](https://github.com/gluster/glusterfs)
* [Ceph](https://github.com/ceph/ceph)
* [CockroachDB](https://github.com/cockroachdb/cockroach)
* [MySQL](https://github.com/mysql/mysql-server)
* [Weave Scope](https://github.com/weaveworks/scope)
* [Ant Design](https://github.com/ant-design/ant-design)