Skip to content

Commit

Permalink
Merge pull request meshery#37 from layer5io/feature/integrate-with-saas
Browse files Browse the repository at this point in the history
Feature/integrate with saas
fixes meshery#7 
fixes meshery#11 
fixes meshery#25

Signed-off: raghavaggarwal99<ragha170103048@iitg.ac.in>
  • Loading branch information
girishranganathan committed Feb 6, 2019
2 parents 4c1df9a + 160d184 commit 2164439
Show file tree
Hide file tree
Showing 25 changed files with 936 additions and 473 deletions.
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
FROM golang:1.11.5 as bd
RUN adduser --disabled-login appuser
WORKDIR /github.com/layer5io/meshery
ADD . .
RUN cd cmd; go build -a -o /meshery .
RUN cd cmd; go build -ldflags="-w -s" -a -o /meshery .
RUN find . -name "*.go" -type f -delete; mv public /; mv meshes /
RUN cd /public/static/js; wget https://raw.githubusercontent.com/fortio/fortio/master/ui/static/js/Chart.min.js
RUN cd /public/static/js; wget https://raw.githubusercontent.com/fortio/fortio/master/ui/static/js/fortio_chart.js
Expand All @@ -12,5 +13,7 @@ RUN mkdir /lib64 && ln -s /lib/libc.musl-x86_64.so.1 /lib64/ld-linux-x86-64.so.2
COPY --from=bd /meshery /app/cmd/
COPY --from=bd /public /app/public
COPY --from=bd /meshes /app/meshes
COPY --from=bd /etc/passwd /etc/passwd
USER appuser
WORKDIR /app/cmd
CMD ./meshery
96 changes: 0 additions & 96 deletions appoptics/ao.go

This file was deleted.

34 changes: 0 additions & 34 deletions appoptics/ao_test.go

This file was deleted.

65 changes: 40 additions & 25 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,48 +2,63 @@ package main

import (
"context"
"net/http"
"os"

"github.com/satori/go.uuid"

"github.com/gorilla/sessions"
"github.com/layer5io/meshery/handlers"
"github.com/layer5io/meshery/meshes/istio"
"github.com/layer5io/meshery/models"
"github.com/layer5io/meshery/router"
"github.com/spf13/viper"

"github.com/sirupsen/logrus"
)

