浏览代码

init project

yangxg 2 年之前
父节点
当前提交
fc46f2a28a
共有 9 个文件被更改,包括 21 次插入131 次删除
  1. 1 1
      .drone.yml
  2. 2 1
      Dockerfile
  3. 1 1
      deploy-tmp.yaml
  4. 2 1
      entrypoint.sh
  5. 0 125
      log_clear.sh
  6. 11 1
      nginx.ini
  7. 1 1
      root
  8. 1 0
      rsync.qd
  9. 2 0
      rsync.sh

+ 1 - 1
.drone.yml

@@ -21,7 +21,7 @@ steps:
     environment:
       JNLP_ENV: pro
       JNLP_REPLICAS: 1
-      JNLP_TAG: r3
+      JNLP_TAG: r4
       JNLP_VERSION: v1  # default v1, v2 for canary
       DEPLOY_ENV: k8s-1 # 可以选择把应用部署到集群:k8s-1 or k8s-2
       JNLP_REPO: hub.evbj.easou.com

+ 2 - 1
Dockerfile

@@ -21,10 +21,11 @@ RUN yum install -y wget rsync epel-release lsof crontabs vim psmisc nginx\
     && chmod +x /usr/bin/entrypoint.sh
 RUN chmod -R go+rwx /var/lib/nginx
 COPY root /var/spool/cron/root
-COPY log_clear.sh /cron/root/log_clear.sh
+COPY rsync.sh /cron/root/rsync.sh
 ADD nginx.conf /etc/nginx/nginx.conf
 RUN echo "daemon off;" >> /etc/nginx/nginx.conf
 COPY nginx.ini /etc/supervisord.d/nginx.ini
+COPY rsync.qd /etc/rsync.qd
 
 #start resin
 ENTRYPOINT ["entrypoint.sh"]

+ 1 - 1
deploy-tmp.yaml

@@ -48,7 +48,7 @@ spec:
 #              topologyKey: kubernetes.io/hostname
       containers:
         - name: nginx-material
-          image: nginx:1.14.2
+          image: $JNLP_REPO/$JNLP_ENV/$DRONE_REPO_NAME:$JNLP_TAG
           imagePullPolicy: IfNotPresent
           ports:
             - containerPort: 80

+ 2 - 1
entrypoint.sh

@@ -4,13 +4,14 @@ set -e
 set -o pipefail
 
 chmod 600 /var/spool/cron/root
+chmod 600 /etc/rsync.qd
 sed -i -e '/pam_loginuid.so/s/^/#/' /etc/pam.d/crond
 mkdir -p /log/resin-books/search /log/cron/ /home/book/preps/.java/.userPrefs
 rm -rf /app/soft/resin-4.0.65/log/jvm-app-0.log
 touch /home/book/preps/.java/.userPrefs/.user.lock.book
 touch /home/book/preps/.java/.userPrefs/.userRootModFile.book
 chown book:book -R  /data /app/soft/ /home/book/preps /log/
-
+mkdir -p /data/logs
 echo 'export JAVA_HOME=/usr/java/jdk1.8.0_271' >> /etc/profile
 echo 'export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib' >> /etc/profile
 echo 'export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH:$HOME/bin' >> /etc/profile

+ 0 - 125
log_clear.sh

