AlieLee преди 3 години
родител
ревизия
d806c54653
променени са 5 файла, в които са добавени 329 реда и са изтрити 1 реда
  1. 1 1
      .gitignore
  2. 31 0
      docker/dockerfiles/bdtp-digital-front/Dockerfile
  3. 97 0
      docker/k8sfiles/bdtp-digital-front-dev.yml
  4. 69 0
      docker/k8sfiles/bdtp-digital-front.yml
  5. 131 0
      docker/k8sfiles/configmap.yml

+ 1 - 1
.gitignore

@@ -1,7 +1,7 @@
 .DS_Store
 node_modules
 .vscode
-bdtp-digital-front
+/bdtp-digital-front
 /dist
 /web-cli
 package-lock.json

+ 31 - 0
docker/dockerfiles/bdtp-digital-front/Dockerfile

@@ -0,0 +1,31 @@
+FROM nginx:1.16.1
+
+MAINTAINER lijie<lijie@persagy.com>
+
+ARG PROGRAM_ID
+ARG PORT_LOCAL
+
+LABEL tier=frontend
+LABEL product=bdtp-digital-front
+LABEL project=persagy
+LABEL name=$PROGRAM_ID
+
+#ENV JAVA_OPTS -Dfile.encoding=UTF-8 -Xms300m -Xmx1024m
+ENV TZ Asia/Shanghai
+ENV WORKER_HOME /usr/persagy/saas-web
+ENV CONFIG_PATH /data/SpringCloud
+ENV PROGRAM_NAME $PROGRAM_ID
+
+WORKDIR $WORKER_HOME
+
+RUN sed -i s@/deb.debian.org/@/mirrors.aliyun.com/@g /etc/apt/sources.list \
+    && apt-get update \
+    && apt-get install -y --no-install-recommends tzdata unzip \
+    && apt-get autoclean \
+    && apt-get clean \
+    && rm -rf /var/lib/apt/lists/*
+
+RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' > /etc/timezone
+COPY *.zip $WORKER_HOME/
+RUN unzip *.zip
+RUN rm -rf ./*.zip

+ 97 - 0
docker/k8sfiles/bdtp-digital-front-dev.yml

@@ -0,0 +1,97 @@
+---
+apiVersion: extensions/v1beta1
+kind: Ingress
+metadata:
+  name: bdtp-digital-front
+  annotations:
+    kubernetes.io/ingress.class: traefik
+    traefik.frontend.rule.type: PathPrefix
+spec:
+  rules:
+    - host: develop.persagy.com
+      http:
+        paths:
+          - path: /bdtp-digital-front
+            backend:
+              serviceName: bdtp-digital-front
+              servicePort: server-port
+
+---
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: bdtp-digital-front
+  labels:
+    name: bdtp-digital-front
+data:
+  
+
+---
+apiVersion: v1
+kind: Service
+metadata:
+  name: bdtp-digital-front
+  labels:
+    app: bdtp-digital-front
+spec:
+  selector:
+    app: bdtp-digital-front
+  ports:
+    - port: 80
+      targetPort: 80
+      name: server-port
+
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: bdtp-digital-front
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      app: bdtp-digital-front
+  template:
+    metadata:
+      labels:
+        app: bdtp-digital-front
+    spec:
+      containers:
+        - name: bdtp-digital-front
+          image: labisenlin.persagy.com/library/bdtp-digital-front:latest
+          imagePullPolicy: Always
+          ports:
+            - containerPort: 80
+              name: server-port
+          resources:
+            limits:
+              memory: 1Gi
+            requests:
+              memory: 512Mi
+          env:
+            - name: TZ
+              value: Asia/Shanghai
+            - name: SERVER_PORT
+              value: "80"
+          volumeMounts:
+            - name: config
+              mountPath: /etc/nginx/nginx.conf
+              subPath: path/to/nginx.conf.js
+            - name: vueconf
+              mountPath: /usr/persagy/saas-web/bdtp-digital-front/vue.config.js
+              subPath: path/to/vue.config.js
+      volumes:
+        - name: config
+          configMap:
+            name: bdtp-digital-front
+            defaultMode: 0777
+            items:
+              - key: nginx.conf
+                path: path/to/nginx.conf.js
+        - name: vueconf
+          configMap:
+            name: bdtp-digital-front
+            defaultMode: 0777
+            items:
+              - key: vue.config.js
+                path: path/to/vue.config.js

+ 69 - 0
docker/k8sfiles/bdtp-digital-front.yml

@@ -0,0 +1,69 @@
+---
+apiVersion: v1
+kind: Service
+metadata:
+  name: bdtp-digital-front
+  labels:
+    app: bdtp-digital-front
+spec:
+  selector:
+    app: bdtp-digital-front
+  ports:
+    - port: 80
+      targetPort: 80
+      name: server-port
+
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: bdtp-digital-front
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      app: bdtp-digital-front
+  template:
+    metadata:
+      labels:
+        app: bdtp-digital-front
+    spec:
+      containers:
+        - name: bdtp-digital-front
+          image: labisenlin.persagy.com/library/bdtp-digital-front:latest
+          imagePullPolicy: Always
+          ports:
+            - containerPort: 80
+              name: server-port
+          resources:
+            limits:
+              memory: 1Gi
+            requests:
+              memory: 512Mi
+          env:
+            - name: TZ
+              value: Asia/Shanghai
+            - name: SERVER_PORT
+              value: "80"
+          volumeMounts:
+            - name: config
+              mountPath: /etc/nginx/nginx.conf
+              subPath: path/to/nginx.conf.js
+            - name: vueconf
+              mountPath: /usr/persagy/saas-web/bdtp-digital-front/vue.config.js
+              subPath: path/to/vue.config.js
+      volumes:
+        - name: config
+          configMap:
+            name: bdtp-digital-front
+            defaultMode: 0777
+            items:
+              - key: nginx.conf
+                path: path/to/nginx.conf.js
+        - name: vueconf
+          configMap:
+            name: bdtp-digital-front
+            defaultMode: 0777
+            items:
+              - key: vue.config.js
+                path: path/to/vue.config.js

+ 131 - 0
docker/k8sfiles/configmap.yml

@@ -0,0 +1,131 @@
+---
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: bdtp-digital-front
+  namespace: persagy
+  labels:
+    name: bdtp-digital-front
+data:
+  nginx.conf: |
+    #user tony;
+    worker_processes 4;
+    error_log /var/log/nginx/error.log;
+    pid /run/nginx.pid;
+    worker_rlimit_nofile 100001;
+    # Load dynamic modules. See /usr/share/nginx/README.dynamic.
+    include /usr/share/nginx/modules/*.conf;
+
+    events {
+        worker_connections 1024;
+    }
+
+    http {
+        log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
+                          '$status $body_bytes_sent "$http_referer" '
+                          '"$http_user_agent" "$http_x_forwarded_for" "$request_time"';
+
+        access_log  /var/log/nginx/access.log  main;
+
+        sendfile            on;
+        tcp_nopush          on;
+        tcp_nodelay         on;
+        keepalive_timeout   65;
+        types_hash_max_size 2048;
+
+        include             /etc/nginx/mime.types;
+        default_type        application/octet-stream;
+
+        gzip  on;
+        gzip_min_length 1k;
+        gzip_buffers 4 16k;
+        gzip_http_version 1.1;
+        gzip_comp_level 2;
+        gzip_types text/plain application/x-javascript application/css  text/css application/xml text/javascript application/x-httpd-php
+        gzip_vary on;
+
+        server {
+            listen 80 default_server;
+            root /usr/persagy/saas-web;
+            location /app {
+                try_files $uri $uri/ /app/index.html;
+            }
+            # FMS
+            location /fms {
+                try_files $uri $uri/ /fms/index.html;
+            }
+            # FMS
+            location /rwd-edit-pages {
+                try_files $uri $uri/ /rwd-edit-pages/index.html;
+            }
+
+            # environmentHealth
+            location /environmenthealth {
+                try_files $uri $uri/ /environmenthealth/index.html;
+            }
+
+                    # pdfreport
+            location /pdfreport {
+                try_files $uri $uri/ /pdfreport/index.html;
+            }
+
+                    # BI
+            location /hedylamarr  {
+                try_files $uri $uri/ /hedylamarr/index.html;
+            }
+
+                    #NeueDashboard
+                location /Dashboard {
+                try_files $uri $uri/ /Dashboard/index.html;
+            }
+
+                    #safetyManagement
+            location /safetyManagement {
+                try_files $uri $uri/ /safetyManagement/index.html;
+            }
+
+            location /equiprunmanage{
+                try_files $uri $uri/ /equiprunmanage/index.html;
+            }
+
+            location /wancity{
+                try_files $uri $uri/ /wancity/index.html;
+            }
+
+            # energybudget
+            location /energybudget{
+                # 不同业务页面路由对应的静态文件首页
+                try_files $uri $uri/ /energybudget/index.html;
+            }
+
+#            location /api {
+#                rewrite  ^/api/(.*)$ /$1 break;
+#                proxy_pass http://meos:80;
+#            }
+
+            location @rewrites {
+                rewrite ^(.+)$ /index.html last;
+            }
+
+            location ~* \.(?:ico|css|js|woff|eot|otf|ttf)$ {
+                # Some basic cache-control for static files to be sent to the browser
+                add_header  Access-Control-Allow-Origin *;
+            }
+            location ~index.html
+            {
+                    add_header Cache-Control no-cache;
+            }
+        }
+
+    }
+  vue.config.js: |
+    module.exports = {
+        devServer: {
+            proxy: {
+                '/rwdedit': {
+                    //target: 'http://192.168.64.17:8838',
+                    target: 'http://dmp-rwd-edit:8838',
+                },
+            },
+        },
+    }