WhatsApp / WhatsApp-Business-API-Setup-Scripts

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

Api v2.27.12 deployment in Kubernetes 1.11(s(/var/lib/whatsapp/database.yml): failed to open stream: Permission denied) #26

Closed fintico closed 3 years ago

fintico commented 4 years ago

Hi,

I found the following issue on a fresh kubernetes deployement:

After install an try to set up Registration Code, when we log in application send us "http error 500" and 'undefined' in login screen... After check logs we found these message

==> /var/log/whatsapp/web.log <== [2020-04-21 01:45:09.645161] app.INFO: [5f6286286a51415b91aa82798a39eed6] Matched route "{route}". {"route":"GET_v1_health","route_parameters":{"_controller":"WhatsApp\Controller\HealthController::getHealth","_route":"GET_v1_health"},"request_uri":"https://200.60.145.96:8443/v1/health","method":"GET"} [] [2020-04-21 01:45:09.647388] app.CRITICAL: [5f6286286a51415b91aa82798a39eed6] Exception: Fail to read /var/lib/whatsapp/database.yml (uncaught exception) at /var/www/html/index.php line 2 {"exception":"[object] (Exception(code: 0): Fail to read /var/lib/whatsapp/database.yml at /var/www/html/index.php:2)"} [] [2020-04-21 01:45:09.651387] app.INFO: [5f6286286a51415b91aa82798a39eed6] Response: {"meta":{"version":"v2.27.12","api_status":"stable"},"errors":[{"code":1014,"title":"Internal error"}]} []

==> /var/log/lighttpd/error.log <== 2020-04-21 01:45:09: (mod_fastcgi.c.2702) FastCGI-stderr: PHP message: PHP Warning: file_get_contents(/var/lib/whatsapp/database.yml): failed to open stream: Permission denied in /var/www/html/src/WhatsApp/Database/DBUtil.php on line 2

After we set "777" permission to the file by container cli (we don't know if those are the correct), web admin show us the change password page and application works!

mengyiyuan commented 4 years ago

Hi Edwin,

Thanks for reporting this issue and figuring out the solution too! Let me try to repro on my local setup and investigate. I will keep you posted.

mengyiyuan commented 4 years ago

Hi Edwin,

I think it happened is that the web container requires root user access to run (we are working on making web run as non-root user). Does the user that executed the deployment has root access? If not, could you try to use a runAsUser property with a root access user in SecurityContext and see if it works?

fintico commented 4 years ago

Does the user that executed the deployment has root access? Did you mean the user where "kubectl create/apply ..." command is executing?? I will try setting the security context in the yaml file and i will let you know if it helps. Thanks for the time!!!!

mengyiyuan commented 3 years ago

@fintico - did you get this to work in the end? I am closing this off for now as it has been a long time, feel free to reopen, thanks!