diff --git a/.travis.yml b/.travis.yml index bf625c86a..a194f44d6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,6 +16,7 @@ matrix: script: - pwd - echo '' > /home/travis/gopath/src/github.com/Qihoo360/wayne/src/backend/conf/dev.conf + - export GO111MODULE=on - cd src/backend && go run main.go -h - language: node_js os: diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 7fd8a5dac..000000000 --- a/Dockerfile +++ /dev/null @@ -1,47 +0,0 @@ -# requiring Docker 17.05 or higher on the daemon and client -# see https://docs.docker.com/develop/develop-images/multistage-build/ -# BUILD COMMAND : -# docker --build-arg RELEASE_VERSION=v1.0.0 -t infra/wayne:v1.0.0 . - -# build ui -FROM 360cloud/wayne-ui-builder:v1.0.1 as frontend - -ARG RAVEN_DSN - -COPY src/frontend /workspace - -RUN sed -i "s~__ravenDsn__~${RAVEN_DSN}~g" /workspace/src/environments/environment.prod.ts - -RUN cd /workspace && \ - npm config set registry https://registry.npm.taobao.org && \ - npm install && \ - npm run build - -# build server -FROM 360cloud/wayne-server-builder:v1.0.1 as backend - -COPY go.mod /go/src/github.com/Qihoo360/wayne -COPY go.sum /go/src/github.com/Qihoo360/wayne - -COPY src/backend /go/src/github.com/Qihoo360/wayne/src/backend - -RUN rm -rf /go/src/github.com/Qihoo360/wayne/src/backend/static - -COPY --from=frontend /workspace/dist/ /go/src/github.com/Qihoo360/wayne/src/backend/static/ - -COPY --from=frontend /workspace/dist/index.html /go/src/github.com/Qihoo360/wayne/src/backend/views/ - -RUN export GO111MODULE=on && cd /go/src/github.com/Qihoo360/wayne/src/backend && bee generate docs && bee pack -o /_build - -# build release image -FROM 360cloud/centos:7 - -RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime - -COPY --from=backend /_build/backend.tar.gz /opt/wayne/ - -WORKDIR /opt/wayne/ - -RUN tar -xzvf backend.tar.gz - -CMD ["./backend"] diff --git a/Dockerfile.backend b/Dockerfile.backend new file mode 100644 index 000000000..22497e2e8 --- /dev/null +++ b/Dockerfile.backend @@ -0,0 +1,31 @@ +# requiring Docker 17.05 or higher on the daemon and client +# see https://docs.docker.com/develop/develop-images/multistage-build/ +# BUILD COMMAND : +# docker --build-arg RELEASE_VERSION=v1.0.0 -t infra/wayne:v1.0.0 . + +# build server +FROM 360cloud/wayne-server-builder:v1.0.1 as backend + +COPY go.mod /go/src/github.com/Qihoo360/wayne +COPY go.sum /go/src/github.com/Qihoo360/wayne + +COPY src/backend /go/src/github.com/Qihoo360/wayne/src/backend + +RUN export GO111MODULE=on && \ + export GOPROXY=https://goproxy.io && \ + cd /go/src/github.com/Qihoo360/wayne/src/backend && \ + bee generate docs && \ + bee pack -o /_build + +# build release image +FROM 360cloud/centos:7 + +RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime + +COPY --from=backend /_build/backend.tar.gz /opt/wayne/ + +WORKDIR /opt/wayne/ + +RUN tar -xzvf backend.tar.gz + +CMD ["./backend"] diff --git a/frontend.Dockerfile b/Dockerfile.frontend similarity index 85% rename from frontend.Dockerfile rename to Dockerfile.frontend index 573abcfe4..7d3c4df71 100644 --- a/frontend.Dockerfile +++ b/Dockerfile.frontend @@ -6,12 +6,8 @@ # build ui FROM 360cloud/wayne-ui-builder:v1.0.1 as frontend -ARG RAVEN_DSN - COPY src/frontend /workspace -RUN sed -i "s~__ravenDsn__~${RAVEN_DSN}~g" /workspace/src/environments/environment.prod.ts - RUN cd /workspace && \ npm config set registry https://registry.npm.taobao.org && \ npm install && \ diff --git a/Makefile b/Makefile index 1b6383c18..49be7cc3e 100644 --- a/Makefile +++ b/Makefile @@ -8,14 +8,14 @@ RELEASE_VERSION :=$(shell git describe --always --tags) UI_BUILD_VERSION :=v1.0.1 SERVER_BUILD_VERSION :=v1.0.1 -release: build-release-image push-image +release: build-backend-image build-frontend-image push-image update-version: ./hack/updateversion.sh # run module run-backend: - cd src/backend/ && bee run -main=./main.go -runargs="apiserver" + export GO111MODULE=on && export GOPROXY=https://goproxy.io && cd src/backend/ && bee run -main=./main.go -runargs="apiserver" run-worker: cd src/backend/ && bee run -main=./main.go -runargs="worker -t AuditWorker -c 2" @@ -41,21 +41,25 @@ swagger-openapi: cd src/backend && swagger generate spec -o ./swagger/openapi.swagger.json # release, requiring Docker 17.05 or higher on the daemon and client -build-release-image: +build-backend-image: @echo "version: $(RELEASE_VERSION)" - docker build --no-cache --build-arg RAVEN_DSN=$(RAVEN_DSN) -t $(REGISTRY_URI)/wayne:$(RELEASE_VERSION) . + docker build --no-cache -t $(REGISTRY_URI)/wayne-backend:$(RELEASE_VERSION) -f Dockerfile.backend . build-frontend-image: @echo "version: $(RELEASE_VERSION)" - docker build --no-cache --build-arg RAVEN_DSN=$(RAVEN_DSN) -t $(REGISTRY_URI)/wayne-frontend:$(RELEASE_VERSION) -f frontend.Dockerfile . + docker build --no-cache -t $(REGISTRY_URI)/wayne-frontend:$(RELEASE_VERSION) -f Dockerfile.frontend . push-image: - docker push $(REGISTRY_URI)/wayne:$(RELEASE_VERSION) + docker tag $(REGISTRY_URI)/wayne-backend:$(RELEASE_VERSION) $(REGISTRY_URI)/wayne-backend:latest + docker push $(REGISTRY_URI)/wayne-backend:$(RELEASE_VERSION) + docker push $(REGISTRY_URI)/wayne-backend:latest + docker tag $(REGISTRY_URI)/wayne-frontend:$(RELEASE_VERSION) $(REGISTRY_URI)/wayne-frontend:latest + docker push $(REGISTRY_URI)/wayne-frontend:$(RELEASE_VERSION) + docker push $(REGISTRY_URI)/wayne-frontend:latest ## server builder image build-server-image: - cd hack/build/server && docker build --no-cache \ - -t $(REGISTRY_URI)/wayne-server-builder:$(SERVER_BUILD_VERSION) . + cd hack/build/server && docker build --no-cache -t $(REGISTRY_URI)/wayne-server-builder:$(SERVER_BUILD_VERSION) . ## ui builder image build-ui-image: diff --git a/README-CN.md b/README-CN.md index b330d7556..4fe4df019 100644 --- a/README-CN.md +++ b/README-CN.md @@ -46,7 +46,7 @@ Wayne已大规模服务于360搜索,承载了内部绝大部分业务,稳定 ## 项目依赖 -- Golang 1.9+([installation manual](https://golang.org/dl/)) +- Golang 1.12+([installation manual](https://golang.org/dl/)) - Docker 17.05+ ([installation manual](https://docs.docker.com/install)) - Bee ([installation manual](https://github.com/wilhelmguo/bee)) (请务必使用链接版本,不要使用 beego 官方版本,存在一些定制) - Node.js 8+ and npm 5+ ([installation with nvm](https://github.com/creationix/nvm#usage)) @@ -61,62 +61,19 @@ Wayne已大规模服务于360搜索,承载了内部绝大部分业务,稳定 $ go get github.com/Qihoo360/wayne ``` -- 启动MySQL(可选) +- 启动服务 -若您没有可用的 MySQL 服务,可以通过 docker-compose 快速创建: + 在 Wayne 的根目录下,通过 docker-compose 创建服务 -```bash -$ docker-compose up -d mysql -``` - -- 创建配置文件 - -```bash -$ cd src/backend/conf && touch dev.conf -``` - -- 写入数据库相关配置(请修改为数据库实际地址) - -```bash -DBName = wayne -# MySQL连接配置,默认是mysql(MySQL服务名称). -# 如果使用docker-compose启动MySQL,同时你没有改变mysql的服务名称,那么保留默认配置即可。 -# 你也可以通过执行"docker network inspect wayne_default"(如果没有使用docker-compose -# 的默认网络,需要将“wayne_default”替换为实际使用的网络名称)来获得mysql容器IP,然后将 -# “mysql”替换为其容器IP。当你使用自定义运行环境时,使用容器IP会更加灵活。例如: -# "DBTns = tcp(172.17.0.2:3306)" -DBTns = tcp(mysql:3306) -DBUser = root -DBPasswd = root -``` - -- 启动Wayne服务 - -进入Wayne根目录,执行 - -```bash -$ docker-compose up -d wayne +```shell +$ docker-compose -f ./hack/docker-compose/docker-compose.yaml up ``` 通过上述命令,您可以从通过 http://127.0.0.1:8080/admin 访问本地 Wayne, 默认管理员账号 admin:admin。 -> 注意:项目启动后还需要配置集群和Namespace等信息才可正常使用。详见 [集群配置](https://github.com/Qihoo360/wayne/wiki/Wayne-admin-cluster) +> 注意:项目启动后还需要配置集群和Namespace等信息才可正常使用。详见 [集群配置](https://360yun.org/wayne/admin/cluster.html) ## 文档 -- 请参照 [Wiki](https://github.com/Qihoo360/wayne/wiki) - -## Roadmap - -- 国际化 -- 支持 Kubernetes 已有项目迁移 -- 支持从 Helm 迁移 -- 支持一键从 Yaml/Json 导入对象 -- 支持 HPA 等其他对象 -- 完善运维 Kubernetes 集群功能,提供完整的 Kubectl 功能 -- 支持更完整的报表和开放 API 系统 - -## 贡献者 - -- 请参照 [贡献者](https://github.com/Qihoo360/wayne/wiki/contributors) +- 请参照 [Wiki](https://360yun.org/wayne/) diff --git a/README.md b/README.md index 869f3b227..e7257a062 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ The whole system adopts the separation of front and back ends, in which the fron ## Dependence -- Golang 1.9+([installation manual](https://golang.org/dl/)) +- Golang 1.12+([installation manual](https://golang.org/dl/)) - Docker 17.05+ ([installation manual](https://docs.docker.com/install)) - Bee ([installation manual](https://github.com/wilhelmguo/bee))(Be sure to use the link version, don't use the official version of beego, there are some customizations.) - Node.js 8+ and npm 5+ ([installation with nvm](https://github.com/creationix/nvm#usage)) @@ -60,64 +60,19 @@ The whole system adopts the separation of front and back ends, in which the fron $ go get github.com/Qihoo360/wayne ``` -- Start MySQL(Optional) - -If you don't have a MySQL service available, you can quickly create it with docker-compose: - -```bash -$ docker-compose up -d mysql -``` - -- Create configuration file - -```bash -$ cd src/backend/conf && touch dev.conf -``` - -- Write database related configuration (Please modify to the actual address of the database.) - -```bash -DBName = wayne -# MySQL connection config, its mysql(service name) by default. -# Keep it default value, if you run MySQL via docker-compose and you didn't -# change the mysql's service name. -# You can also run "docker network inspect wayne_default"(replace wayne_default -# to the real docker network name if you didn't use the default network of -# docker-compose) to get the contianer IP of mysql, then replace `mysql` -# to the container IP. Its more flexible when you want to customize the environment -# of wayne running. For example "DBTns = tcp(172.17.0.2:3306)" -DBTns = tcp(mysql:3306) -DBUser = root -DBPasswd = root -``` - - Start Wayne -cd Wayne root directory and execute + Start server by docker-compose at Wayne project. ```bash -$ docker-compose up -d wayne +$ docker-compose -f ./hack/docker-compose/docker-compose.yaml up ``` With the above command, you can access the local Wayne from http://127.0.0.1:8080/admin, the default administrator account admin:admin. -> Note: After Wayne is started, you need to configure information such as cluster and Namespace for normal use. See details [Cluster Configuration](https://github.com/Qihoo360/wayne/wiki/Wayne-admin-cluster) +> Note: After Wayne is started, you need to configure information such as cluster and Namespace for normal use. See details [Cluster Configuration](https://360yun.org/wayne/admin/cluster.html) ## Document -- Refer [Wiki](https://github.com/Qihoo360/wayne/wiki) - -## Roadmap - -- i18n -- Support for migration of existing projects in kubernetes -- Support for migration from Helm -- Support for importing objects from Yaml/Json with one click -- Support for other objects such as HPA -- Improve operation and maintenance Kubernetes cluster function, providing complete Kubectl function -- Support for more complete reporting and open API system - -## Contributors - -- Refer [contributors](https://github.com/Qihoo360/wayne/wiki/contributors) +- Refer [Wiki](https://360yun.org/wayne/) diff --git a/docker-compose.yaml b/docker-compose.yaml deleted file mode 100644 index d2b0223ad..000000000 --- a/docker-compose.yaml +++ /dev/null @@ -1,37 +0,0 @@ -version: '2' -services: - rabbitmq: - environment: - RABBITMQ_NODENAME: "rabbit" - RABBITMQ_DEFAULT_USER: "guest" - RABBITMQ_DEFAULT_PASS: "guest" - image: rabbitmq:3.7.8-management - networks: - - default - ports: - - "5672:5672" - mysql: - image: mysql:5.6.41 - environment: - MYSQL_ROOT_PASSWORD: "root" - volumes: - - ./_dev/mysql:/var/lib/mysql:z - networks: - - default - expose: - - "3306" - ports: - - "3306:3306" - wayne: - image: 360cloud/wayne:latest - command: /opt/wayne/backend apiserver - environment: - GOPATH: "/go" - volumes: - - ./src/backend/conf:/opt/wayne/conf:z - networks: - - default - expose: - - "8080" - ports: - - "8080:8080" diff --git a/go.mod b/go.mod index 9f9398d14..e935bee68 100644 --- a/go.mod +++ b/go.mod @@ -2,22 +2,6 @@ module github.com/Qihoo360/wayne go 1.12 -replace ( - golang.org/x/crypto => github.com/golang/crypto v0.0.0-20190403202508-8e1b8d32e692 - golang.org/x/exp => github.com/golang/exp v0.0.0-20190402192236-7fd597ecf556 - golang.org/x/image => github.com/golang/image v0.0.0-20190321063152-3fc05d484e9f - golang.org/x/lint => github.com/golang/lint v0.0.0-20190313153728-d0100b6bd8b3 - golang.org/x/mobile => github.com/golang/mobile v0.0.0-20190327163128-167ebed0ec6d - golang.org/x/net => github.com/golang/net v0.0.0-20190403144856-b630fd6fe46b - golang.org/x/oauth2 => github.com/golang/oauth2 v0.0.0-20190402181905-9f3314589c9a - golang.org/x/sync => github.com/golang/sync v0.0.0-20190227155943-e225da77a7e6 - golang.org/x/sys => github.com/golang/sys v0.0.0-20190403152447-81d4e9dc473e - golang.org/x/text => github.com/golang/text v0.3.0 - golang.org/x/time => github.com/golang/time v0.0.0-20190308202827-9d24e82272b4 - golang.org/x/tools => github.com/golang/tools v0.0.0-20190403183509-8a44e74612bc - google.golang.org/appengine => github.com/golang/appengine v1.4.0 -) - require ( github.com/astaxie/beego v1.11.1 github.com/certifi/gocertifi v0.0.0-20190410005359-59a85de7f35e // indirect diff --git a/hack/docker-compose/conf/app.conf b/hack/docker-compose/conf/app.conf new file mode 100644 index 000000000..2a7c7a8e3 --- /dev/null +++ b/hack/docker-compose/conf/app.conf @@ -0,0 +1,94 @@ +appname = wayne +httpport = 8080 +runmode = prod +autorender = false +copyrequestbody = true +EnableDocs = true +EnableAdmin = true +StaticDir = public:static + +# Custom config +ShowSql = false + +## if enable username and password login +EnableDBLogin = true + +# token, generate jwt token +RsaPrivateKey = "./apikey/rsa-private.pem" +RsaPublicKey = "./apikey/rsa-public.pem" + +# token end time. second +TokenLifeTime=86400 + +# kubernetes labels config +AppLabelKey= wayne-app +NamespaceLabelKey = wayne-ns +PodAnnotationControllerKindLabelKey = wayne.cloud/controller-kind + +# database configuration: +## mysql +DBName = "wayne" +DBTns = "tcp(mysql:3306)" +DBUser = "root" +DBPasswd = "root" +DBLoc = "Asia%2FShanghai" +DBConnTTL = 30 + +# web shell auth +appKey = "860af247a91a19b2368d6425797921c6" + +# Set demo namespace and group id +DemoGroupId = "1" +DemoNamespaceId = "1" + +# Sentry +LogLevel = "4" +SentryEnable = false +SentryDSN = "" +SentryLogLevel = "4" + +# Robin +EnableRobin = false + +# api-keys +EnableApiKeys = true + +# Bus +BusEnable = true +BusRabbitMQURL = "amqp://guest:guest@rabbitmq:5672" + +# Webhook +EnableWebhook = true +WebhookClientTimeout = 10 +WebhookClientWindowSize = 16 + +# other +# Use Canary/Production Update +# If set app metaData {"mode":"beta"},the app will auto redirect to BetaUrl +BetaUrl = "" +AppUrl = "" + +# oauth2 +[auth.oauth2] +redirect_url = "https://www.wayne.cloud" +enabled = false +client_id = client +client_secret = secret +auth_url = https://example.com/oauth2/v1/authorize +token_url = https://example.com/oauth2/v1/token +api_url = https://example.com/oauth2/v1/userinfo +# If your OAuth 2.0-based authorization service does not have email, name, and dispaly fields, use mapping criteria. +api_mapping = name:name,email:email,display:display + +# ldap config +# enable ldap login +[auth.ldap] +enabled = false +ldap_url = ldap://127.0.0.1 +ldap_search_dn = "cn=admin,dc=example,dc=com" +ldap_search_password = admin +ldap_base_dn = "dc=example,dc=com" +ldap_filter = +ldap_uid = cn +ldap_scope = 2 +ldap_connection_timeout = 30 diff --git a/hack/docker-compose/conf/config.js b/hack/docker-compose/conf/config.js new file mode 100644 index 000000000..56b4206c9 --- /dev/null +++ b/hack/docker-compose/conf/config.js @@ -0,0 +1,5 @@ +window.CONFIG = { + URL: 'http://localhost:8080', + RAVEN: false, + RAVEN_DSN: 'RAVEN_DSN' +}; diff --git a/hack/docker-compose/docker-compose.yaml b/hack/docker-compose/docker-compose.yaml new file mode 100644 index 000000000..df2be2617 --- /dev/null +++ b/hack/docker-compose/docker-compose.yaml @@ -0,0 +1,50 @@ +version: '3' +services: + mysql: + image: mysql:5.6.41 + environment: + MYSQL_ROOT_PASSWORD: "root" + networks: + - default + expose: + - "3306" + ports: + - "3306:3306" + rabbitmq: + environment: + RABBITMQ_NODENAME: "rabbit" + RABBITMQ_DEFAULT_USER: "guest" + RABBITMQ_DEFAULT_PASS: "guest" + image: rabbitmq:3.7.8-management + networks: + - default + expose: + - "5672" + ports: + - "5672:5672" + wayne-backend: + image: 360cloud/wayne-backend:latest + command: /opt/wayne/backend apiserver + environment: + GOPATH: "/go" + volumes: + - ./conf/app.conf:/opt/wayne/conf/app.conf + depends_on: + - mysql + - rabbitmq + restart: always + networks: + - default + ports: + - "8080:8080" + wayne-frontend: + image: 360cloud/wayne-frontend:latest + volumes: + - ./conf/config.js:/usr/local/openresty/nginx/html/config.js + depends_on: + - wayne-backend + restart: always + networks: + - default + ports: + - "4200:80" \ No newline at end of file diff --git a/hack/kubernetes/wayne/configmap.yaml b/hack/kubernetes/wayne/configmap.yaml index b7b1220d8..9f6595362 100644 --- a/hack/kubernetes/wayne/configmap.yaml +++ b/hack/kubernetes/wayne/configmap.yaml @@ -2,8 +2,8 @@ apiVersion: v1 kind: ConfigMap metadata: labels: - app: infra-wayne - name: infra-wayne + app: wayne-backend + name: wayne-backend namespace: default data: app.conf: |- @@ -15,13 +15,17 @@ data: EnableDocs = true EnableAdmin = true StaticDir = public:static + # Custom config ShowSql = false + ## if enable username and password login EnableDBLogin = true + # token, generate jwt token RsaPrivateKey = "./apikey/rsa-private.pem" RsaPublicKey = "./apikey/rsa-public.pem" + # token end time. second TokenLifeTime=86400 @@ -36,7 +40,6 @@ data: DBTns = "tcp(mysql-wayne:3306)" DBUser = "root" DBPasswd = "root" - DBLoc = "Asia%2FShanghai" DBConnTTL = 30 # web shell auth @@ -66,3 +69,20 @@ data: EnableWebhook = true WebhookClientTimeout = 10 WebhookClientWindowSize = 16 + +--- + +apiVersion: v1 +kind: ConfigMap +metadata: + labels: + app: wayne-frontend + name: wayne-frontend + namespace: default +data: + config.js: |- + window.CONFIG = { + URL: 'http://wayne.backend:8080', + RAVEN: false, + RAVEN_DSN: 'RAVEN_DSN' + }; \ No newline at end of file diff --git a/hack/kubernetes/wayne/deployment.yaml b/hack/kubernetes/wayne/deployment.yaml index 0e7ce13be..f88778c55 100644 --- a/hack/kubernetes/wayne/deployment.yaml +++ b/hack/kubernetes/wayne/deployment.yaml @@ -1,27 +1,27 @@ -apiVersion: extensions/v1beta1 +apiVersion: apps/v1 kind: Deployment metadata: labels: - app: infra-wayne - name: infra-wayne + app: wayne-backend + name: wayne-backend namespace: default spec: replicas: 1 selector: matchLabels: - app: infra-wayne + app: wayne-backend template: metadata: labels: - app: infra-wayne + app: wayne-backend spec: volumes: - name: config configMap: - name: infra-wayne + name: wayne-backend containers: - name: wayne - image: '360cloud/wayne:latest' + image: '360cloud/wayne-backend:latest' command: - /opt/wayne/backend - apiserver @@ -46,98 +46,45 @@ spec: periodSeconds: 10 failureThreshold: 3 imagePullPolicy: Always + --- + +apiVersion: apps/v1 kind: Deployment -apiVersion: extensions/v1beta1 metadata: - name: infra-wayne-woker - namespace: default labels: - app: infra-wayne-woker -spec: - replicas: 1 - selector: - matchLabels: - app: infra-wayne-woker - template: - metadata: - labels: - app: infra-wayne-woker - spec: - volumes: - - name: config - configMap: - name: infra-wayne - containers: - - name: wayne - image: '360cloud/wayne:latest' - command: - - /opt/wayne/backend - args: - - worker - - '-t' - - AuditWorker - - '-c' - - '1' - env: - - name: GOPATH - value: /go - resources: - limits: - cpu: '0.5' - memory: 0.5Gi - requests: - cpu: '0.5' - memory: 0.5Gi - volumeMounts: - - name: config - mountPath: /opt/wayne/conf/ - imagePullPolicy: Always ---- -kind: Deployment -apiVersion: extensions/v1beta1 -metadata: - name: infra-wayne-webhook + app: wayne-frontend + name: wayne-frontend namespace: default - labels: - app: infra-wayne-webhook spec: replicas: 1 selector: matchLabels: - app: infra-wayne-webhook + app: wayne-frontend template: metadata: labels: - app: infra-wayne-webhook + app: wayne-frontend spec: volumes: - name: config configMap: - name: infra-wayne + name: wayne-frontend + items: + - key: config.js + path: config.js containers: - name: wayne - image: '360cloud/wayne:latest' - command: - - /opt/wayne/backend - args: - - worker - - '-t' - - WebhookWorker - - '-c' - - '1' - env: - - value: /go - name: GOPATH + image: '360cloud/wayne-frontend:latest' resources: limits: cpu: '0.5' - memory: 0.5Gi + memory: 1Gi requests: cpu: '0.5' - memory: 0.5Gi + memory: 1Gi volumeMounts: - name: config - mountPath: /opt/wayne/conf/ - imagePullPolicy: Always - + mountPath: /usr/local/openresty/nginx/html/config.js + subPath: config.js + imagePullPolicy: Always \ No newline at end of file diff --git a/hack/kubernetes/wayne/service.yaml b/hack/kubernetes/wayne/service.yaml index 5d6480345..506f8dafb 100644 --- a/hack/kubernetes/wayne/service.yaml +++ b/hack/kubernetes/wayne/service.yaml @@ -2,14 +2,34 @@ apiVersion: v1 kind: Service metadata: labels: - app: infra-wayne - name: infra-wayne + app: wayne-backend + name: wayne-backend namespace: default spec: type: NodePort ports: - - port: 8080 + - nodePort: 8080 protocol: TCP + port: 8080 targetPort: 8080 selector: - app: infra-wayne \ No newline at end of file + app: wayne-backend + +--- + +apiVersion: v1 +kind: Service +metadata: + labels: + app: wayne-frontend + name: wayne-frontend + namespace: default +spec: + type: NodePort + ports: + - nodePort: 4200 + protocol: TCP + port: 80 + targetPort: 80 + selector: + app: wayne-frontend \ No newline at end of file diff --git a/src/backend/initial/db.go b/src/backend/initial/db.go index aa50c7b70..d38efa6ce 100644 --- a/src/backend/initial/db.go +++ b/src/backend/initial/db.go @@ -96,5 +96,5 @@ func ensureDatabase() error { } func addLocation(dbURL string) string { - return fmt.Sprintf("%s?charset=utf8&loc=%s", dbURL, beego.AppConfig.DefaultString("DBLoc", "Asia/Shanghai")) + return fmt.Sprintf("%s?charset=utf8&loc=%s", dbURL, beego.AppConfig.DefaultString("DBLoc", "Asia%2FShanghai")) } diff --git a/src/frontend/angular.json b/src/frontend/angular.json index 55f8e39bb..10afcc377 100644 --- a/src/frontend/angular.json +++ b/src/frontend/angular.json @@ -23,7 +23,8 @@ "polyfills": "src/polyfills.ts", "tsConfig": "src/tsconfig.app.json", "assets": [ - "src/assets" + "src/assets", + "src/config.js" ], "styles": [ "src/styles.scss", @@ -113,7 +114,8 @@ ], "scripts": [], "assets": [ - "src/assets" + "src/assets", + "src/config.js" ] } }, diff --git a/src/frontend/lib b/src/frontend/lib index 177a320be..f7622a117 160000 --- a/src/frontend/lib +++ b/src/frontend/lib @@ -1 +1 @@ -Subproject commit 177a320befdefa89eeffabfb48634f32c1ee8549 +Subproject commit f7622a1176257e39b1725d094c54424eb107d305 diff --git a/src/frontend/src/app/app.module.ts b/src/frontend/src/app/app.module.ts index cbc3a10ba..127d54092 100644 --- a/src/frontend/src/app/app.module.ts +++ b/src/frontend/src/app/app.module.ts @@ -38,8 +38,8 @@ export function initConfig(authService: AuthService) { }); } -if (environment.ravenDsn && environment.ravenDsn !== '__ravenDsn__') { - Raven.config(environment.ravenDsn).install(); +if (environment.production && (window as any).CONFIG.RAVEN ) { + Raven.config((window as any).CONFIG.RAVEN_DSN).install(); } @@ -55,7 +55,6 @@ export class WayneErrorHandler implements ErrorHandler { } } - @NgModule({ declarations: [ AppComponent @@ -96,7 +95,7 @@ export class WayneErrorHandler implements ErrorHandler { }, { provide: ErrorHandler, - useClass: environment.ravenDsn && environment.ravenDsn !== '__ravenDsn__' ? RavenErrorHandler : WayneErrorHandler + useClass: (window as any).CONFIG.RAVEN ? RavenErrorHandler : WayneErrorHandler } ], bootstrap: [AppComponent] diff --git a/src/frontend/src/app/portal/app/app.component.html b/src/frontend/src/app/portal/app/app.component.html index 2b057ac4d..1b7f2e0a6 100644 --- a/src/frontend/src/app/portal/app/app.component.html +++ b/src/frontend/src/app/portal/app/app.component.html @@ -33,9 +33,9 @@
- = allowNumber" (click)="changeCard()"> - {{'ACTION.FOLD' | translate}} - {{'ACTION.UNFOLD' | translate}} + = allowNumber" (click)="changeCard()"> + {{'ACTION.UNFOLD' | translate}} + {{'ACTION.FOLD' | translate}}