root 3 yıl önce
ebeveyn
işleme
5e6429af1f
9 değiştirilmiş dosya ile 287 ekleme ve 0 silme
  1. 90 0
      .drone.yml
  2. 1 0
      Dockerfile
  3. 26 0
      Dockerfile.v1
  4. 1 0
      README.md
  5. 79 0
      deploy-tmp.yaml
  6. 11 0
      entrypoint.sh
  7. 26 0
      epel.repo
  8. 46 0
      httpd.sh
  9. 7 0
      sep.ini

+ 90 - 0
.drone.yml

@@ -0,0 +1,90 @@
+kind: pipeline
+type: kubernetes
+name: sep
+
+clone:
+  disable: true
+
+metadata:
+  namespace: drone
+
+steps:
+ - name: clone
+   image: hub.evbj.easou.com/dev/alpine-git:20200622
+   commands:
+   - git clone --depth=1 $DRONE_GIT_HTTP_URL .
+
+ - name: build
+   image: plugins/docker
+   settings:
+     username: admin
+     password: Easou2)1*
+     insecure: true
+     mirror: https://ci7pm4nx.mirror.aliyuncs.com
+     registry: hub.evbj.easou.com
+     repo: hub.evbj.easou.com/oldad/${DRONE_REPO_NAME}
+     tag: v1.0.0
+     
+ - name: deployment
+   image: hub.evbj.easou.com/dev/drone-agent:v2.0.0
+   pull: always
+   # privileged: true
+   environment:
+     JNLP_ENV: oldad
+     JNLP_REPLICAS: 1
+     JNLP_TAG: v1.0.0
+     JNLP_VERSION: v1  # default v1, v2 for canary
+     DEPLOY_ENV: k8s-2 # 可以选择把应用部署到集群:k8s-1 or k8s-2
+     JNLP_REPO: hub.evbj.easou.com
+     JNLP_CONTAINER_PORT: 8080
+     JNLP_INGRESS: nginx
+     JNLP_SVC_MODE: http
+     JNLP_STORAGE_CLASS: rbd
+     JNLP_DOMAIN: .ieasou.cn
+     JNLP_CONTROL: StatefulSet
+     JNLP_STORAGE_CAPACITY: 100Gi
+     JNLP_MOUNT_PATH: /data
+     JNLP_LIVENESS_INIT: 90
+     JNLP_LIVENESS_PER: 15
+     JNLP_READINESS_INIT: 90
+     JNLP_READINESS_PER: 15
+     JNLP_INGRESS_PUB: no
+   commands:
+     # 切换目标集群
+     - kubecm s $DEPLOY_ENV
+     # 生成配置YAML文件
+     - python3 /root/tools.py -b
+     # 部署服务到kubernetes上
+     - python3 /root/tools.py -a
+     # 检查服务部署状态
+     - python3 /root/tools.py -c
+     # 添加dns解析记录,生成访问域名
+     - python3 /root/tools.py -d
+
+ - name: success
+   image: hub.evbj.easou.com/dev/drone-wechat:20200622
+   settings:
+     corpid: ww419ee4063735e1c0
+     corp_secret: zpiRBLETH9eLwIMQ4eJ_r_dcm3BPSGeLHvTcft8Ot-M
+     agent_id: 1000004
+     title: "Pipeline ${DRONE_REPO_NAME} Success"
+     description: "${DRONE_BUILD_LINK} 部署完成"
+     msg_url: ${DRONE_BUILD_LINK}
+     btn_txt: "否"
+   when:
+     status:
+     - success
+
+ - name: failure
+   image: hub.evbj.easou.com/dev/drone-wechat:20200622
+   settings:
+     corpid: ww419ee4063735e1c0
+     corp_secret: zpiRBLETH9eLwIMQ4eJ_r_dcm3BPSGeLHvTcft8Ot-M
+     agent_id: 1000004
+     title: "Pipeline ${DRONE_REPO_NAME} Failure"
+     description: "${DRONE_BUILD_LINK} 部署失败,请检查配置!"
+     msg_url: ${DRONE_BUILD_LINK}
+     btn_txt: "否"
+   when:
+     status:
+     - failure

