如何正确配置TAIGA生产环境



我面临与#415和#367的类似问题。我刚刚在Digitalocean的Ubuntu 16.04上完成了安装。我还遵循了有关部署生产taiga的文档指南。

当我尝试从外部系统连接时,我会在JS控制台上获得OOMPA LOOMPAS错误消息:

http://138.28.207.46:8000/api/v1/ Failed to load resource: could not connect to server.

如果我删除:8000从〜/taiga-front-dist/dist/conf.json我遇到另一个错误:

http://138.28.207.46/api/v1/ Failed to load resource: 502 bad gateway

在第415和#367号问题中,他们设法修复了它,但没有一个描述了需要更改哪些文件的端口。

/etc/etc/nginx/stites-available/taiga

server {
    listen 80 default_server;
    server_name _;
    large_client_header_buffers 4 32k;
    client_max_body_size 50M;
    charset utf-8;
    access_log /home/taiga/logs/nginx.access.log;
    error_log /home/taiga/logs/nginx.error.log;
    # Frontend
    location / {
        root /home/taiga/taiga-front-dist/dist/;
        try_files $uri $uri/ /index.html;
    }
    # Backend
    location /api {
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Scheme $scheme;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://127.0.0.1:8000/api/v1/;
        proxy_redirect off;
    }
    # Django admin access (/admin/)
    location /admin {
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Scheme $scheme;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://127.0.0.1:8000$request_uri;
        proxy_redirect off;
    }
    # Static files
    location /static {
        alias /home/taiga/taiga-back/static;
    }
    # Media files
    location /media {
        alias /home/taiga/taiga-back/media;
    }
}

/etc/circus/conf.d/taiga.ini

[watcher:taiga]
working_dir = /home/taiga/taiga-back
cmd = gunicorn
args = -w 3 -t 60 --pythonpath=. -b 127.0.0.1:8000 taiga.wsgi
uid = taiga
numprocesses = 1
autostart = true
send_hup = true
stdout_stream.class = FileStream
stdout_stream.filename = /home/taiga/logs/gunicorn.stdout.log
stdout_stream.max_bytes = 10485760
stdout_stream.backup_count = 4
stderr_stream.class = FileStream
stderr_stream.filename = /home/taiga/logs/gunicorn.stderr.log
stderr_stream.max_bytes = 10485760
stderr_stream.backup_count = 4
[env:taiga]
PATH = /home/taiga/.virtualenvs/taiga/bin:$PATH
TERM=rxvt-256color
SHELL=/bin/bash
USER=taiga
LANG=en_US.UTF-8
HOME=/home/taiga
PYTHONPATH=/home/taiga/.virtualenvs/taiga/lib/python3.5/site-packages

〜/taiga-front-dist/dist/conf.json

{
    "api": "http://138.28.207.46:8000/api/v1/",
    "eventsUrl": null,
    "debug": "true",
    "publicRegisterEnabled": true,
    "feedbackEnabled": true,
    "privacyPolicyUrl": null,
    "termsOfServiceUrl": null,
    "maxUploadFileSize": null,
    "contribPlugins": []
}

〜/taiga-back/settings/local.py

from .common import *
MEDIA_URL = "http://138.28.207.46/media/"
STATIC_URL = "http://138.28.207.46/static/"
ADMIN_MEDIA_PREFIX = "http://138.28.207.46/static/admin/"
SITES["front"]["scheme"] = "http"
SITES["front"]["domain"] = "138.28.207.46"
SECRET_KEY = "theveryultratopsecretkey"
DEBUG = False
TEMPLATE_DEBUG = False
PUBLIC_REGISTER_ENABLED = True
#DEFAULT_FROM_EMAIL = "no-reply@example.com"
#SERVER_EMAIL = DEFAULT_FROM_EMAIL
# Uncomment and populate with proper connection parameters
# for enable email sending. EMAIL_HOST_USER should end by @domain.tld
#EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"
#EMAIL_USE_TLS = False
#EMAIL_HOST = "localhost"
#EMAIL_HOST_USER = ""
#EMAIL_HOST_PASSWORD = ""
#EMAIL_PORT = 25
# Uncomment and populate with proper connection parameters
# for enable github login/singin.
#GITHUB_API_CLIENT_ID = "yourgithubclientid"
#GITHUB_API_CLIENT_SECRET = "yourgithubclientsecret"