@@ -1,125 +0,0 @@
-#!/bin/bash
-#Hostname=`hostname|awk -F '.' '{print $1}'`
-Date=`date -d "-1 day" +%F`
-Date1=`date -d "-6 day" +%F`
-AccessDIR=/data1/log/access
-IndexDIR=/data1/log/index
-DevlogDIR=/data1/log/devlog
-
-# access log path
-DIR1=/data/log/other
-
-# index log path
-DIR2=/data/log/index
-
-# devlog log path
-DIR3=/data/log/devlog
-
-#check dir
-function check_access(){
-   if [ ! -d $AccessDIR ]
-   then
-      mkdir -p $AccessDIR
-   fi
-}
-
-function check_index(){
-   if [ ! -d $IndexDIR ]
-   then 
-       mkdir -p $IndexDIR
-   fi
-}
-
-function check_devlog(){
-   if [ ! -d $DevlogDIR ]
-   then
-       mkdir -p $DevlogDIR
-   fi
-}
-
-function accsess(){
-   check_access
-   if [ $? -eq 0 ]
-   then 
-      cd $DIR1
-      cp access_log.$Date* $AccessDIR
-   fi
-}
-
-function index(){
-   check_index
-   if [ $? -eq 0 ]
-   then
-      cd $DIR2
-      cp chapterIndex.log.$Date $IndexDIR
-   fi
-}
-
-function devlog(){
-   check_devlog
-   if [ $? -eq 0 ]
-   then
-      cd $DIR3
-      cp idfaLog.log.$Date $DevlogDIR
-      cp idfaSuccessLog.log.$Date $DevlogDIR
-   fi
-}
-
-function remove_access(){
-    accsess
-    if [ $? -eq 0 ]
-    then
-       cd $DIR1
-       rm -f access_log.$Date*
-    fi
-}
-
-function remove_index(){
-    index
-    if [ $? -eq 0 ]
-    then 
-       cd $DIR2
-       rm -f chapterIndex.log.$Date
-    fi
-}
-
-function remove_devlog(){
-    devlog
-    if [ $? -eq 0 ]
-    then
-       cd $DIR3
-       rm -f idfaLog.log.$Date idfaSuccessLog.log.$Date
-    fi
-}
-
-function remove_log(){
-   remove_access
-   if [ $? -eq 0 ]
-   then 
-      cd $AccessDIR
-      find /data1/log/access/ -type f -name "access_log.*" -mtime +6|xargs rm -f
-   fi
-   remove_index
-   if [ $? -eq 0 ]
-   then 
-      cd $IndexDIR
-      rm -f chapterIndex.log.$Date1 
-   fi
-   remove_devlog
-   if [ $? -eq 0 ]
-   then
-      cd $DevlogDIR
-      find /data1/log/devlog/ -type f -name "*.log.*" -mtime +30|xargs rm -f
-  fi
-}
-
-remove_log
-
-find $DIR1 -mtime +7 -name "*.log.*" -exec rm -rf {} \;
-find $DIR1/rec -mtime +7 -name "*.log.*" -exec rm -rf {} \;
-find /data/log/devlog -mtime +7 -name "*.log.*" -exec rm -rf {} \;
-find /data/log/bookincharge -mtime +7 -name "*.log.*" -exec rm -rf {} \;
-find /data/log/cmread -mtime +7 -name "*.log.*" -exec rm -rf {} \;
-find /data/log/novelweb -mtime +7 -name "*.log.*" -exec rm -rf {} \;
-find /data/log/devlog/bookShelf -mtime +1 -name "*.log*" -exec rm -rf {} \;
-find /data/log/perf/ -type f -name "perf.log.*" -mtime +6|xargs rm -f

+ 11 - 1
nginx.ini

@@ -10,4 +10,14 @@ autorestart=false
 startsecs=0
 redirect_stderr=true
 stdout_logfile=/dev/stdout
-stdout_logfile_maxbytes=0
+stdout_logfile_maxbytes=0
+
+[program:crond]
+command=/usr/sbin/crond -n
+autostart=true
+startsecs=50
+startretries=3
+autorestart=true
+user=root
+stdout_logfile=/data/log/cron/stdout.log
+stderr_logfile=/data/log/cron/stderr.log

+ 1 - 1
root

@@ -1 +1 @@
-01 02 * * * sh /cron/root/log_clear.sh >/dev/null 2>&1
+01 02 * * * sh /cron/root/rsync.sh >/dev/null 2>&1

+ 1 - 0
rsync.qd

@@ -0,0 +1 @@
+123456789a

+ 2 - 0
rsync.sh

@@ -0,0 +1,2 @@
+#!/bin/bash
+rsync -vzatopg --progress root@10.26.32.78::material /data1/images/manual/ --password-file=/etc/rsync.qd >> /data/logs/rsync.log