作者 yangfu

配置修改

1 -FROM 192.168.0.243:5000/mmm/mmmopp:20200226 as builder 1 +FROM 192.168.0.243:5000/mmm/mmmopp:20200422 as builder
2 #FROM golang:1.13 as builder 2 #FROM golang:1.13 as builder
3 ENV GOPROXY https://goproxy.cn 3 ENV GOPROXY https://goproxy.cn
4 ENV GO111MODULE on 4 ENV GO111MODULE on
@@ -2,3 +2,11 @@ @@ -2,3 +2,11 @@
2 #Ali could 2 #Ali could
3 AccessKeyID ="LTAI4FhiZ3UktC6N1u3H5GFC" 3 AccessKeyID ="LTAI4FhiZ3UktC6N1u3H5GFC"
4 AccessKeySecret ="UyspWwdni55CYQ02hUCint4qY2jNYO" 4 AccessKeySecret ="UyspWwdni55CYQ02hUCint4qY2jNYO"
  5 +
  6 +#日志
  7 +log_level = "${LOG_LEVEL||debug}"
  8 +aliyun_logs_access ="${aliyun_logs_access||F:/log/app.log}"
  9 +
  10 +#阿里云
  11 +cname ="https://media.goexample.live/"
  12 +
@@ -3,3 +3,9 @@ @@ -3,3 +3,9 @@
3 AccessKeyID ="LTAI4FhiZ3UktC6N1u3H5GFC" 3 AccessKeyID ="LTAI4FhiZ3UktC6N1u3H5GFC"
4 AccessKeySecret ="UyspWwdni55CYQ02hUCint4qY2jNYO" 4 AccessKeySecret ="UyspWwdni55CYQ02hUCint4qY2jNYO"
5 5
  6 +#日志
  7 +log_level = "${LOG_LEVEL||debug}"
  8 +aliyun_logs_access ="${aliyun_logs_access||F:/log/app.log}"
  9 +
  10 +#阿里云
  11 +cname ="https://media.goexample.live/"
