mattermost-community / focalboard

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

Bug: 502 Bad Gateway on Personal Server (Ubuntu) #2269

Open TeaOfTheSea opened 2 years ago

TeaOfTheSea commented 2 years ago

Steps to reproduce the behavior

visit https://focalboard.my.domain

Expected behavior

The page is successfully loaded.

Edition and Platform

Additional context

When I installed the Focalboard personal server, I created a mariadb database instead of using mysql, as I was already using mariadb for nextcloud, and installing mysql along side mariadb would be beyond my know how. I recall having some 502 issue at the time, but I eventually resolved it. Focalboard had been working for about a month since then, but is now failing to start after I restarted my debian 10 webserver.

Running systemctl status focalboard returns: ● focalboard.service - Focalboard server Loaded: loaded (/lib/systemd/system/focalboard.service; enabled; vendor preset: enabled) Active: activating (auto-restart) (Result: exit-code) since Sat 2022-02-05 18:59:11 UTC; 4s ago Process: 32650 ExecStart=/opt/focalboard/bin/focalboard-server (code=exited, status=1/FAILURE) Main PID: 32650 (code=exited, status=1/FAILURE)

Running manually, as described here, returns: 2022/02/05 19:03:22 readConfigFile 2022/02/05 19:03:22 {ServerRoot:http://localhost:8000 Port:8000 DBType:mysql DBConfigString:boardsuser:_plainTextPasswordStringThatIDontFeelLikeSharing_@tcp(127.0.0.1:3306)/boards DBTablePrefix: UseSSL:false SecureCookie:false WebPath:./pack FilesDriver:local FilesS3Config:{AccessKeyID: SecretAccessKey: Bucket: PathPrefix: Region: Endpoint: SSL:false SignV2:false SSE:false Trace:false} FilesPath:./files Telemetry:true TelemetryID: PrometheusAddress::9092 WebhookUpdate:[] Secret: SessionExpireTime:2592000 SessionRefreshTime:18000 LocalOnly:false EnableLocalMode:true LocalModeSocketLocation:/var/tmp/focalboard_local.socket EnablePublicSharedBoards:false AuthMode:native LoggingCfgFile: LoggingCfgJSON: AuditCfgFile: AuditCfgJSON:} info [2022-02-05 19:03:22.574 Z] FocalBoard Server caller="mlog/mlog.go:218" version=0.9.2 edition=linux build_number=1320942631 build_date="Fri Oct 8 15:36:12 UTC 2021" build_hash=c632409feb1c6ea66851f99db8e0f92472b953fc error [2022-02-05 19:03:22.574 Z] Database Ping failed caller="mlog/mlog.go:228" error="commands out of sync. Did you run multiple statements at once?" fatal [2022-02-05 19:03:22.574 Z] server.NewStore ERROR caller="mlog/mlog.go:234" error="commands out of sync. Did you run multiple statements at once?" github.com/mattermost/focalboard/server/services/mlog.(*Logger).Fatal /home/runner/work/focalboard/focalboard/server/services/mlog/mlog.go"234 main.main /home/runner/work/focalboard/focalboard/server/main/main.go"165

From my googling, this seems to be an error with the version of mariadb I am using, but that conclusion is quite confusing to me, as mariadb had been working previously.

I don't know where to go from here, any and all help is appreciated.

Also set the Severity using the Sev/1, Sev/2 or Sev/3 labels as best you can:

wuwinson commented 2 years ago

@TeaOfTheSea Can you try updating to the latest release and see if you're still running into this issue? Thanks!

TeaOfTheSea commented 2 years ago

@wuwinson Updated. Error text appears to be the same. 2022/02/08 00:29:01 readConfigFile 2022/02/08 00:29:01 {ServerRoot:http://localhost:8000 Port:8000 DBType:mysql DBConfigString:boardsuser:dceRg&SnM6l%Oxo48@1VXas^Y4xC2l36@tcp(127.0.0.1:3306)/boards DBTablePrefix: UseSSL:false SecureCookie:false WebPath:./pack FilesDriver:local FilesS3Config:{AccessKeyID: SecretAccessKey: Bucket: PathPrefix: Region: Endpoint: SSL:false SignV2:false SSE:false Trace:false} FilesPath:./files Telemetry:true TelemetryID: PrometheusAddress::9092 WebhookUpdate:[] Secret: SessionExpireTime:2592000 SessionRefreshTime:18000 LocalOnly:false EnableLocalMode:true LocalModeSocketLocation:/var/tmp/focalboard_local.socket EnablePublicSharedBoards:false FeatureFlags:map[] AuthMode:native LoggingCfgFile: LoggingCfgJSON: AuditCfgFile: AuditCfgJSON: NotifyFreqCardSeconds:0 NotifyFreqBoardSeconds:0} info [2022-02-08 00:29:01.314 Z] FocalBoard Server caller="main/main.go:56" version=0.12.1 edition=linux build_number=1718746166 build_date="Wed Jan 19 15:21:34 UTC 2022" build_hash=a0ccc6c26b4cd05dc6d63ffb4f4b05a68adf679d error [2022-02-08 00:29:01.314 Z] Database Ping failed caller="server/server.go:218" error="commands out of sync. Did you run multiple statements at once?" fatal [2022-02-08 00:29:01.314 Z] server.NewStore ERROR caller="main/main.go:145" error="commands out of sync. Did you run multiple statements at once?" main.main /home/runner/work/focalboard/focalboard/server/main/main.go:145 runtime.main /opt/hostedtoolcache/go/1.16.13/x64/src/runtime/proc.go:225 runtime.goexit /opt/hostedtoolcache/go/1.16.13/x64/src/runtime/asm_amd64.s:1371

dikkedimi commented 2 years ago

I am having the same issue on ubuntu 20.04 LTS.

following the steps to the letter and it leads to a bad gateway.

My other nginx host works fine, it's too bad i prefer to run that on port 80.

what is unclear to me, reading the config files and the service configuration: where is nginx supposed to get the memo about the working directory? Seems weird to let the .service file handle that.

the location ~ /ws/* { is the part that is confusing to me Apparently this is a proxy. Since it's for 'personal' use, why configure this as a requirement? Is there a more simple config available, which foregoes the proxy and is more compatible with an existing multi-host configuration? For me as a bit of a networking novice (still), something barebones would be quite nice to have, to better understand what's going on. Especially since the offered instructions lead to an unsuable bloat on system. And it appears I am not the only one.

after modifying the urls in the basic nginx config as such:

upstream domain.com {
   server localhost:8000;
   keepalive 32;
}

server {
   listen 80 default_server;

   server_name focalboard;

   location ~ /ws/* {
       proxy_set_header Upgrade $http_upgrade;
       proxy_set_header Connection "upgrade";
       client_max_body_size 50M;
       proxy_set_header Host $http_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;
       proxy_set_header X-Frame-Options SAMEORIGIN;
       proxy_buffers 256 16k;
       proxy_buffer_size 16k;
       client_body_timeout 60;
       send_timeout 300;
       lingering_timeout 5;
       proxy_connect_timeout 1d;
       proxy_send_timeout 1d;
       proxy_read_timeout 1d;
       proxy_pass http://domain.com;
   }

   location / {
       client_max_body_size 50M;
       proxy_set_header Connection "";
       proxy_set_header Host $http_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;
       proxy_set_header X-Frame-Options SAMEORIGIN;
       proxy_buffers 256 16k;
       proxy_buffer_size 16k;
       proxy_read_timeout 600s;
       proxy_cache_revalidate on;
       proxy_cache_min_uses 2;
       proxy_cache_use_stale timeout;
       proxy_cache_lock on;
       proxy_http_version 1.1;
       proxy_pass http://domain.com;
   }
}

I am only getting this as a clue from the error.log

[error] 21333#21333: *40 connect() failed (111: Connection refused) while connecting to upstream, client: 10.0.0.16, server: domain.com, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8000/", host: "domain.com"

Since the install instructions don't go into detail about the config options and why they are present this is all I can contribute.