简体   繁体   中英

Deploy readthedocs on production (nginx + gunicorn)

I am trying to deploy to a production server the project Read The Docs ( http://docs.readthedocs.io/en/latest/install.html ) for internal use at the company I work.

I followed the install steps at the above url, it worked when I run with 'python manage.py 0.0.0.0:8000', but when I tried to deploy with Nginx + Gunicorn + Supervisord, the builds doesn't start, it keep showing 'Triggered version latest (html)'

On the serve I got the error below, but I have no idea what I did wrong.

Is the Read The Docs able to run with Nginx + Gunicorn + Supervisord? Do I have to install or configure celery?

Thanks in advance!

[09/Feb/2018 15:29:59] "GET /api/v2/project/2/ HTTP/1.1" 403 39
[09/Feb/2018 15:29:59] readthedocs.projects.tasks:159[15266]: ERROR An unhandled exception was raised during build setup
Traceback (most recent call last):
  File "/webapps/readthedocs/src/readthedocs/projects/tasks.py", line 144, in run
    self.project = self.get_project(pk)
  File "/webapps/readthedocs/src/readthedocs/projects/tasks.py", line 299, in get_project
    project_data = api_v2.project(project_pk).get()
  File "/webapps/readthedocs/rtd_env/local/lib/python2.7/site-packages/slumber/__init__.py", line 155, in get
    resp = self._request("GET", params=kwargs)
  File "/webapps/readthedocs/rtd_env/local/lib/python2.7/site-packages/slumber/__init__.py", line 101, in _request
    raise exception_class("Client Error %s: %s" % (resp.status_code, url), response=resp, content=resp.content)
HttpClientError: Client Error 403: http://localhost:8000/api/v2/project/2/
[09/Feb/2018 15:29:59] celery.app.trace:248[15266]: ERROR Task readthedocs.projects.tasks.update_docs[1cf185cd-57dd-478b-8689-bb795f26543c] raised unexpected: AttributeError("'UpdateDocsTask' object has no attribute 'setup_env'",)
Traceback (most recent call last):
  File "/webapps/readthedocs/rtd_env/local/lib/python2.7/site-packages/celery/app/trace.py", line 374, in trace_task
    R = retval = fun(*args, **kwargs)
  File "/webapps/readthedocs/src/readthedocs/projects/tasks.py", line 163, in run
    build_id=build_pk,
AttributeError: 'UpdateDocsTask' object has no attribute 'setup_env'

I also ran into same problem everytime I used a port other then 8000. Finally I used port 8000. You don't need to configure celery. I would suggest to check your local settings( readthedocs/settings/local_settings.py ) once again. Specifically the PRODUCTION_DOMAIN setting.

Mine looks like this -

PRODUCTION_DOMAIN = "mydomain.com"
SITE_ID = 2  # i have overided it from 1 to 2. 
ALLOW_PRIVATE_REPOS = True
SECRET_KEY = "some random secret key"
PUBLIC_API_URL = 'http://{0}'.format(PRODUCTION_DOMAIN)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM