Chatwoot: Docker-compose doesn't setup postgress correctly, unable to login/create new user

Created on 6 Feb 2020  路  3Comments  路  Source: chatwoot/chatwoot

Describe the bug
I am unable to login to chatwoot or create new users. Database doesn't seem to be configured correctly.

To Reproduce

  1. Use the following docker-compose and env file:
    Using this docker-compose:
version: "3"

services:
  rails:
    image: chatwoot/chatwoot:latest
    depends_on:
      - postgres
      - redis
    ports:
      - 3000:3000
    env_file: .env ## Change this file for customized env variables
    environment:
      - NODE_ENV=production
      - RAILS_ENV=production
    entrypoint: docker/entrypoints/rails.sh
    command: ["bundle", "exec", "rails", "s", "-p", "3000", "-b", "0.0.0.0"]

  postgres:
    image: postgres:11.6
    restart: always
    ports:
      - "5432:5432"
    # volumes:
    #   - postgres:/data/postgres
    environment:
      - POSTGRES_DB=chatwoot_production
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
  redis:
    image: redis:alpine
    restart: always
    # volumes:
    #   - redis:/data/redis
    ports:
      - "6379:6379"

volumes:
  postgres:
  redis:
  bundle:
  packs:
  node_modules_rails:

And this env file:

SECRET_KEY_BASE=testing

#redis config
REDIS_URL=redis://redis:6379
REDIS_PASSWORD=

# Postgres Database config variables
POSTGRES_HOST=postgres
POSTGRES_USERNAME=postgres
POSTGRES_PASSWORD=postgres
RAILS_ENV=development
RAILS_MAX_THREADS=5

[email protected]
SMTP_PORT=1025
SMTP_DOMAIN=chatwoot.com
SMTP_ADDRESS=mailhog

#misc
FRONTEND_URL=http://0.0.0.0:3000
ACTIVE_STORAGE_SERVICE=local

# Credentials to access sidekiq dashboard in production
[email protected]
SIDEKIQ_AUTH_PASSWORD=test
  1. Then run docker-compose up

  2. Visit http://localhost:3000 . This redirects you to login page. Enter the following credentials (from here).
    user name: [email protected]
    password: 123456

when clicking attempting login, you will see:
image

And in the terminal you will get:

postgres_1  | 2020-02-06 08:21:09.493 UTC [34] ERROR:  relation "users" does not exist at character 454
postgres_1  | 2020-02-06 08:21:09.493 UTC [34] STATEMENT:  SELECT a.attname, format_type(a.atttypid, a.atttypmod),
postgres_1  |          pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod,
postgres_1  |          c.collname, col_description(a.attrelid, a.attnum) AS comment
postgres_1  |     FROM pg_attribute a
postgres_1  |     LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum
postgres_1  |     LEFT JOIN pg_type t ON a.atttypid = t.oid
postgres_1  |     LEFT JOIN pg_collation c ON a.attcollation = c.oid AND a.attcollation <> t.typcollation
postgres_1  |    WHERE a.attrelid = '"users"'::regclass
postgres_1  |      AND a.attnum > 0 AND NOT a.attisdropped
postgres_1  |    ORDER BY a.attnum

Expected behavior

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Ubuntu 19.04
  • Browser: firefox dev edition
  • Version: 73.0b12 (64-bit)

Additional context
I was unable to create a user too. And I went through the documentation thoroughly, and searched through previous issues but didn't find any solutions.

Most helpful comment

I'll give that a try as soon as I get a chance end let you know, I didn't run that. Thanks for the help!

All 3 comments

@JasoonS after doing the docker compose up, did you run docker-compose run --rm rails bundle exec rails db:reset so that the database is set up correctly .

I'll give that a try as soon as I get a chance end let you know, I didn't run that. Thanks for the help!

It got it working, thanks. Just a few more other things for me to work through now.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pranavrajs picture pranavrajs  路  3Comments

MaheshCasiraghi picture MaheshCasiraghi  路  5Comments

niklaskorz picture niklaskorz  路  3Comments

mike9011 picture mike9011  路  3Comments

pranavrajs picture pranavrajs  路  3Comments