OCA / queue

Asynchronous Job Queue
GNU Affero General Public License v3.0
179 stars 452 forks source link

[Conf Question]How to configure job queu to work with db_filter by domain #167

Closed flotho closed 3 years ago

flotho commented 5 years ago

Hi everyone,

Is it possible to configure an Odoo installation to have multiple db filtered by domain and in the same time to have queue_jobs executing on all the DB What could be the best practices on this?

Regards

guewen commented 5 years ago

Hi @flotho ,

The jobrunner does not use --db-filter but uses the db_name/--database option (as the cron), you can filter the web users using --db-filter while still having the jobrunner working on all databases. Do I miss anything?

flotho commented 5 years ago

Hi @guewen , great thanks for this explanation, this is what I understood.

So the meaning of this is that you have to "share" the runner among all the database and you can't dedicate job runner to specific databases. Am I right ?

guewen commented 5 years ago

You should be able to start a jobrunner with --database=db1 and a second with --database=db2.

flotho commented 5 years ago

Hi @guewen , thanks for the time spent to answer .

So the idea would be to have an installation for Odoo and then multiple services running exclusively queue_job with the parameter you proposed? In this case, I suppose that the server_wid_module options don't need to be set in the main Odoo service. Am I correct ?

Regards

guewen commented 5 years ago

Exactly. In any case even with one database that's a good idea (but not mandatory at all) to have one running service for HTTP users and a second one exclusively for running the jobrunner and jobs, so the workers are not shared between them (incidentally it allows to restart / change configuration of the job nodes without impacting users). So the HTTP node(s) do not start with queue_job in server_wide_modules and the jobrunner's one does.

flotho commented 3 years ago

Hi @guewen , in this case, what is your conf for the non queue part ? you bypass xmlrpc_interface netrpc_interface , setup workers = 0

Thanks for your feedback

guewen commented 3 years ago

What do you mean by "non queue" part? HTTP workers for users? Not sure to understand what you want to achieve with "bypass xmlrpc_interface netrpc_interface , setup workers = 0".

flotho commented 3 years ago

Sorry for this malformed question Could you share an example of a conf file for a queue job only service? Thanks

guewen commented 3 years ago

Sure, here's an example of queue service:

root@80c95f0e3367:/# cat /etc/odoo.cfg
[options]
addons_path = /odoo/external-src/odoo-cloud-platform, /odoo/external-src/queue, <long list stripped>, /odoo/src/addons, /odoo/local-src
data_dir = /data/odoo
auto_reload = False
db_host = haproxy.postgres-int
db_name = weathered_sun_2543_labs_results
db_user = weathered_sun_2543_labs_results
db_password = <redacted>
db_sslmode = prefer
dbfilter = ^weathered_sun_2543_labs_results$
list_db = False
admin_passwd = <redacted>
db_maxconn = 5
limit_memory_soft = 1717986918
limit_memory_hard = 2147483648
limit_request = 8192
limit_time_cpu = 86400
limit_time_real = 86400
limit_time_real_cron = 600
log_handler = :INFO,werkzeug:ERROR
log_level = info
max_cron_threads = 0
workers = 8
logfile = None
log_db = False
logrotate = True
syslog = False
running_env = labs-results
without_demo = all
server_wide_modules = web,session_redis,logging_json,attachment_s3,queue_job
proxy_mode = True
unaccent = False

With the env. variable set:

ODOO_QUEUE_JOB_CHANNELS=root:8,root.ddmrp_simulation:1,root.connector_importer:1,root.search_engine.recompute_json:2,root.search_engine.prepare_batch_export:1,root.search_engine:1,root.search_engine.synchronize_stock:1,root.shopinvader:1,root.shopinvader.import:2,root.shopinvader.import.images:2,root.shopinvader.notification:1,root.invoice_export:1,root.ubl_import:1,root.ddmrp:1,root.ir_cron:2,root.invoice_at_shipping:1,root.invoice_validation:1,root.stock_auto_assign:2,root.stock_release_channel:2

And the one for HTTP workers:

root@3f6de2586f8f:/# cat /etc/odoo.cfg
[options]
addons_path = /odoo/external-src/odoo-cloud-platform, /odoo/external-src/queue, <long list stripped>, /odoo/src/addons, /odoo/local-src
data_dir = /data/odoo
auto_reload = False
db_host = haproxy.postgres-int
db_name = weathered_sun_2543_labs_results
db_user = weathered_sun_2543_labs_results
db_password = <redacted>
db_sslmode = prefer
dbfilter = ^weathered_sun_2543_labs_results$
list_db = False
admin_passwd = <redacted>
db_maxconn = 5
limit_memory_soft = 1717986918
limit_memory_hard = 2147483648
limit_request = 8192
limit_time_cpu = 86400
limit_time_real = 86400
limit_time_real_cron = 600
log_handler = :INFO,werkzeug:ERROR
log_level = info
max_cron_threads = 1
workers = 9
logfile = None
log_db = False
logrotate = True
syslog = False
running_env = labs-results
without_demo = all
server_wide_modules = web,session_redis,logging_json,attachment_s3
proxy_mode = True
unaccent = False
flotho commented 2 years ago

Hi, sorry to come back on this one, no prots are specified in your conf. Is it normal ? Regards

guewen commented 2 years ago

@flotho if ports are not set in the configuration, it will use the defaults ones (meaning 8069, 8072).