我还使用数字海洋来托管。我的端口使用8001不是8000。不确定是否有帮助。我要浏览SSL并使用一些插件(Slack and Git),因此安装时代码可能会有所不同。我为工作安装发布了代码,因此您可以比较与您的代码。希望这会有所帮助。

/etc/etc/nginx/stites-available/taiga

# Frontend
 location / {
 root /home/taiga/taiga-front-dist/dist/;
 try_files $uri $uri/ /index.html;
 }
# Backend
 location /api {
 proxy_set_header Host $http_host;
 proxy_set_header X-Real-IP $remote_addr;
 proxy_set_header X-Scheme $scheme;
 proxy_set_header X-Forwarded-Proto $scheme;
 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 proxy_pass http://127.0.0.1:8001/api;
 proxy_redirect off;
 }
# Django admin access (/admin/)
 location /admin {
 proxy_set_header Host $http_host;
 proxy_set_header X-Real-IP $remote_addr;
 proxy_set_header X-Scheme $scheme;
 proxy_set_header X-Forwarded-Proto $scheme;
 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 proxy_pass http://127.0.0.1:8001$request_uri;
 proxy_redirect off;
 }
# Static files
 location /static {
 alias /home/taiga/taiga-back/static;
 }
# Media files
 location /media {
 alias /home/taiga/taiga-back/media;
 }
# Events
 location /events {
       proxy_pass http://127.0.0.1:8888/events;
       proxy_http_version 1.1;
       proxy_set_header Upgrade $http_upgrade;
       proxy_set_header Connection "upgrade";
       proxy_connect_timeout 7d;
       proxy_send_timeout 7d;
       proxy_read_timeout 7d;
    }
}

/etc/circus/conf.d/taiga.ini

[watcher:taiga]
working_dir = /home/taiga/taiga-back
cmd = gunicorn
args = -w 3 -t 60 --pythonpath=. -b 127.0.0.1:8001 taiga.wsgi
uid = taiga
numprocesses = 1
autostart = true
send_hup = true
stdout_stream.class = FileStream
stdout_stream.filename = /home/taiga/logs/gunicorn.stdout.log
stdout_stream.max_bytes = 10485760
stdout_stream.backup_count = 4
stderr_stream.class = FileStream
stderr_stream.filename = /home/taiga/logs/gunicorn.stderr.log
stderr_stream.max_bytes = 10485760
stderr_stream.backup_count = 4
[env:taiga]
PATH = /home/taiga/.virtualenvs/taiga/bin:$PATH
TERM=rxvt-256color
SHELL=/bin/bash
USER=taiga
LANG=en_US.UTF-8
HOME=/home/taiga
PYTHONPATH=/home/taiga/.virtualenvs/taiga/lib/python3.5/site-packages

/taiga-front-dist/dist/conf.json

{
    "api": "https://example.com/api/v1/",
    "eventsUrl": "wss://example.com/events",
    "eventsMaxMissedHeartbeats": 5,
    "eventsHeartbeatIntervalTime": 60000,
    "eventsReconnectTryInterval": 10000,
    "debug": true,
    "debugInfo": false,
    "defaultLanguage": "en",
    "themes": ["taiga"],
    "defaultTheme": "taiga",
    "publicRegisterEnabled": true,
    "feedbackEnabled": true,
    "privacyPolicyUrl": null,
    "termsOfServiceUrl": null,
    "maxUploadFileSize": null,
    "contribPlugins": ["/plugins/slack/slack.json"],
    "tribeHost": null,
    "importers": ["trello"],
    "gravatar": true
}

/taiga-back/settings/local.py

from .common import *
MEDIA_URL = "https://example.com/media/"
STATIC_URL = "https://example.com/static/"
SITES["front"]["scheme"] = "https"
SITES["front"]["domain"] = "example.com"
SITES["api"]["scheme"] = "https"
SITES["api"]["domain"] = "example.com"

SECRET_KEY = "theveryultratopsecretkey"
DEBUG = False
TEMPLATE_DEBUG = False
PUBLIC_REGISTER_ENABLED = True

相关内容

  • 没有找到相关文章

最新更新