+ 1 - 0
Dockerfile

@@ -0,0 +1 @@
+FROM hub.evbj.easou.com/dev/sep:v1.0.0

+ 26 - 0
Dockerfile.v1

@@ -0,0 +1,26 @@
+FROM hub.evbj.easou.com/dev/centos:7.9.2009
+
+ENV TZ=Asia/Shanghai
+ENV JAVA_HOME /usr/java/jdk1.8.0_271
+
+COPY epel.repo /etc/yum.repos.d/epel.repo
+
+RUN rm -f /etc/yum.repos.d/CentOS-* \
+    && curl -s http://mirrors.163.com/.help/CentOS7-Base-163.repo -o /etc/yum.repos.d/CentOS7-Base-163.repo \
+    && yum clean all \
+    && yum install -y supervisor \
+    && sed -i "s/nodaemon=false/nodaemon=true/" /etc/supervisord.conf \
+    && useradd ecom \
+    && mkdir -p /usr/java /app/ecom /data/ecom \
+    && curl -s http://10.26.22.185:9000/psop/soft/jdk1.8.0_271.tar.gz -o /tmp/jdk1.8.0_271.tar.gz \
+    && curl -s http://10.26.22.185:9000/psop/soft/ecom/sep_resin8080.tgz -o /tmp/sep_resin8080.tgz \
+    && tar -zxf /tmp/jdk1.8.0_271.tar.gz -C /usr/java/ \
+    && tar -zxf /tmp/sep_resin8080.tgz -C /app/ecom/ \
+    && ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone \
+    && chown -R ecom:ecom /app /data
+
+COPY sep.ini /etc/supervisord.d/sep.ini
+COPY entrypoint.sh /usr/bin/entrypoint.sh
+
+ENTRYPOINT ["entrypoint.sh"]
+CMD ["supervisord"]

+ 1 - 0
README.md

@@ -1,2 +1,3 @@
 # sep
+* qd01-vm017-ec-sepmon001 10.26.27.164
 

+ 79 - 0
deploy-tmp.yaml

@@ -0,0 +1,79 @@
+---
+apiVersion: apps/v1
+kind: $JNLP_CONTROL
+metadata:
+  name: $DRONE_REPO_NAME
+  namespace: $JNLP_ENV
+  labels:
+    app: $DRONE_REPO_NAME
+spec:
+  serviceName: $DRONE_REPO_NAME
+  replicas: $JNLP_REPLICAS
+  selector:
+    matchLabels:
+      app: $DRONE_REPO_NAME
+  template:
+    metadata:
+      labels:
+        app: $DRONE_REPO_NAME
+    spec:
+      terminationGracePeriodSeconds: 180
+      initContainers:
+        - name: init
+          image: $JNLP_REPO/dev/busybox
+          command: ["chmod","777","-R","$JNLP_MOUNT_PATH"]
+          volumeMounts:
+          - name: volume
+            mountPath: $JNLP_MOUNT_PATH
+      containers:
+      - name: $DRONE_REPO_NAME
+        image: $JNLP_REPO/$JNLP_ENV/$DRONE_REPO_NAME:$JNLP_TAG
+        imagePullPolicy: Always
+        ports:
+        - containerPort: $JNLP_CONTAINER_PORT
+          name: misport
+        volumeMounts:
+        - name: volume
+          mountPath: $JNLP_MOUNT_PATH
+  volumeClaimTemplates:
+  - metadata:
+      name: volume
+    spec:
+      accessModes: ["ReadWriteOnce"]
+      storageClassName: rbd
+      resources:
+        requests:
+          storage: $JNLP_STORAGE_CAPACITY
+---
+apiVersion: v1
+kind: Service
+metadata:
+  name: $DRONE_REPO_NAME-svc
+  namespace: $JNLP_ENV
+  labels:
+    app: $DRONE_REPO_NAME-svc
+spec:
+  type: NodePort
+  ports:
+    - name: mis
+      port: $JNLP_CONTAINER_PORT
+      targetPort: $JNLP_CONTAINER_PORT
+  selector:
+    app: $DRONE_REPO_NAME
+---
+apiVersion: extensions/v1beta1
+kind: Ingress
+metadata:
+  name: $DRONE_REPO_NAME-ingress
+  namespace: $JNLP_ENV
+  annotations:
+    kubernetes.io/ingress.class: $JNLP_INGRESS
+spec:
+  rules:
+  - host: $JNLP_ENV-$DRONE_REPO_NAME$JNLP_DOMAIN
+    http:
+      paths:
+      - path: /
+        backend:
+          serviceName: $DRONE_REPO_NAME-svc
+          servicePort: $JNLP_CONTAINER_PORT