@@ -112,6 +112,7 @@ func (this *VodController) CreateUploadImages() { @@ -112,6 +112,7 @@ func (this *VodController) CreateUploadImages() {
112 err = e 112 err = e
113 break 113 break
114 } else { 114 } else {
  115 + rsp.FileName = r.FileName
115 response.List = append(response.List, rsp) 116 response.List = append(response.List, rsp)
116 } 117 }
117 } 118 }
1 #!/bin/bash 1 #!/bin/bash
2 export PATH=/root/local/bin:$PATH 2 export PATH=/root/local/bin:$PATH
3 -kubectl -n mmm-suplus-dev get pods | grep -q mmmopp 3 +kubectl -n mmm-suplus-dev get pods | grep -q mmmopenapi
4 if [ "$?" == "1" ];then 4 if [ "$?" == "1" ];then
5 kubectl create -f /tmp/dev/mmm-go-opp/opp.yaml --record 5 kubectl create -f /tmp/dev/mmm-go-opp/opp.yaml --record
6 - kubectl -n mmm-suplus-dev get svc | grep -q mmmopp 6 + kubectl -n mmm-suplus-dev get svc | grep -q mmmopenapi
7 if [ "$?" == "0" ];then 7 if [ "$?" == "0" ];then
8 - echo "mmmopp service install success!" 8 + echo "mmmopenapi service install success!"
9 else 9 else
10 - echo "mmmopp service install fail!" 10 + echo "mmmopenapi service install fail!"
11 fi 11 fi
12 - kubectl -n mmm-suplus-dev get pods | grep -q mmmopp 12 + kubectl -n mmm-suplus-dev get pods | grep -q mmmopenapi
13 if [ "$?" == "0" ];then 13 if [ "$?" == "0" ];then
14 - echo "mmmopp deployment install success!" 14 + echo "mmmopenapi deployment install success!"
15 else 15 else
16 - echo "mmmopp deployment install fail!" 16 + echo "mmmopenapi deployment install fail!"
17 fi 17 fi
18 else 18 else
19 kubectl delete -f /tmp/dev/mmm-go-opp/opp.yaml 19 kubectl delete -f /tmp/dev/mmm-go-opp/opp.yaml
20 - kubectl -n mmm-suplus-dev get svc | grep -q mmmopp 20 + kubectl -n mmm-suplus-dev get svc | grep -q mmmopenapi
21 while [ "$?" == "0" ] 21 while [ "$?" == "0" ]
22 do 22 do
23 - kubectl -n mmm-suplus-dev get svc | grep -q mmmopp 23 + kubectl -n mmm-suplus-dev get svc | grep -q mmmopenapi
24 done 24 done
25 - kubectl -n mmm-suplus-dev get pods | grep -q mmmopp 25 + kubectl -n mmm-suplus-dev get pods | grep -q mmmopenapi
26 while [ "$?" == "0" ] 26 while [ "$?" == "0" ]
27 do 27 do
28 - kubectl -n mmm-suplus-dev get pods | grep -q mmmopp 28 + kubectl -n mmm-suplus-dev get pods | grep -q mmmopenapi
29 done 29 done
30 kubectl create -f /tmp/dev/mmm-go-opp/opp.yaml --record 30 kubectl create -f /tmp/dev/mmm-go-opp/opp.yaml --record
31 - kubectl -n mmm-suplus-dev get svc | grep -q mmmopp 31 + kubectl -n mmm-suplus-dev get svc | grep -q mmmopenapi
32 if [ "$?" == "0" ];then 32 if [ "$?" == "0" ];then
33 - echo "mmmopp service update success!" 33 + echo "mmmopenapi service update success!"
34 else 34 else
35 echo "opp service update fail!" 35 echo "opp service update fail!"
36 fi 36 fi
1 apiVersion: v1 1 apiVersion: v1
2 kind: Service 2 kind: Service
3 metadata: 3 metadata:
4 - name: mmmopp 4 + name: mmmopenapi
5 namespace: mmm-suplus-dev 5 namespace: mmm-suplus-dev
6 labels: 6 labels:
7 - k8s-app: mmmopp 7 + k8s-app: mmmopenapi
8 spec: 8 spec:
9 ports: 9 ports:
10 - name: "http" 10 - name: "http"
11 port: 80 11 port: 80
12 targetPort: 8080 12 targetPort: 8080
13 selector: 13 selector:
14 - k8s-app: mmmopp 14 + k8s-app: mmmopenapi
15 --- 15 ---
16 apiVersion: extensions/v1beta1 16 apiVersion: extensions/v1beta1
17 kind: Deployment 17 kind: Deployment
18 metadata: 18 metadata:
19 - name: mmmopp 19 + name: mmmopenapi
20 namespace: mmm-suplus-dev 20 namespace: mmm-suplus-dev
21 labels: 21 labels:
22 - k8s-app: mmmopp 22 + k8s-app: mmmopenapi
23 spec: 23 spec:
24 replicas: 1 24 replicas: 1
25 template: 25 template:
26 metadata: 26 metadata:
27 labels: 27 labels:
28 - k8s-app: mmmopp 28 + k8s-app: mmmopenapi
29 spec: 29 spec:
30 affinity: 30 affinity:
31 nodeAffinity: 31 nodeAffinity:
@@ -43,8 +43,8 @@ spec: @@ -43,8 +43,8 @@ spec:
43 - cn-hangzhou.i-bp1euf5u1ph9kbhtndhb 43 - cn-hangzhou.i-bp1euf5u1ph9kbhtndhb
44 - cn-hangzhou.i-bp1hyp5oips9cdwxxgxy 44 - cn-hangzhou.i-bp1hyp5oips9cdwxxgxy
45 containers: 45 containers:
46 - - name: mmmopp  
47 - image: 192.168.0.243:5000/mmm/mmmopp:dev 46 + - name: mmmopenapi
  47 + image: 192.168.0.243:5000/mmm/mmmopenapi:dev
