作者 曾海沥

add all

  1 +FROM centos:centos7
  2 +MAINTAINER The CentOS Project <cloud-ops@centos.org>
  3 +
  4 +RUN yum -y update; yum clean all
  5 +RUN yum -y install epel-release; yum clean all
  6 +RUN yum -y install nginx; yum clean all
  7 +RUN echo "daemon off;" >> /etc/nginx/nginx.conf
  8 +#RUN echo "nginx on CentOS 7 inside Docker" > /usr/share/nginx/html/index.html
  9 +COPY ./conf.d /etc/nginx/conf.d
  10 +COPY ./dist /home/project
  11 +EXPOSE 80
  12 +CMD [ "/usr/sbin/nginx" ]
  1 +server {
  2 + listen 80;
  3 + server_name suplus-front-dev.fjmaimaimai.com;
  4 + gzip_static on;
  5 + gzip on;
  6 + gzip_min_length 1k;
  7 + gzip_buffers 4 16k;
  8 + gzip_http_version 1.1;
  9 + gzip_comp_level 2;
  10 + gzip_types text/plain application/javascript application/x-javascript text/javascript text/css application/xml application/xml+rss;
  11 + gzip_vary on;
  12 + gzip_proxied expired no-cache no-store private auth;
  13 + gzip_disable "MSIE [1-6]\.";
  14 + root /home/project;
  15 + index index.html;
  16 + location /flow-platform-api/ {
  17 + proxy_pass http://suplus-customer/;
  18 + }
  19 +
  20 +}
  1 +'use strict'
  2 +const merge = require('webpack-merge')
  3 +const prodEnv = require('./prod.env')
  4 +
  5 +module.exports = merge(prodEnv, {
  6 + NODE_ENV: '"development"'
  7 +})
  1 +'use strict'
  2 +// Template version: 1.3.1
  3 +// see http://vuejs-templates.github.io/webpack for documentation.
  4 +
  5 +const path = require('path')
  6 +
  7 +module.exports = {
  8 + dev: {
  9 +
  10 + // Paths
  11 + assetsSubDirectory: 'static',
  12 + assetsPublicPath: '/',
  13 + proxyTable: {},
  14 +
  15 + // Various Dev Server settings
  16 + host: '0.0.0.0', // can be overwritten by process.env.HOST
  17 + port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
  18 + autoOpenBrowser: false,
  19 + errorOverlay: true,
  20 + notifyOnErrors: true,
  21 + poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
  22 +
  23 +
  24 + /**
  25 + * Source Maps
  26 + */
  27 +
  28 + // https://webpack.js.org/configuration/devtool/#development
  29 + devtool: 'cheap-module-eval-source-map',
  30 +
  31 + // If you have problems debugging vue-files in devtools,
  32 + // set this to false - it *may* help
  33 + // https://vue-loader.vuejs.org/en/options.html#cachebusting
  34 + cacheBusting: true,
  35 +
  36 + cssSourceMap: true
  37 + },
  38 +
  39 + build: {
  40 + // Template for index.html
  41 + index: path.resolve(__dirname, '../dist/index.html'),
  42 +
  43 + // Paths
  44 + assetsRoot: path.resolve(__dirname, '../dist'),
  45 + assetsSubDirectory: 'static',
  46 + assetsPublicPath: '/',
  47 +
  48 + /**
  49 + * Source Maps
  50 + */
  51 +
  52 + productionSourceMap: true,
  53 + // https://webpack.js.org/configuration/devtool/#production
  54 + devtool: '#source-map',
  55 +
  56 + // Gzip off by default as many popular static hosts such as
  57 + // Surge or Netlify already gzip all static assets for you.
  58 + // Before setting to `true`, make sure to:
  59 + // npm install --save-dev compression-webpack-plugin
  60 + productionGzip: false,
  61 + productionGzipExtensions: ['js', 'css'],
  62 +
  63 + // Run the build command with an extra argument to
  64 + // View the bundle analyzer report after build finishes:
  65 + // `npm run build --report`
  66 + // Set to `true` or `false` to always turn it on or off
  67 + bundleAnalyzerReport: process.env.npm_config_report
  68 + }
  69 +}
  1 +'use strict'
  2 +module.exports = {
  3 + NODE_ENV: '"production"'
  4 +}
  1 +#!/bin/bash
  2 +export PATH=/root/local/bin:$PATH
  3 +kubectl -n mmm-suplus-dev get pods | grep -q suplus-front
  4 +if [ "$?" == "1" ];then
  5 + kubectl create -f /tmp/suplus-front.yaml --record
  6 + kubectl -n mmm-suplus-dev get svc | grep -q suplus-front
  7 + if [ "$?" == "0" ];then
  8 + echo "suplus-front service install success!"
  9 + else
  10 + echo "suplus-front service install fail!"
  11 + fi
  12 + kubectl -n mmm-suplus-dev get pods | grep -q suplus-front
  13 + if [ "$?" == "0" ];then
  14 + echo "suplus-front deployment install success!"
  15 + else
  16 + echo "suplus-front deployment install fail!"
  17 + fi
  18 +else
  19 + kubectl delete -f /tmp/suplus-front.yaml
  20 + kubectl -n mmm-suplus-dev get svc | grep -q suplus-front
  21 + while [ "$?" == "0" ]
  22 + do
  23 + kubectl -n mmm-suplus-dev get svc | grep -q suplus-front
  24 + done
  25 + kubectl -n mmm-suplus-dev get pods | grep -q suplus-front
  26 + while [ "$?" == "0" ]
  27 + do
  28 + kubectl -n mmm-suplus-dev get pods | grep -q suplus-front
  29 + done
  30 + kubectl create -f /tmp/suplus-front.yaml --record
  31 + kubectl -n mmm-suplus-dev get svc | grep -q suplus-front
  32 + if [ "$?" == "0" ];then
  33 + echo "suplus-front service update success!"
  34 + else
  35 + echo "suplus-front service update fail!"
  36 + fi
  37 + kubectl -n mmm-suplus-dev get pods | grep -q suplus-front
  38 + if [ "$?" == "0" ];then
  39 + echo "suplus-front deployment update success!"
  40 + else
  41 + echo "suplus-front deployment update fail!"
  42 + fi
  43 +fi
  1 +apiVersion: v1
  2 +kind: Service
  3 +metadata:
  4 + name: suplus-front
  5 + namespace: mmm-suplus-dev
  6 + labels:
  7 + k8s-app: suplus-front
  8 +spec:
  9 + ports:
  10 + - name: "http"
  11 + port: 80
  12 + targetPort: 80
  13 + selector:
  14 + k8s-app: suplus-front
  15 +---
  16 +apiVersion: extensions/v1beta1
  17 +kind: Deployment
  18 +metadata:
  19 + name: suplus-front
  20 + namespace: mmm-suplus-dev
  21 + labels:
  22 + k8s-app: suplus-front
  23 +spec:
  24 + replicas: 1
  25 + template:
  26 + metadata:
  27 + labels:
  28 + k8s-app: suplus-front
  29 + spec:
  30 + containers:
  31 + - name: suplus-front
  32 + image: 192.168.0.243:5000/mmm/suplus-front:dev
  33 + imagePullPolicy: Always
  34 + volumeMounts:
  35 + - mountPath: /opt/logs
  36 + name: accesslogs
  37 + ports:
  38 + - containerPort: 80
  39 + env:
  40 + - name: MYSQL_HOST
  41 + valueFrom:
  42 + configMapKeyRef:
  43 + name: suplus-config
  44 + key: mysql.host
  45 + - name: MYSQL_PORT
  46 + valueFrom:
  47 + configMapKeyRef:
  48 + name: suplus-config
  49 + key: mysql.port
  50 + - name: MYSQL_USER
  51 + valueFrom:
  52 + configMapKeyRef:
  53 + name: suplus-config
  54 + key: mysql.user
  55 + - name: MYSQL_PASSWORD
  56 + valueFrom:
  57 + configMapKeyRef:
  58 + name: suplus-config
  59 + key: mysql.password
  60 + - name: MYSQL_DB_NAME
  61 + value: "suplus_file"
  62 + - name: aliyun_logs_suplusfront
  63 + value: "stdout"
  64 + - name: aliyun_logs_access
  65 + value: " /opt/logs/app.log"
  66 + volumes:
  67 + - name: accesslogs
  68 + emptyDir: {}