本次部署使用django+nginx+daphne+gunicorn+supervisord
1.每次修改完nginx配置都要重启nginx才能生效
2.daphne支持asgi,本项目用于处理消息通知和私信功能
3.gunicorn是处理动态请求
4.supervisord管理部署的启动项,减少工作量
在装环境的时候,装了一系列的python依赖,但是在后序装一些模块的时候出现gcc错误。仔细排查后发现装的依赖是python2.7的,项目用的是3.6,所以指定特定版本的依赖后问题解决。
邮箱服务器使用qq邮箱,将授权码等写入配置文件即可,使用celery异步处理邮件请求
es能够使用curl访问,但是看日志文件有这些错误
2019-12-11 11:24:15,679 INFO spawned: 'elasticsearch_worker1' with pid 24617
2019-12-11 11:24:16,653 INFO exited: elasticsearch_worker1 (exit status 0; not expected)
2019-12-11 11:24:19,660 INFO spawned: 'elasticsearch_worker1' with pid 24796
2019-12-11 11:24:20,480 INFO exited: elasticsearch_worker1 (exit status 0; not expected)
2019-12-11 11:24:21,484 INFO gave up: elasticsearch_worker1 entered FATAL state, too many start retries too quickly
猜测应该是和集群有关,目前还没解决。
查看gunicorn日志
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/elasticsearch/connection/http_urllib3.py", line 95, in perform_request
response = self.pool.urlopen(method, url, body, retries=False, headers=self.headers, **kw)
File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 638, in urlopen
_stacktrace=sys.exc_info()[2])
File "/usr/local/lib/python3.6/site-packages/urllib3/util/retry.py", line 344, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/usr/local/lib/python3.6/site-packages/urllib3/packages/six.py", line 686, in reraise
raise value
File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 600, in urlopen
chunked=chunked)
File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 386, in _make_request
self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 306, in _raise_timeout
raise ReadTimeoutError(self, url, "Read timed out. (read timeout=%s)" % timeout_value)
urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='127.0.0.1', port=9200): Read timed out. (read timeout=10)
ERROR 2019-12-11 11:42:27,120 exception 24550 140278215137088 Invalid HTTP_HOST header: '_'. The domain name provided is not valid according to RFC 1034/1035.