func main() {
ctx := context.Background()

twitterHost := os.Getenv("TWITTER_APP_HOST")
if twitterHost == "" && os.Getenv("BYPASS_AUTH") != "true" {
logrus.Fatalf("TWITTER_APP_HOST environment variable not set.")
viper.AutomaticEnv()

viper.SetDefault("PORT", 8080)

if viper.GetBool("DEBUG") {
logrus.SetLevel(logrus.DebugLevel)
}
logrus.Infof("Log level: %s", logrus.GetLevel())

byPassAuth := viper.GetBool("BYPASS_AUTH")

fortio := os.Getenv("FORTIO_URL")
saasBaseURL := viper.GetString("SAAS_BASE_URL")
if saasBaseURL == "" && !byPassAuth {
logrus.Fatalf("SAAS_BASE_URL environment variable not set.")
}

fortio := viper.GetString("FORTIO_URL")
if fortio == "" {
logrus.Fatalf("FORTIO_URL environment variable not set.")
}

productPageURL := os.Getenv("PRODUCT_PAGE_URL")
if productPageURL == "" {
logrus.Fatalf("PRODUCT_PAGE_URL environment variable not set.")
}
fileSessionStore := sessions.NewFilesystemStore("", []byte(uuid.NewV4().Bytes()))
fileSessionStore.MaxLength(0)

meshClient, err := istio.CreateIstioClient(ctx)
if err != nil {
logrus.Fatalf("Error creating an istio client: %v", err)
}
config := &handlers.ServerConfig{
MeshClient: meshClient,
}
h := handlers.NewHandlerInstance(&models.HandlerConfig{
ByPassAuth: byPassAuth,
FortioURL: fortio,
SaaSBaseURL: saasBaseURL,

port := os.Getenv("PORT")
if port == "" {
port = "8080"
}
logrus.Infof("Starting Server listening on %s", (":" + port))
err = http.ListenAndServe(":"+port, handlers.New(ctx, config))
if err != nil {
RefCookieName: "meshery_ref",

SessionName: "meshery",
SessionStore: fileSessionStore,

SaaSTokenName: "meshery_saas",
})

port := viper.GetInt("PORT")
r := router.NewRouter(ctx, h, port)

logrus.Infof("Starting Server listening on :%d", port)
if err := r.Run(); err != nil {
logrus.Fatalf("ListenAndServe Error: %v", err)
}
}
46 changes: 42 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
module github.com/layer5io/meshery

require (
github.com/BurntSushi/toml v0.3.1 // indirect
github.com/Joker/jade v1.0.0 // indirect
github.com/PuerkitoBio/purell v1.1.0
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578
github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398 // indirect
github.com/ajg/form v0.0.0-20160822230020-523a5da1a92f // indirect
github.com/appoptics/appoptics-api-go v0.0.0-20181003115124-15d9e654ec9f
github.com/aws/aws-sdk-go v1.16.26 // indirect
github.com/aymerick/raymond v2.0.2+incompatible // indirect
github.com/dghubble/sessions v0.0.0-20181016072817-1a1dc0d676d4
github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385 // indirect
github.com/emicklei/go-restful v2.8.0+incompatible
github.com/fatih/structs v1.1.0 // indirect
github.com/flosch/pongo2 v0.0.0-20181225140029-79872a7b2769 // indirect
github.com/gavv/monotime v0.0.0-20171021193802-6f8212e8d10d // indirect
github.com/ghodss/yaml v1.0.0
github.com/go-openapi/jsonpointer v0.17.2
github.com/go-openapi/jsonreference v0.17.2
Expand All @@ -15,29 +25,57 @@ require (
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
github.com/golang/protobuf v1.2.0
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c
github.com/google/go-querystring v1.0.0 // indirect
github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf
github.com/googleapis/gnostic v0.2.0
github.com/gorilla/securecookie v1.1.1
github.com/gorilla/sessions v1.1.3
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7
github.com/howeyc/gopass v0.0.0-20170109162249-bf9dde6d0d2c
github.com/imdario/mergo v0.3.6
github.com/imkira/go-interpol v1.1.0 // indirect
github.com/iris-contrib/blackfriday v2.0.0+incompatible // indirect
github.com/iris-contrib/formBinder v0.0.0-20190104093907-fbd5963f41e1 // indirect
github.com/iris-contrib/go.uuid v2.0.0+incompatible // indirect
github.com/iris-contrib/httpexpect v0.0.0-20180314041918-ebe99fcebbce // indirect
github.com/json-iterator/go v1.1.5
github.com/juju/ratelimit v1.0.1
github.com/kataras/golog v0.0.0-20180321173939-03be10146386 // indirect
github.com/kataras/iris v11.1.1+incompatible // indirect
github.com/kataras/pio v0.0.0-20190103105442-ea782b38602d // indirect
github.com/klauspost/compress v1.4.1 // indirect
github.com/klauspost/cpuid v1.2.0 // indirect
github.com/konsorten/go-windows-terminal-sequences v1.0.1
github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329
github.com/microcosm-cc/bluemonday v1.0.2 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742
github.com/moul/http2curl v1.0.0 // indirect
github.com/petar/GoLLRB v0.0.0-20130427215148-53be0d36a84c
github.com/peterbourgon/diskv v2.0.1+incompatible
github.com/pkg/errors v0.8.0
github.com/prometheus/promu v0.2.0 // indirect
github.com/ryanuber/columnize v2.1.0+incompatible // indirect
github.com/satori/go.uuid v1.2.0
github.com/savaki/dynastore v0.0.0-20171109173440-28d8558bb429
github.com/sergi/go-diff v1.0.0 // indirect
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
github.com/sirupsen/logrus v1.1.1
github.com/spf13/pflag v1.0.3
golang.org/x/crypto v0.0.0-20181030022821-bc7917b19d8f
golang.org/x/net v0.0.0-20181029044818-c44066c5c816
golang.org/x/sys v0.0.0-20181029174526-d69651ed3497
github.com/spf13/viper v1.3.1
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/xeipuuv/gojsonschema v1.1.0 // indirect
github.com/yalp/jsonpath v0.0.0-20180802001716-5cc68e5049a0 // indirect
github.com/yudai/gojsondiff v1.0.0 // indirect
github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 // indirect
golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9
golang.org/x/net v0.0.0-20181220203305-927f97764cc3
golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a
golang.org/x/text v0.3.0
google.golang.org/genproto v0.0.0-20190201180003-4b09977fb922 // indirect
gopkg.in/inf.v0 v0.9.1
gopkg.in/yaml.v2 v2.2.1
gopkg.in/yaml.v2 v2.2.2
k8s.io/api v0.0.0-20181027024800-9fcf73cc980b
k8s.io/apimachinery v0.0.0-20180510142256-21efb2924c7c
k8s.io/client-go v6.0.0+incompatible
Expand Down
Loading

0 comments on commit 2164439

Please sign in to comment.