fix deploy issues

- make supervisorctl happy
 - fix avatar path
 - refine logging config
 - add nginx buffer path
This commit is contained in:
virusdefender 2017-11-26 10:40:56 +08:00
parent 00eb3b1967
commit 1bf4973648
5 changed files with 50 additions and 57 deletions

View File

@ -1,5 +1,5 @@
location /public {
root /app/data;
root /data;
}
location /api {

View File

@ -20,6 +20,7 @@ http {
gzip on;
gzip_vary on;
gzip_types application/javascript text/css;
client_body_temp_path /tmp 1 2;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '

View File

@ -29,4 +29,4 @@ do
done
chown -R nobody:nogroup $DATA $APP/dist
exec supervisord -c /app/deploy/supervisor.conf
exec supervisord -c /app/deploy/supervisord.conf

View File

@ -1,20 +1,26 @@
[supervisord]
logfile=/app/data/log/supervisord.log
logfile=/data/log/supervisord.log
logfile_maxbytes=10MB
logfile_backups=10
loglevel=info
pidfile=/tmp/supervisord.pid
nodaemon=true
childlogdir=/app/data/log/
childlogdir=/data/log/
[inet_http_server]
port=127.0.0.1:9005
[rpcinterface:supervisor]
supervisor.rpcinterface_factory=supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///tmp/supervisor.sock
serverurl=http://127.0.0.1:9005
[program:nginx]
command=nginx -c /app/deploy/nginx/nginx.conf
directory=/app/
stdout_logfile=/app/data/log/nginx.log
stderr_logfile=/app/data/log/nginx.log
stdout_logfile=/data/log/nginx.log
stderr_logfile=/data/log/nginx.log
autostart=true
autorestart=true
startsecs=5
@ -25,8 +31,8 @@ killasgroup=true
command=sh -c "gunicorn oj.wsgi --user nobody -b 127.0.0.1:8080 --reload -w `grep -c ^processor /proc/cpuinfo`"
directory=/app/
user=nobody
stdout_logfile=/app/data/log/gunicorn.log
stderr_logfile=/app/data/log/gunicorn.log
stdout_logfile=/data/log/gunicorn.log
stderr_logfile=/data/log/gunicorn.log
autostart=true
autorestart=true
startsecs=5
@ -37,8 +43,8 @@ killasgroup=true
command=celery -A oj worker -l warning
directory=/app/
user=nobody
stdout_logfile=/app/data/log/celery.log
stderr_logfile=/app/data/log/celery.log
stdout_logfile=/data/log/celery.log
stderr_logfile=/data/log/celery.log
autostart=true
autorestart=true
startsecs=5

View File

@ -125,54 +125,40 @@ UPLOAD_DIR = f"{DATA_DIR}{UPLOAD_PREFIX}"
STATICFILES_DIRS = [os.path.join(DATA_DIR, "public")]
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'standard': {
'format': '%(asctime)s [%(threadName)s:%(thread)d] [%(name)s:%(lineno)d] [%(module)s:%(funcName)s] [%(levelname)s]- %(message)s',
'datefmt': '%Y-%m-%d %H:%M:%S'
}
},
'handlers': {
'django_error': {
'level': 'WARNING',
'class': 'logging.handlers.RotatingFileHandler',
'filename': os.path.join(LOG_PATH, 'django.log'),
'formatter': 'standard'
},
'app_info': {
'level': 'INFO',
'class': 'logging.handlers.RotatingFileHandler',
'filename': os.path.join(LOG_PATH, 'app_info.log'),
'formatter': 'standard'
},
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'standard'
}
},
'loggers': {
'django.request': {
'handlers': ['django_error', 'console'],
'level': 'WARNING',
'propagate': True,
},
'django.db.backends': {
'handlers': ['django_error', 'console'],
'level': 'WARNING',
'propagate': True,
},
},
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'standard': {
'format': '[%(asctime)s] - [%(levelname)s] - [%(name)s:%(lineno)d] - %(message)s',
'datefmt': '%Y-%m-%d %H:%M:%S'
}
},
'handlers': {
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'standard'
}
},
'loggers': {
'django.request': {
'handlers': ['console'],
'level': 'ERROR',
'propagate': True,
},
'django.db.backends': {
'handlers': ['console'],
'level': 'ERROR',
'propagate': True,
},
'': {
'handlers': ['console'],
'level': 'WARNING',
'propagate': True,
}
},
}
app_logger = {
'handlers': ['app_info', 'console'],
'level': 'DEBUG',
'propagate': False
}
LOGGING["loggers"].update({app: deepcopy(app_logger) for app in LOCAL_APPS})
REST_FRAMEWORK = {
'TEST_REQUEST_DEFAULT_FORMAT': 'json',