作者 曾海沥

add dev

  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-yhs-dev.fjmaimaimai.com;
  4 + gzip_static on;
  5 + root /home/project;
  6 + index index.html;
  7 + location /flow-platform-api/ {
  8 + proxy_pass http://suplus-customer/;
  9 + }
  10 +
  11 +}
  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: {}