root 2 rokov pred
rodič
commit
737a806467
6 zmenil súbory, kde vykonal 78 pridanie a 152 odobranie
  1. 3 6
      Dockerfile
  2. 18 9
      Dockerfile-v1
  3. 2 17
      entrypoint.sh
  4. 2 117
      log_clear.sh
  5. 5 3
      resin.ini
  6. 48 0
      supervisord.conf

+ 3 - 6
Dockerfile

@@ -1,13 +1,10 @@
-FROM hub.evbj.easou.com/qa/book-api:v1c
+FROM hub.evbj.easou.com/dev/book-api:v3base
 
-ENV LANG en_US.UTF-8
 
-COPY resin.properties /app/soft/resin-4.0.65/conf/resin.properties 
-COPY skywalking-agent.tgz /tmp/skywalking-agent.tgz
+COPY supervisord.conf /etc/supervisord.conf
+COPY entrypoint.sh /usr/bin/entrypoint.sh
 
 
-RUN tar -zxf /tmp/skywalking-agent.tgz -C /app/soft/ && rm -f /tmp/skywalking-agent.tgz
-
 
 ENTRYPOINT ["entrypoint.sh"]
 CMD ["supervisord"]

+ 18 - 9
Dockerfile-v1

@@ -1,6 +1,6 @@
 FROM hub.evbj.easou.com/dev/centos:7.9.2009
 
-LABEL author="robert[robert_du@easou.cn]"
+LABEL author="scofield[scofield_shi@easou.cn]"
 
 ENV LANG en_US.UTF-8
 ENV TZ=Asia/Shanghai
@@ -8,24 +8,33 @@ ENV JAVA_HOME /usr/java/jdk1.8.0_271
 ENV RESIN_HOME /app/soft/resin-4.0.65
 
 COPY entrypoint.sh /usr/bin/entrypoint.sh
+COPY root /tmp/root
 
 #install jdk8 & resin4 
 
-RUN yum install -y wget rsync epel-release lsof crontabs vim psmisc\
-    && /usr/sbin/groupadd -g 18001 book ;useradd -s /bin/bash  -g book -u 18001 book \
-    && yum install -y supervisor \
+RUN yum install -y epel-release \
+    && yum install -y wget rsync lsof crontabs vim psmisc supervisor \
     && mkdir -p /usr/java  /app/soft /cron/root \
-    && curl -O http://10.26.22.185:9000/psop/soft/jdk1.8.0_271.tar.gz \
-    && curl -O http://10.26.22.185:9000/book/api-rs/resin-4.0.65-relase.tar.gz \
+    && curl -O http://10.26.22.113:9000/psop/soft/jdk1.8.0_271.tar.gz \
+    && curl -O http://10.26.22.113:9000/book/api-rs/resin-4.0.65-relase.tar.gz \
     && tar -xf jdk1.8.0_271.tar.gz -C /usr/java/ \ 
     && tar -xf resin-4.0.65-relase.tar.gz -C /app/soft/ \
     && rm -f jdk1.8.0_271.tar.gz resin-4.0.65-relase.tar.gz \
     && ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone \
-    && chmod +x /usr/bin/entrypoint.sh
+    && chmod +x /usr/bin/entrypoint.sh \
+    && 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 \
+    && echo "ulimit -n 65535" >> /etc/profile \
+    && echo "ulimit -u 65535" >> /etc/profile \
+    && sed -i -e '/pam_loginuid.so/s/^/#/' /etc/pam.d/crond \
+    && mv /tmp/root /var/spool/cron/root \
+    && chmod 600 /var/spool/cron/root \
+    && source /etc/profile \
+    && sed -i 's/nodaemon=false/nodaemon=true/g' /etc/supervisord.conf 
+
 
-#COPY resin.xml /app/soft/resin-4.0.65/conf/resin.xml
 COPY resin.properties /app/soft/resin-4.0.65/conf/resin.properties 
-COPY root /var/spool/cron/root
 COPY log_clear.sh /cron/root/log_clear.sh
 COPY resin.ini /etc/supervisord.d/resin.ini
 

