mattermost-community / focalboard

Focalboard is an open source, self-hosted alternative to Trello, Notion, and Asana.
https://www.focalboard.com
Other
21.9k stars 1.97k forks source link

Bug: NGINX 502 Error when deploying Focalboard #3017

Open 9j7axvsLuF opened 2 years ago

9j7axvsLuF commented 2 years ago

I have deployed Focalboard with Caprover as one-click-app (Docker compose), but I get an NGINX 502 Error. The container port is correctly set to 8000.

Here is the NGINX config on Caprover:

<%
if (s.forceSsl) {
%>
    server {

        listen       80;

        server_name  <%-s.publicDomain%>;

        # Used by Lets Encrypt
        location /.well-known/acme-challenge/ {
            root <%-s.staticWebRoot%>;
        }

        # Used by CapRover for health check
        location /.well-known/captain-identifier {
            root <%-s.staticWebRoot%>;
        }

        location / {
            return 302 https://$http_host$request_uri;
        }
    }
<%
}
%>

server {

    <%
    if (!s.forceSsl) {
    %>
        listen       80;
    <%
    }
    if (s.hasSsl) {
    %>
        listen              443 ssl http2;
        ssl_certificate     <%-s.crtPath%>;
        ssl_certificate_key <%-s.keyPath%>;
    <%
    }
    %>

        client_max_body_size 500m;

        server_name  <%-s.publicDomain%>;

        # 127.0.0.11 is DNS set up by Docker, see:
        # https://docs.docker.com/engine/userguide/networking/configure-dns/
        # https://github.com/moby/moby/issues/20026
        resolver 127.0.0.11 valid=10s;
        # IMPORTANT!! If you are here from an old thread to set a custom port, you do not need to modify this port manually here!!
        # Simply change the Container HTTP Port from the dashboard HTTP panel
        set $upstream http://<%-s.localDomain%>:<%-s.containerHttpPort%>;

        location / {

    <%
    if (s.httpBasicAuthPath) {
    %>
            auth_basic           "Restricted Access";
            auth_basic_user_file <%-s.httpBasicAuthPath%>; 
    <%
    }
    %>

            proxy_pass $upstream;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;

    <%
    if (s.websocketSupport) {
    %>
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_http_version 1.1;
    <%
    }
    %>
        }

        # Used by Lets Encrypt
        location /.well-known/acme-challenge/ {
            root <%-s.staticWebRoot%>;
        }

        # Used by CapRover for health check
        location /.well-known/captain-identifier {
            root <%-s.staticWebRoot%>;
        }

        error_page 502 /captain_502_custom_error_page.html;
        location = /captain_502_custom_error_page.html {
                root <%-s.customErrorPagesDirectory%>;
                internal;
        }
}

And here is the value of the CONFIG_JSON environment variable:

{"serverRoot":"http://srv-captain--focalboard:8000","port":8000,"dbtype":"postgres","dbconfig":"postgres://boardsuser:268c9r8pyas2g8gjt5n2t3s5vz37u8qs@srv-captain--focalboard-db/boards?sslmode=disable&connect_timeout=10","postgres_dbconfig":"dbname=boards sslmode=disable","useSSL":false,"webpath":"./pack","filespath":"./files","telemetry":false,"session_expire_time":2592000,"session_refresh_time":18000,"localOnly":false,"enableLocalMode":true,"localModeSocketLocation":"/var/tmp/focalboard_local.socket"}

wuwinson commented 2 years ago

@Pinjasaur Queueing this one up for v7.1. cc @sbishel

wuwinson commented 2 years ago

Does anyone have experience with Caprover?

wmv commented 1 year ago

Having this issue as well.