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

database.yml is in the wrong location for docker containers #5179

Closed
JasperE84 opened this issue May 17, 2024 · 3 comments
Closed

database.yml is in the wrong location for docker containers #5179

JasperE84 opened this issue May 17, 2024 · 3 comments

Comments

@JasperE84
Copy link
Contributor

JasperE84 commented May 17, 2024

Used Zammad Version

6.3.1

Environment

  • Installation method: docker-compose

Actual behaviour

Scheduler container's log shows errors causing scheduled jobs to fail if using default docker-compose setup:
ConnectionTimeoutError: could not obtain a connection from the pool within 5.000 seconds (waited 5.000 seconds); all pooled connections were in use.

Runtime pool size of 5 isn't equal to value of 50 configured in default rails database.yml:

$ docker compose run --rm zammad-scheduler rails r "p ActiveRecord::Base.connection_pool.stat"
[+] Creating 3/0
 ✔ Container docker_zammad-zammad-memcached-1   Running                                                                                            0.0s
 ✔ Container docker_zammad-zammad-redis-1       Running                                                                                            0.0s
 ✔ Container docker_zammad-zammad-postgresql-1  Running                                                                                            0.0s
I, [2024-05-17T08:31:11.773981 #1]  INFO -- : ActionCable is using the redis instance at redis://zammad-redis:6379.
I, [2024-05-17T08:31:11.824991#1-6060]  INFO -- : Using memcached as Rails cache store.
I, [2024-05-17T08:31:11.825266#1-6060]  INFO -- : Using the Redis back end for Zammad's web socket session store.
{:size=>5, :connections=>0, :busy=>0, :dead=>0, :idle=>0, :waiting=>0, :checkout_timeout=>5.0}

When copying the default rails database.yml and mounting it in docker as such, problem is solved:

x-shared:
  zammad-service: &zammad-service
    environment: &zammad-environment
      [..snip..]
    volumes:
      - ./tempdb.yml:/opt/zammad/config/database.yml

I think the fix should be something like contrib/docker/docker-entrypoint.sh checking for existing ~/config/database.yml symlink to ~/config/database/database.yml and creating it if it doesnt exist. Or move database.yml from its subdirectory to /config/ directly.

More info here:
https://community.zammad.org/t/scheduler-fails-with-activerecord-could-not-obtain-a-connection-from-the-pool-within-5-000-seconds-waited-5-000-seconds-all-pooled-connections-were-in-use/14320/7

Expected behaviour

Scheduled jobs finish without problems

Steps to reproduce the behaviour

$ docker-compose up -d

Support Ticket

No response

I'm sure this is a bug and no feature request or a general question.

yes

@JasperE84
Copy link
Contributor Author

JasperE84 commented May 18, 2024

So basically this function seems to be missing in docker entry point:

function update_database_yml () {

@Keridos
Copy link

Keridos commented May 19, 2024

Can confirm that this happened on our 6.3.1 deployment, too. Adding a bind mount with a correct database.yml file to /opt/zammad/config/database.yml fixes the symptoms.

@mgruner
Copy link
Collaborator

mgruner commented May 21, 2024

Please update your .env instead to the latest state from upstream. There is a new variable POSTGRESQL_OPTIONS=?pool=50 which is required now.

https://github.com/zammad/zammad-docker-compose/blob/master/.env

@mgruner mgruner closed this as not planned Won't fix, can't repro, duplicate, stale May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants