coolify icon indicating copy to clipboard operation
coolify copied to clipboard

[Bug]: role "affine" does not exist

Open endquote opened this issue 11 months ago • 6 comments

Error Message and Logs

Seeing this in the logs of the postgres container for affine:

FATAL: role "affine" does not exist

I'm not sure if it's new or it's always been doing that.

The app seems to be working ok.

My compose file is the same as this one.

Maybe the same as this problem?

@LeoMartinDev ?

Coolify Version

v4.0.0-beta.389

Are you using Coolify Cloud?

No (self-hosted)

Operating System and Version (self-hosted)

Ubuntu 24

endquote avatar Jan 25 '25 04:01 endquote

Same issue, I edited the compose file to use the canary release and it's still happening.

Pedromigacz avatar Jan 27 '25 04:01 Pedromigacz

Same, used also the compose file from the official repository, no luck deploying, but locally it worked like a charm

blascokoa avatar Mar 02 '25 23:03 blascokoa

Also happening for me. Notably the app seems to work, but I get those messages on the logs of the postgres container.

CamiloMM avatar Mar 18 '25 00:03 CamiloMM

Same here, but the app is not working but it responds with "no available server" 🤷‍♂️

EdwardBock avatar Mar 21 '25 07:03 EdwardBock

Same here, but the app is not working but it responds with "no available server" 🤷‍♂️

Since I'm also a total noob maybe you edited the domain name and removed the port; you need to keep the port. (e.g., https://your-domain.com:3000 - I think it was port 3000.) If that's not it, check logs.

CamiloMM avatar Mar 23 '25 00:03 CamiloMM

Same here, but the app is not working but it responds with "no available server" 🤷‍♂️

Since I'm also a total noob maybe you edited the domain name and removed the port; you need to keep the port. (e.g., https://your-domain.com:3000 - I think it was port 3000.) If that's not it, check logs.

Nobe, that did not help.

EdwardBock avatar Mar 25 '25 13:03 EdwardBock

Hey, I finally got this working on my Coolify instance. I decided not to use Coolify's compose for Affine and opted for the one from their website. Create a new resource in Coolify and choose "Empty Docker Compose". With this configuration I can just go to https://my-domain.com and access Affine.

Here's my docker-compose and example env vars:

compose.yml

name: affine
services:
  affine:
    image: 'ghcr.io/toeverything/affine-graphql:${AFFINE_REVISION:-stable}'
    container_name: affine_server
    ports:
      - '${PORT:-3010}:3010'
    depends_on:
      redis:
        condition: service_healthy
      postgres:
        condition: service_healthy
      affine_migration:
        condition: service_completed_successfully
    volumes:
      - '~/.affine/self-host/storage:/root/.affine/storage'
      - '~/.affine/self-host/config:/root/.affine/config'
    env_file:
      - .env
    environment:
      - REDIS_SERVER_HOST=redis
      - 'DATABASE_URL=postgresql://${DB_USERNAME}:${DB_PASSWORD}@postgres:5432/${DB_DATABASE:-affine}'
    restart: unless-stopped
  affine_migration:
    image: 'ghcr.io/toeverything/affine-graphql:${AFFINE_REVISION:-stable}'
    container_name: affine_migration_job
    volumes:
      - '${UPLOAD_LOCATION}:/root/.affine/storage'
      - '${CONFIG_LOCATION}:/root/.affine/config'
    command:
      - sh
      - '-c'
      - 'node ./scripts/self-host-predeploy.js'
    env_file:
      - .env
    environment:
      - REDIS_SERVER_HOST=redis
      - 'DATABASE_URL=postgresql://${DB_USERNAME}:${DB_PASSWORD}@postgres:5432/${DB_DATABASE:-affine}'
    depends_on:
      postgres:
        condition: service_healthy
      redis:
        condition: service_healthy
  redis:
    image: redis
    container_name: redis
    healthcheck:
      test:
        - CMD
        - redis-cli
        - '--raw'
        - incr
        - ping
      interval: 10s
      timeout: 5s
      retries: 5
    restart: unless-stopped
  postgres:
    image: 'postgres:16'
    container_name: postgres
    volumes:
      - '~/.affine/self-host/postgres/pgdata:/var/lib/postgresql/data'
    environment:
      POSTGRES_USER: '${DB_USERNAME}'
      POSTGRES_PASSWORD: '${DB_PASSWORD}'
      POSTGRES_DB: '${DB_DATABASE:-affine}'
      POSTGRES_INITDB_ARGS: '--data-checksums'
      POSTGRES_HOST_AUTH_METHOD: trust
    healthcheck:
      test:
        - CMD
        - pg_isready
        - '-U'
        - '${DB_USERNAME}'
        - '-d'
        - '${DB_DATABASE:-affine}'
      interval: 10s
      timeout: 5s
      retries: 5
    restart: unless-stopped

.env

AFFINE_SERVER_EXTERNAL_URL=https://my-domain.com
AFFINE_SERVER_HOST=https://my-domain.com
AFFINE_SERVER_HTTPS=true
DB_DATABASE=affine
DB_PASSWORD=my_db_password
DB_USERNAME=my_db_username

JoeWHoward avatar Apr 08 '25 04:04 JoeWHoward

I had the same issue. But fixed it by:

  • Enabling the checkbox Build Variable? on every environment variable

pneben avatar May 02 '25 21:05 pneben

Health check in original template point to role that does not exist:

pg_isready -U affine

Should be:

pg_isready -U ${SERVICE_USER_POSTGRES}

lokhmakov avatar Jul 25 '25 12:07 lokhmakov