dever 6 年之前
父节点
当前提交
78572af5e0

+ 4 - 8
container/conf/web/nginx/conf.d/domain.conf

@@ -8,7 +8,7 @@ server {
 
     charset $charset;
 
-    set $rootdir /www/jiaoyoucms;
+    set $rootdir /www/jiaoyoucms/public;
     root $rootdir;
     index index.php index.html;
 
@@ -22,7 +22,7 @@ server {
         return 404;
     }
 
-    if ( $request_uri ~* ^/(data\/|public\/|assets\/|static\/|crossdomain\.xml|index\.php|favicon\.ico) ) {
+    if ( $request_uri ~* ^/(doc\/|public\/|upload\/|assets\/|static\/|crossdomain\.xml|index\.php|favicon\.ico) ) {
         set $rewrite no;
     }
 
@@ -31,17 +31,13 @@ server {
         rewrite ^/(.*) /index.php/$1 last;
     }
 
-    location ~ /(data\/|public\/|assets\/|static\/|crossdomain\.xml)
+    location ~ /(doc\/|upload\/|public\/|assets\/|static\/|crossdomain\.xml)
     {
         try_files $uri $uri/ /index.html;
     }
 
     location /doc/ {
-    	alias /usr/share/doc/;
-		autoindex on;
-		allow 127.0.0.1;
-		allow ::1;
-		deny all;
+		try_files $uri $uri/ /index.html;
     }
 
     location ~ ^(.*)$ {

+ 2 - 2
container/conf/web/nginx/conf.d/site.conf

@@ -41,8 +41,8 @@ server {
         # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini (No settings!)
 
         # With php-cgi alone:
-        fastcgi_pass web-php7:9000;
-        #fastcgi_pass web-php5:9000;
+        #fastcgi_pass web-php7:9000;
+        fastcgi_pass web-php5:9000;
         # With php-fpm:
         #fastcgi_pass unix:/var/run/php7-fpm.sock;
         fastcgi_index index.php;

+ 1 - 1
container/conf/web/php5/php.ini

@@ -1447,7 +1447,7 @@ session.save_handler = files
 ; where MODE is the octal representation of the mode. Note that this
 ; does not overwrite the process's umask.
 ; http://php.net/session.save-path
-;session.save_path = "/tmp"
+session.save_path = "/tmp"
 
 ; Whether to use strict session mode.
 ; Strict session mode does not accept uninitialized session ID and regenerate

+ 15 - 15
container/conf/web/php7/php.ini

@@ -1323,7 +1323,7 @@ bcmath.scale = 0
 
 [Session]
 ; Handler used to store/retrieve data.
-; http://php.net/session.save-handler
+; http://php.net/session.save-handler redis tcp://192.168.1.10:6379?auth=password
 session.save_handler = files
 
 ; Argument passed to save_handler.  In the case of files, this is the path
@@ -1353,7 +1353,7 @@ session.save_handler = files
 ; where MODE is the octal representation of the mode. Note that this
 ; does not overwrite the process's umask.
 ; http://php.net/session.save-path
-;session.save_path = "/tmp"
+session.save_path = "/tmp"
 
 ; Whether to use strict session mode.
 ; Strict session mode does not accept uninitialized session ID and regenerate
@@ -1780,52 +1780,52 @@ ldap.max_links = -1
 
 [opcache]
 ; Determines if Zend OPCache is enabled
-;opcache.enable=1
+opcache.enable=1
 
 ; Determines if Zend OPCache is enabled for the CLI version of PHP
-;opcache.enable_cli=0
+opcache.enable_cli=0
 
 ; The OPcache shared memory storage size.
-;opcache.memory_consumption=128
+opcache.memory_consumption=128
 
 ; The amount of memory for interned strings in Mbytes.
-;opcache.interned_strings_buffer=8
+opcache.interned_strings_buffer=8
 
 ; The maximum number of keys (scripts) in the OPcache hash table.
 ; Only numbers between 200 and 1000000 are allowed.
-;opcache.max_accelerated_files=10000
+opcache.max_accelerated_files=10000
 
 ; The maximum percentage of "wasted" memory until a restart is scheduled.
-;opcache.max_wasted_percentage=5
+opcache.max_wasted_percentage=5
 
 ; When this directive is enabled, the OPcache appends the current working
 ; directory to the script key, thus eliminating possible collisions between
 ; files with the same name (basename). Disabling the directive improves
 ; performance, but may break existing applications.
-;opcache.use_cwd=1
+opcache.use_cwd=0
 
 ; When disabled, you must reset the OPcache manually or restart the
 ; webserver for changes to the filesystem to take effect.
-;opcache.validate_timestamps=1
+opcache.validate_timestamps=1
 
 ; How often (in seconds) to check file timestamps for changes to the shared
 ; memory storage allocation. ("1" means validate once per second, but only
 ; once per request. "0" means always validate)
-;opcache.revalidate_freq=2
+opcache.revalidate_freq=60
 
 ; Enables or disables file search in include_path optimization
-;opcache.revalidate_path=0
+opcache.revalidate_path=0
 
 ; If disabled, all PHPDoc comments are dropped from the code to reduce the
 ; size of the optimized code.
-;opcache.save_comments=1
+opcache.save_comments=0
 
 ; If enabled, a fast shutdown sequence is used for the accelerated code
 ; Depending on the used Memory Manager this may cause some incompatibilities.
-;opcache.fast_shutdown=0
+opcache.fast_shutdown=1
 
 ; Allow file existence override (file_exists, etc.) performance feature.
-;opcache.enable_file_override=0
+;opcache.enable_file_override=1
 
 ; A bitmask, where each bit enables or disables the appropriate OPcache
 ; passes

+ 2 - 1
install

@@ -46,7 +46,8 @@ if [ "$yumstatus" = 0 ]; then
 else
 	yum install python-gevent
 fi
-#python $basepath/src/daemon.py &
+dm run server-redis
+python $basepath/src/daemon.py &
 
 docker version
 echo 'install success!'

+ 18 - 3
src/daemon.py

@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 # -*- coding: utf-8 -*-
-# dm_process为key,value为具体指令 如:dm call office-convert_call id=1
+# dm_process为key,value为具体指令 如:call office-convert_call id=1
 import time
 import os
 #import pprint
@@ -21,7 +21,7 @@ def pop(key):
         return popen('redis -a '+password+' lpop ' + key)
 
 def command(process):
-        return process
+        return 'dm ' + process
 
 def popen(command, bg=False):
         string = command
@@ -47,10 +47,25 @@ def process():
                         gevent.sleep(timeSleep)
                         i = 0
 
+# 定时备份
+def backup():
+        r = redis()
+        c = 'dm_process'
+        i = 0
+        while 1:
+                value = r.lpop(c)
+                if value:
+                        g = command(value)
+                        popen(g)
+                i = i+1
+                if i >= 10:
+                        gevent.sleep(timeSleep)
+                        i = 0
+
 def handle():
 	gevent.joinall([
 		gevent.spawn(process),
-		#gevent.spawn(backup),
+		gevent.spawn(backup),
 	])
 
 handle()

+ 1 - 1
src/docker/build/dev/php/v7/Dockerfile

@@ -4,7 +4,7 @@ MAINTAINER Rabin "https://github.com/shemic"
 
 ENV COMPOSER_HOME=/share/lib/php
 
-RUN apk add --no-cache --update curl php7-fpm php7-pear php7-mysqli php7-session php7-pgsql php7-pdo_mysql php7-pdo_pgsql php7-gd php7-curl php7-mcrypt php7-json php7-zlib php7-xml php7-xmlwriter php7-iconv php7-zip php7-phar  php7-openssl php7-dom php7-mbstring php7-simplexml php7-sockets php7-pcntl php7-fileinfo && curl -sS https://getcomposer.org/installer | php && mv composer.phar /usr/bin/composer && apk del curl && composer config -g repo.packagist composer https://packagist.phpcomposer.com
+RUN apk add --no-cache --update curl php7-fpm php7-pear php7-mysqli php7-session php7-pgsql php7-pdo_mysql php7-pdo_pgsql php7-gd php7-curl php7-mcrypt php7-json php7-zlib php7-xml php7-xmlwriter php7-iconv php7-zip php7-phar  php7-openssl php7-dom php7-mbstring php7-simplexml php7-sockets php7-pcntl php7-fileinfo  php7-tokenizer php7-opcache php7-redis php7-imagick && curl -sS https://getcomposer.org/installer | php && mv composer.phar /usr/bin/composer && apk del curl && composer config -g repo.packagist composer https://packagist.phpcomposer.com
 
 #php7-memcached php7-redis 
 

+ 17 - 0
src/docker/build/dm/admin/Dockerfile

@@ -0,0 +1,17 @@
+FROM docker.dever.cc/dev/python:latest
+
+MAINTAINER Rabin "https://github.com/shemic"
+
+ENV ADMIN_HOME=/usr/local/admin
+ENV ADMIN_LIB=/usr/lib/python2.7/site-packages/demeter
+ENV DEMETER_CONF=env
+ENV PATH=$PATH:$ADMIN_HOME
+
+RUN apk add --no-cache --update py-gevent git && \
+	pip install -U git+http://git.dever.cc:3000/python/demeter.git && \
+	git clone http://git.dever.cc:3000/demeter/admin.git $ADMIN_HOME && \
+	chmod -R +x $ADMIN_HOME/*.py
+
+EXPOSE 8011 8012
+
+COPY admin.sh /entrypoint/admin.sh

+ 26 - 0
src/docker/build/dm/admin/admin.sh

@@ -0,0 +1,26 @@
+#!/usr/bin/env sh
+set -e
+start_admin()
+{
+    cd $ADMIN_LIB
+    git pull
+    cd $ADMIN_HOME
+    git reset --hard FETCH_HEAD
+    git pull
+    chmod -R +x $ADMIN_HOME/*.py
+    python install.py
+    process_start admin.py
+    process_start cron.py
+}
+
+stop_admin()
+{
+	process_stop admin.py
+    process_stop cron.py
+}
+
+monit_admin()
+{
+    process_monit admin.py
+    process_monit cron.py
+}

+ 3 - 0
src/docker/build/tool/ffmpeg/Dockerfile

@@ -0,0 +1,3 @@
+FROM jrottenberg/ffmpeg
+
+MAINTAINER Rabin "https://github.com/shemic"

+ 2 - 0
src/docker/build/tool/pan/Dockerfile

@@ -2,4 +2,6 @@ FROM jaegerdocker/pan
 
 MAINTAINER Rabin "https://github.com/shemic"
 
+#https://hub.docker.com/r/jaegerdocker/pan superuser 
+
 RUN chown -R mysql /var/lib/mysql && chgrp -R mysql /var/lib/mysql

+ 8 - 0
src/docker/conf/chengmao.conf

@@ -53,4 +53,12 @@ volumes = {container}web/mall:/root/input,{container}web/mall/doc:/root/output,{
 call = apidoc
 #使用dm call iot-apidoc input=demo&out=output来运行,然后可以在宿主机里使用apidoc命令
 param = -i /root/input/doc -o /root/output -c /root/config
+alias = apidoc
+
+[jy_apidoc]
+image = apidoc
+volumes = {container}web/jiaoyoucms:/root/input,{container}web/jiaoyoucms/public/doc:/root/output,{container}web/jiaoyoucms/public/doc:/root/config
+call = apidoc
+#使用dm call iot-apidoc input=demo&out=output来运行,然后可以在宿主机里使用apidoc命令
+param = -i /root/input/doc -o /root/output -c /root/config
 alias = apidoc

+ 5 - 3
src/docker/conf/daemon.conf

@@ -1,13 +1,13 @@
 [base]
 path = {base}
-default = master,manager
+default = master,manager,operater
 network = overlay_dm
 subnet = 10.0.0.0/255
 
 ;别名注册,使用 dm run daemon-run
 [alias]
 run = master,manager,operater
-add = client,worker
+join = client,worker
 
 [redis]
 ;port = 6379:6379,8888:8888
@@ -54,7 +54,9 @@ volumes = {container}share/lib:/data
 ;操作者,图形界面后台,可以直接访问daemon-manager
 [operater]
 image = admin
-port = 9091:8011,9092:8012
+port = 9091:8087,9092:8088
+volumes = {container}web:/web
+command = admin
 
 ;master、manager、operater、crond为主机开启
 ;client、worker为其他机器开启

+ 8 - 1
src/docker/conf/tool.conf

@@ -52,4 +52,11 @@ volumes = {container}share/sync_client:/data
 image = vsftpd
 port = 20:20,21:21,21100-21110:21100-21110
 volumes = {container}web/files:/home/vsftpd
-environment = FTP_USER=ftpadmin,FTP_PASS=123456
+environment = FTP_USER=ftpadmin,FTP_PASS=123456
+
+[ffmpeg]
+image = ffmpeg
+volumes = {container}web/mc/data:/tmp
+call = ffmpeg
+param = -i /tmp/001.avi -vcodec libx264 -threads 2 -preset fast -crf 28 -y -vf "scale=1920:-1" -acodec libmp3lame -ab 128k /tmp/out.mp4
+alias = ffmpeg

+ 5 - 1
src/docker/core.conf

@@ -78,6 +78,7 @@ grafana				= tool/grafana
 pan					= tool/pan
 vsftpd				= tool/vsftpd
 nextcloud           = tool/nextcloud
+ffmpeg				= tool/ffmpeg
 
 ;learn
 learn				= learning
@@ -122,4 +123,7 @@ lvs					= balance/lvs
 nfs					= file/nfs
 btsync				= file/btsync
 rsync				= file/rsync
-lsyncd				= file/lsyncd
+lsyncd				= file/lsyncd
+
+;dm
+admin				= dm/admin