+ 11 - 0
entrypoint.sh

@@ -0,0 +1,11 @@
+#!/bin/bash
+
+set -e 
+set -o pipefail
+
+export PATH=$JAVA_HOME/bin:$PATH
+mkdir -p /data/ecom
+rm -rf /tmp/*
+chown -R ecom:ecom /app /data 
+
+exec "$@"

+ 26 - 0
epel.repo

@@ -0,0 +1,26 @@
+[epel]
+name=Extra Packages for Enterprise Linux 7 - $basearch
+baseurl=https://mirrors.tuna.tsinghua.edu.cn/epel/7/$basearch
+#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch
+failovermethod=priority
+enabled=1
+gpgcheck=0
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
+
+[epel-debuginfo]
+name=Extra Packages for Enterprise Linux 7 - $basearch - Debug
+baseurl=https://mirrors.tuna.tsinghua.edu.cn/epel/7/$basearch/debug
+#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-7&arch=$basearch
+failovermethod=priority
+enabled=0
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
+gpgcheck=1
+
+[epel-source]
+name=Extra Packages for Enterprise Linux 7 - $basearch - Source
+baseurl=https://mirrors.tuna.tsinghua.edu.cn/epel/7/SRPMS
+#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-source-7&arch=$basearch
+failovermethod=priority
+enabled=0
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
+gpgcheck=1

+ 46 - 0
httpd.sh

@@ -0,0 +1,46 @@
+#! /bin/sh
+#
+# See contrib/init.resin for /etc/rc.d/init.d startup script
+#
+# resin.sh can be called like apachectl
+#
+# resin.sh         -- execs resin in the foreground
+# resin.sh start   -- starts resin in the background
+# resin.sh stop    -- stops resin
+# resin.sh restart -- restarts resin
+#
+# resin.sh will return a status code if the wrapper detects an error, but
+# some errors, like bind exceptions or Java errors, are not detected.
+#
+# To install, you'll need to configure JAVA_HOME and RESIN_HOME and
+# copy contrib/init.resin to /etc/rc.d/init.d/resin.  Then
+# use "unix# /sbin/chkconfig resin on"
+export PATH=$JAVA_HOME/bin:$PATH
+source /etc/profile
+
+if test -n "${JAVA_HOME}"; then
+  if test -z "${JAVA_EXE}"; then
+    JAVA_EXE=$JAVA_HOME/bin/java
+  fi
+fi
+
+if test -z "${JAVA_EXE}"; then
+  JAVA_EXE=java
+fi
+
+#
+# trace script and simlinks to find the wrapper
+#
+if test -z "${RESIN_HOME}"; then
+  script=`/bin/ls -l $0 | awk '{ print $NF; }'`
+
+  while test -h "$script"
+  do
+    script=`/bin/ls -l $script | awk '{ print $NF; }'`
+  done
+
+  bin=`dirname $script`
+  RESIN_HOME="$bin/.."
+fi
+
+exec $JAVA_EXE -jar ${RESIN_HOME}/lib/resin.jar $*

+ 7 - 0
sep.ini

@@ -0,0 +1,7 @@
+[program:sep]
+command=/app/ecom/resin8080/bin/httpd.sh
+process_name=%(program_name)s
+startsecs=30
+startretries=3
+autostart=true
+autorestart=true