-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
94 additions
and
244 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,17 @@ | ||
FROM python:3.6.4 | ||
FROM wuyue/python3-app:with_nginx | ||
MAINTAINER wuyue92tree@163.com | ||
|
||
RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \ | ||
&& mkdir -p /data/src \ | ||
&& mkdir -p /data/logs | ||
COPY . /data/src | ||
COPY ./deploy.ini /etc/supervisor/conf.d/ | ||
COPY ./_product/nginx.conf /usr/local/nginx/conf/nginx.conf | ||
|
||
COPY ./requirements.txt /data/src | ||
COPY ./manage.py /data/src | ||
RUN pip install -r requirements.txt -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com \ | ||
&& pip install https://github.com/darklow/django-suit/tarball/v2 | ||
|
||
WORKDIR /data/src | ||
RUN python manage.py collectstatic --noinput | ||
|
||
RUN pip install -r requirements.txt -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com\ | ||
&& pip install https://github.com/darklow/django-suit/tarball/v2 \ | ||
&& pip install git+https://github.com/Supervisor/supervisor | ||
WORKDIR /data/src | ||
|
||
EXPOSE 3031 | ||
EXPOSE 5555 | ||
EXPOSE 9001 | ||
|
||
CMD supervisord -nc /etc/supervisor/supervisor.conf | ||
EXPOSE 80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,57 @@ | ||
server { | ||
# the port your site will be served on | ||
listen 80; | ||
# the domain name it will serve for | ||
server_name localhost; # substitute your machine's IP address or FQDN | ||
charset utf-8; | ||
|
||
# access_log /data/logs/access_log; | ||
# error_log /data/logs/error_log; | ||
|
||
# max upload size | ||
client_max_body_size 75M; # adjust to taste | ||
|
||
# Django media | ||
# location /media { | ||
# alias /data/src/media; # your Django project's media files - amend as required | ||
# } | ||
|
||
# location /media/images { | ||
# autoindex on; | ||
# autoindex_exact_size off; | ||
# autoindex_localtime on; | ||
# alias /data/src/static/media/images; # your Django project's media files - amend as required | ||
#} | ||
|
||
location /static { | ||
alias /data/src/static; # your Django project's static files - amend as required | ||
#user nobody; | ||
worker_processes 4; | ||
|
||
} | ||
#pid logs/nginx.pid; | ||
|
||
events { | ||
worker_connections 1024; | ||
} | ||
|
||
|
||
http { | ||
include mime.types; | ||
default_type application/octet-stream; | ||
|
||
#log_format main '$remote_addr - $remote_user [$time_local] "$request" ' | ||
# '$status $body_bytes_sent "$http_referer" ' | ||
# '"$http_user_agent" "$http_x_forwarded_for"'; | ||
|
||
#access_log logs/access.log main; | ||
|
||
sendfile on; | ||
#tcp_nopush on; | ||
|
||
#keepalive_timeout 0; | ||
keepalive_timeout 65; | ||
|
||
#gzip on; | ||
server { | ||
# the port your site will be served on | ||
listen 80; | ||
# the domain name it will serve for | ||
server_name localhost; # substitute your machine's IP address or FQDN | ||
charset utf-8; | ||
|
||
access_log /data/src/log/access_log; | ||
error_log /data/src/log/error_log; | ||
|
||
# max upload size | ||
client_max_body_size 75M; # adjust to taste | ||
|
||
# Django media | ||
location /media { | ||
alias /data/src/media; # your Django project's media files - amend as required | ||
} | ||
|
||
location /static { | ||
alias /data/src/static; # your Django project's static files - amend as required | ||
|
||
# Finally, send all non-media requests to the Django server. | ||
location / { | ||
} | ||
|
||
uwsgi_pass rest_backend:3031; | ||
include /etc/nginx/uwsgi_params; # the uwsgi_params file you installed | ||
# Finally, send all non-media requests to the Django server. | ||
location / { | ||
uwsgi_pass 127.0.0.1:3031; | ||
include /usr/local/nginx/conf/uwsgi_params; # the uwsgi_params file you installed | ||
} | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,55 @@ | ||
[program:uwsgi] | ||
directory = /data/src ; 程序的启动目录 | ||
command = uwsgi uwsgi.ini ; 启动命令,可以看出与手动在命令行启动的命令是一样的 | ||
command = uwsgi /data/src/_product/uwsgi.ini ; 启动命令,可以看出与手动在命令行启动的命令是一样的 | ||
autostart = true ; 在 supervisord 启动的时候也自动启动 | ||
startsecs = 5 ; 启动 5 秒后没有异常退出,就当作已经正常启动了 | ||
autorestart = true ; 程序异常退出后自动重启 | ||
startretries = 3 ; 启动失败自动重试次数,默认是 3 | ||
; user = wuyue ; 用哪个用户启动 | ||
; user = root ; 用哪个用户启动 | ||
redirect_stderr = true ; 把 stderr 重定向到 stdout,默认 false | ||
stdout_logfile_maxbytes = 20MB ; stdout 日志文件大小,默认 50MB | ||
stdout_logfile_backups = 20 ; stdout 日志文件备份数 | ||
; stdout 日志文件,需要注意当指定目录不存在时无法正常启动,所以需要手动创建目录(supervisord 会自动创建日志文件) | ||
stdout_logfile = /data/logs/uwsgi.log | ||
stdout_logfile = /data/src/log/uwsgi_stdout.log | ||
|
||
[program:celery_flower] | ||
[program:nginx] | ||
directory = /data/src ; 程序的启动目录 | ||
command = celery -A rest_backend.settings.celery_product flower -l info ; 启动命令,可以看出与手动在命令行启动的命令是一样的 | ||
command = /usr/local/nginx/sbin/nginx -g 'daemon off;' ; 启动命令,可以看出与手动在命令行启动的命令是一样的 | ||
autostart = true ; 在 supervisord 启动的时候也自动启动 | ||
startsecs = 5 ; 启动 5 秒后没有异常退出,就当作已经正常启动了 | ||
autorestart = true ; 程序异常退出后自动重启 | ||
startretries = 3 ; 启动失败自动重试次数,默认是 3 | ||
; user = wuyue ; 用哪个用户启动 | ||
; user = root ; 用哪个用户启动 | ||
redirect_stderr = true ; 把 stderr 重定向到 stdout,默认 false | ||
stdout_logfile_maxbytes = 20MB ; stdout 日志文件大小,默认 50MB | ||
stdout_logfile_backups = 20 ; stdout 日志文件备份数 | ||
; stdout 日志文件,需要注意当指定目录不存在时无法正常启动,所以需要手动创建目录(supervisord 会自动创建日志文件) | ||
stdout_logfile = /data/logs/celery_flower.log | ||
stdout_logfile = /data/src/log/nginx_stdout.log | ||
|
||
[program:celery_beat] | ||
[program:celery_flower] | ||
directory = /data/src ; 程序的启动目录 | ||
command = rm -f celerybeat.pid && celery -A rest_backend.settings.celery_product beat -l info ; 启动命令,可以看出与手动在命令行启动的命令是一样的 | ||
command = celery -A rest_backend.settings.celery_product flower -l info --persistent=True --db=./db/flower ; 启动命令,可以看出与手动在命令行启动的命令是一样的 | ||
autostart = true ; 在 supervisord 启动的时候也自动启动 | ||
startsecs = 5 ; 启动 5 秒后没有异常退出,就当作已经正常启动了 | ||
autorestart = true ; 程序异常退出后自动重启 | ||
startretries = 3 ; 启动失败自动重试次数,默认是 3 | ||
; user = wuyue ; 用哪个用户启动 | ||
; user = root ; 用哪个用户启动 | ||
redirect_stderr = true ; 把 stderr 重定向到 stdout,默认 false | ||
stdout_logfile_maxbytes = 20MB ; stdout 日志文件大小,默认 50MB | ||
stdout_logfile_backups = 20 ; stdout 日志文件备份数 | ||
; stdout 日志文件,需要注意当指定目录不存在时无法正常启动,所以需要手动创建目录(supervisord 会自动创建日志文件) | ||
stdout_logfile = /data/logs/celery_beat.log | ||
stdout_logfile = /data/src/log/celery_flower_stdout.log | ||
|
||
[program:celery_worker] | ||
[program:celery] | ||
directory = /data/src ; 程序的启动目录 | ||
command = celery -A rest_backend.settings.celery_product worker -l info ; 启动命令,可以看出与手动在命令行启动的命令是一样的 | ||
command = celery -A rest_backend.settings.celery_product worker -l info -B ; 启动命令,可以看出与手动在命令行启动的命令是一样的 | ||
autostart = true ; 在 supervisord 启动的时候也自动启动 | ||
startsecs = 5 ; 启动 5 秒后没有异常退出,就当作已经正常启动了 | ||
autorestart = true ; 程序异常退出后自动重启 | ||
startretries = 3 ; 启动失败自动重试次数,默认是 3 | ||
; user = wuyue ; 用哪个用户启动 | ||
; user = root ; 用哪个用户启动 | ||
redirect_stderr = true ; 把 stderr 重定向到 stdout,默认 false | ||
stdout_logfile_maxbytes = 20MB ; stdout 日志文件大小,默认 50MB | ||
stdout_logfile_backups = 20 ; stdout 日志文件备份数 | ||
; stdout 日志文件,需要注意当指定目录不存在时无法正常启动,所以需要手动创建目录(supervisord 会自动创建日志文件) | ||
stdout_logfile = /data/logs/celery_worker.log | ||
stdout_logfile = /data/src/log/celery_stdout.log |
This file was deleted.
Oops, something went wrong.
Empty file.
Oops, something went wrong.