WhatsApp / WhatsApp-Business-API-Setup-Scripts

The scripts related to setting up WhatsApp business API
MIT License
410 stars 433 forks source link

database prefixes #14

Closed aogier closed 4 years ago

aogier commented 4 years ago

Hello, I'm working on a rather large setup in order to consolidate databases on a single server instance. It seems that, although undocumented, this is supported via env vars WA_DB_NAME_PREFIX and WA_DB_SHARD_PREFIX:

MySQL [mysql]> show databases;
+-------------------------------------+                    n
| Database                            |
+-------------------------------------+
| information_schema                  |
| example_whatsapp_clusterStore       |
| example_whatsapp_configStore        |
| example_whatsapp_waweb              |
| mysql                               |
| performance_schema                  |
| sys                                 |
+-------------------------------------+

what I'd like to know is that this undocumented feature is here to stay, and/or there are others caveats to bear in mind doing this analysis.

Thank you, regards!

mengyiyuan commented 4 years ago

Hi Alessandro,

WA_DB_NAME_PREFIX is documented here: https://developers.facebook.com/docs/whatsapp/guides/mysql

I'm not aware of WA_DB_SHARD_PREFIX though, what effect does it have when you set it? Also curious to know how you figured out these two variable names?

aogier commented 4 years ago

Hi Mengyi,

you're completely right and I totally missed this guide! Haven't used the head I've used the legs, and found WA_DB_NAME_PREFIX starting from other variables and reading waweb application code. The WA_DB_SHARD_PREFIX can be found with binutils' strings(1) against coreapp executables. Given that the former variable is indeed documented as the way to consolidate everything on a single db host I think I'll drop it. Thank you! I don't close this ticket as I'll be glad to share other thoughts if you want otherwise let's close it, regards!

mengyiyuan commented 4 years ago

Hi Alessandro,

WA_DB_NAME_PREFIX is the right variable to use. Will close the issue for now. Look forward to more insights from you. :D

palmerabollo commented 4 years ago

@mengyiyuan do you know whether WA_DB_NAME_PREFIX is also supported with Postgres?