Forums » Development »
What does sidekiq need access to?
Added by Bernd Konrad 16 days ago
Hi there,
I'm currently trying to get the unoffical but somehow official community maintained docker images more production ready.
The main issue currently for me is that Redmine seems to expect a job queue worker that is not the defualt one used druing development or testing, something like sidekiq. Fair enough.
The images provided by https://hub.docker.com/_/redmine/ dont support that, the maintainer has raised concerns about running another process in the same container, see https://github.com/docker-library/redmine/issues/316#issuecomment-2113587316
The basic idea is to add sidekiq to the bundle as described in https://www.redmine.org/projects/redmine/wiki/SidekiqConfiguration, have the entrypoint check for config / env vars for redis and "just" start antoher instance of the same image, but with `bundle exec sidekiq` instead of `rails server -b some.binds.to.ips`as the command.
I already have this implemented and it seems to be running fine so far, there are just some things I'd like to improve / understand a bit better before maybe submitting a PR:
Currently, the second instance of the image, the on running `bundle exec sidekiq`, is basically checking the same configs as the main instance, its also checking to see if the database / sql connection is correctly configured.
My question is: Does sidekiq even need access to the database? are the jobs run on it read and write from it, or is everything that a job needs and does contained within the ruby code and redis?
If sidekiq doesnt need access to the DB, that would allow me to clean up some things in the entrypoint further.
Thanks for any hints and help in advance
Replies (3)
RE: What does sidekiq need access to? - Added by Holger Just 16 days ago
The job workers (e.g sidekiq workers) definitely need access to the Redmine database. The job definitions contain only enough information to get the jobs started but almost all jobs also require additional database information to run. In fact, even starting the sidekiq workers will likely fail without access to the database.
With that being said, if you want to reduce the number of dependencies, you may want to investigate delayed_job and delayed_job_active_record instead if sidekiq. Here, the jobs are written to a database table instead of a Redis server. This works fine with Redmine too and completely removes the dependency in Redis.
RE: What does sidekiq need access to? - Added by Bernd Konrad 16 days ago
Reducing the number of dependencies is not really an issue here.
Thx for the information on the need for database connections though, thats all the info I need :)
RE: What does sidekiq need access to? - Added by Bernd Konrad 11 days ago
So, I managed to get everything working, i provided some axmaples here: https://github.com/DerDummePunkt/redmine_docker_compose_sidekiq
What cost me a bit of time though was the config for sidekiq.
By default, sidekiq just listens to a queue named "default". Redmine puts tasks in a queue named "mailers" (and maybe others).
There is alsoa set key named "queues" in redis that contains the entry "mailers", I would assume thats where redmine expects sidekiq to look.
By default, sidekiq neither looks a the "queues" set key, nor does it listen to "mailers".
I had to configure sidekiq to explicitly listen to the queue "mailers", else redmine would happily push tasks on the queue, but sidekiq would just sit there and do nothing.
This fact was in the wiki article on the sidekiq config until January 2024, but someone removed it:
https://www.redmine.org/projects/redmine/wiki/SidekiqConfiguration/diff?utf8=%E2%9C%93&commit=Unterschiede+anzeigen&version=5&version_from=4
How does the wiki here work in terms of permissions? I havent found any information on that.
Can any registered member make changes? Do they get reviewed? Can I add that paragraph back in?