48 imagePullPolicy: Always 48 imagePullPolicy: Always
49 volumeMounts: 49 volumeMounts:
50 - mountPath: /opt/logs 50 - mountPath: /opt/logs
@@ -5,6 +5,7 @@ type CreateUploadImageRequest struct { @@ -5,6 +5,7 @@ type CreateUploadImageRequest struct {
5 } 5 }
6 6
7 type CreateUploadImageResponse struct { 7 type CreateUploadImageResponse struct {
  8 + FileName string `json:"fileName"` //客户端带上来的/可用于关联
8 RequestId string `json:"requestId"` 9 RequestId string `json:"requestId"`
9 ImageId string `json:"imageId" ` 10 ImageId string `json:"imageId" `
10 ImageURL string `json:"imageURL"` 11 ImageURL string `json:"imageURL"`
@@ -61,7 +61,7 @@ func CreateUploadVideo(client *vod.Client, r *CreateUploadVideoRequest) (respons @@ -61,7 +61,7 @@ func CreateUploadVideo(client *vod.Client, r *CreateUploadVideoRequest) (respons
61 if up, e := ParseUploadAddress(rsp.UploadAddress); e != nil { 61 if up, e := ParseUploadAddress(rsp.UploadAddress); e != nil {
62 log.Error(e) 62 log.Error(e)
63 } else { 63 } else {
64 - response.FileURL = up.GetFileUrl("") 64 + response.FileURL = up.GetFileUrl(beego.AppConfig.String("cname"))
65 } 65 }
66 return 66 return
67 } 67 }
@@ -82,7 +82,7 @@ func RefreshUploadVideo(client *vod.Client, r *RefreshUploadVideoRequest) (respo @@ -82,7 +82,7 @@ func RefreshUploadVideo(client *vod.Client, r *RefreshUploadVideoRequest) (respo
82 if up, e := ParseUploadAddress(rsp.UploadAddress); e != nil { 82 if up, e := ParseUploadAddress(rsp.UploadAddress); e != nil {
83 log.Error(e) 83 log.Error(e)
84 } else { 84 } else {
85 - response.FileURL = up.GetFileUrl("") 85 + response.FileURL = up.GetFileUrl(beego.AppConfig.String("cname"))
86 } 86 }
87 return 87 return
88 } 88 }
@@ -9,8 +9,8 @@ import ( @@ -9,8 +9,8 @@ import (
9 var nsV1 *beego.Namespace 9 var nsV1 *beego.Namespace
10 10
11 func init() { 11 func init() {
12 - nsV1 := beego.NewNamespace("v1",  
13 - beego.NSNamespace("vod", beego.NSBefore(controllers.FilterComm), beego.NSBefore(controllers.AllowOption), beego.NSInclude(&v1.VodController{})),  
14 - )  
15 - beego.AddNamespace(nsV1) 12 + nsVod := beego.NewNamespace("vod", beego.NSBefore(controllers.LogRequestData), beego.NSBefore(controllers.AllowOption), beego.NSInclude(&v1.VodController{}))
  13 +
  14 + beego.SetStaticPath("/log", beego.AppConfig.String("aliyun_logs_access"))
  15 + beego.AddNamespace(nsVod)
16 } 16 }
@@ -51,6 +51,7 @@ func CreateUploadImage(header *protocol.RequestHeader, request *aliyun.CreateUpl @@ -51,6 +51,7 @@ func CreateUploadImage(header *protocol.RequestHeader, request *aliyun.CreateUpl
51 request.FileName = aliyun.DefaultImageFileName 51 request.FileName = aliyun.DefaultImageFileName
52 } 52 }
53 rsp, err = aliyun.CreateUploadImage(client, request) 53 rsp, err = aliyun.CreateUploadImage(client, request)
  54 + rsp.FileURL = rsp.ImageURL
54 if err != nil { 55 if err != nil {
55 log.Error(err) 56 log.Error(err)
56 } 57 }