Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: focalboard server ignores postgres hostname #5033

Open
CNC5 opened this issue Aug 7, 2024 · 0 comments
Open

Bug: focalboard server ignores postgres hostname #5033

CNC5 opened this issue Aug 7, 2024 · 0 comments
Labels
Bug Something isn't working Triage

Comments

@CNC5
Copy link

CNC5 commented Aug 7, 2024

Steps to reproduce the behavior

Run focalboard server with a hostname different from localhost in the postgres connection string, example:

postgres://boardsuser:buo9ieHo@postgres/boards?sslmode=disable&connect_timeout=10

Expected behavior

Normal connection

Edition and Platform

  • Edition: Personal Server
  • Version: 7.10.6
  • Browser and OS: None

Additional context (optional)

Logs:

2024/08/07 09:39:51 {ServerRoot:http://0.0.0.0:8000 Port:8000 DBType:postgres DBConfigString:"postgres://boardsuser:buo9ieHo@postgres/boards?sslmode=disable&connect_timeout=10" DBTablePrefix: UseSSL:false SecureCookie:false WebPath:./pack FilesDriver:local FilesS3Config:{AccessKeyID: SecretAccessKey: Bucket: PathPrefix: Region: Endpoint: SSL:false SignV2:false SSE:false Trace:false Timeout:0} FilesPath:./files MaxFileSize:0 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[] EnableDataRetention:false DataRetentionDays:0 TeammateNameDisplay:username ShowEmailAddress:false ShowFullName:false AuthMode:native LoggingCfgFile: LoggingCfgJSON: AuditCfgFile: AuditCfgJSON: NotifyFreqCardSeconds:0 NotifyFreqBoardSeconds:0}
info  [2024-08-07 09:39:51.864 Z] Focalboard server                        caller="model/version.go:64" version=7.10.6 edition=linux build_number=5895202942 build_date="Thu Aug 17 19:40:59 UTC 2023" build_hash=4c579d34acd822b3ca24a0e0ba0133decacb28b0
error [2024-08-07 09:39:51.865 Z] Database Ping failed                     caller="server/server.go:220" error="dial tcp [::1]:5432: connect: connection refused"

I'm running focalboard in docker and dbconfig is passed as an env variable:
FOCALBOARD_DBCONFIG="postgres://${FOCALBOARD_USER}:${FOCALBOARD_PASSWORD}@postgres/${FOCALBOARD_DB}?sslmode=disable&connect_timeout=10"

Full docker-compose.yaml (Also, I've seen in another issue that you seek a postgres docker deployment and I'd be glad to share my project if that would be desirable):

version: "3.0"
services:
  nginx:
    restart: on-failure
    image: nginx:${NGINX_VERSION}
    volumes:
      - ./nginx/sites-available:/etc/nginx/sites-available
      - ./nginx/sites-enabled:/etc/nginx/sites-enabled
      - ./nginx/conf.d:/etc/nginx/conf.d
    ports:
      - ${NGINX_PORT}:80
    networks:
      - focalboard

  postgres:
    restart: on-failure
    image: postgres:${POSTGRES_VERSION}
    volumes:
      - postgresdata:/var/lib/postgresql/data
    environment:
      - POSTGRES_USER=${POSTGRES_USER}
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
    networks:
      - focalboard
    healthcheck:
      test: ["CMD-SHELL", "pg_isready", "-d", "${POSTGRES_USER}"]
      interval: 30s
      timeout: 60s
      retries: 5
      start_period: 80s

  init-db:
    image: postgres:${POSTGRES_VERSION}
    command: bash -c  "
      echo ${POSTGRES_PASSWORD} | psql -U ${POSTGRES_USER} -h postgres -W -c \"
        CREATE DATABASE ${FOCALBOARD_DB};\" -c \"
        CREATE USER ${FOCALBOARD_USER} WITH PASSWORD '${FOCALBOARD_PASSWORD}';\""
    environment:
      - POSTGRES_USER=${POSTGRES_USER}
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
    networks:
      - focalboard
    depends_on:
      postgres:
        condition: service_healthy

  focalboard-server:
    restart: on-failure
    build: focalboard-server
    command: /opt/focalboard/bin/focalboard-server
    environment:
      - FOCALBOARD_SERVERROOT=http://0.0.0.0:8000
      - FOCALBOARD_DBTYPE=postgres
      - FOCALBOARD_DBCONFIG="postgres://${FOCALBOARD_USER}:${FOCALBOARD_PASSWORD}@postgres/${FOCALBOARD_DB}?sslmode=disable&connect_timeout=10"
    networks:
      - focalboard
    depends_on:
      init-db:
        condition: service_completed_successfully

volumes:
  postgresdata:

networks:
  focalboard:

  • Sev 2: Affects major functionality with a difficult or non-obvious workaround
@CNC5 CNC5 added Bug Something isn't working Triage labels Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Triage
Projects
None yet
Development

No branches or pull requests

1 participant