+ 2 - 17
entrypoint.sh

@@ -3,23 +3,8 @@
 set -e
 set -o pipefail
 
-chmod 600 /var/spool/cron/root
-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/
+rm -f /app/soft/resin-4.0.65/log/jvm-app-0.log
 
-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
-echo "ulimit -n 65535" >> /etc/profile
-echo "ulimit -u 65535" >> /etc/profile
-source /etc/profile
 
-sed -i 's/nodaemon=false/nodaemon=true/g' /etc/supervisord.conf
 
-
-
-exec "$@"
+exec "$@"

+ 2 - 117
log_clear.sh

@@ -1,125 +1,10 @@
 #!/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
+find /data/log/perf/ -type f -name "perf.log.*" -mtime +6|xargs rm -f
+find /data/log/other/ -type f -name "access_log.*" -mtime +6|xargs rm -f

+ 5 - 3
resin.ini

@@ -7,7 +7,9 @@ startsecs=50
 autostart=true
 startretries=3
 autorestart=true
-user=book
+user=root
+stdout_logfile=/var/log/resin_stdout.log
+stderr_logfile=/var/log/resin_stderr.log
 
 [program:crond]
 command=/usr/sbin/crond -n
@@ -16,5 +18,5 @@ startsecs=50
 startretries=3
 autorestart=true
 user=root
-stdout_logfile=/log/cron/stdout.log
-stderr_logfile=/log/cron/stderr.log
+stdout_logfile=/var/log/crond_stdout.log
+stderr_logfile=/var/log/crond_stderr.log

+ 48 - 0
supervisord.conf

@@ -0,0 +1,48 @@
+[unix_http_server]
+file=/var/run/supervisor/supervisor.sock   ; (the path to the socket file)
+;chmod=0700                 ; sockef file mode (default 0700)
+;chown=nobody:nogroup       ; socket file uid:gid owner
+;username=user              ; (default is no username (open server))
+;password=123               ; (default is no password (open server))
+
+;[inet_http_server]         ; inet (TCP) server disabled by default
+;port=127.0.0.1:9001        ; (ip_address:port specifier, *:port for all iface)
+;username=user              ; (default is no username (open server))
+;password=123               ; (default is no password (open server))
+
+[supervisord]
+logfile=/var/log/supervisor/supervisord.log  ; (main log file;default $CWD/supervisord.log)
+logfile_maxbytes=50MB       ; (max main logfile bytes b4 rotation;default 50MB)
+logfile_backups=10          ; (num of main logfile rotation backups;default 10)
+loglevel=info               ; (log level;default info; others: debug,warn,trace)
+pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
+nodaemon=true              ; (start in foreground if true;default false)
+minfds=1024                 ; (min. avail startup file descriptors;default 1024)
+minprocs=200                ; (min. avail process descriptors;default 200)
+;umask=022                  ; (process file creation umask;default 022)
+;user=chrism                 ; (default is current user, required if root)
+;identifier=supervisor       ; (supervisord identifier, default is 'supervisor')
+;directory=/tmp              ; (default is not to cd during start)
+;nocleanup=true              ; (don't clean up tempfiles at start;default false)
+;childlogdir=/tmp            ; ('AUTO' child log dir, default $TEMP)
+;environment=KEY=value       ; (key value pairs to add to environment)
+;strip_ansi=false            ; (strip ansi escape codes in logs; def. false)
+
+; the below section must remain in the config file for RPC
+; (supervisorctl/web interface) to work, additional interfaces may be
+; added by defining them in separate rpcinterface: sections
+[rpcinterface:supervisor]
+supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
+
+[supervisorctl]
+serverurl=unix:///var/run/supervisor/supervisor.sock ; use a unix:// URL  for a unix socket
+;serverurl=http://127.0.0.1:9001 ; use an http:// url to specify an inet socket
+;username=chris              ; should be same as http_username if set
+;password=123                ; should be same as http_password if set
+;prompt=mysupervisor         ; cmd line prompt (default "supervisor")
+;history_file=~/.sc_history  ; use readline history if available
+
+
+
+[include]
+files = supervisord.d/*.ini