peering-manager / docker

🐳 Docker Image of Peering Manager
Apache License 2.0
9 stars 12 forks source link

Unable to configure file logger with peering-manager docker image #32

Closed MaxBear closed 2 weeks ago

MaxBear commented 7 months ago

Peering Manager version

v1.7.3 (python3.9)

Python version

3.10

Steps to Reproduce

  1. try to configure a file based log handler
    LOGGING = {
    "version": 1,
    "handlers": {
        "file": {
            "level": LOG_LEVEL,
            "class": "logging.FileHandler",
            "filename": "peering-manager.log",
            "formatter": "simple",
        },
  2. start docker image, getting error
  3. PermissionError: [Errno 13] Permission denied: '/opt/peering-manager/peering-manager.log' same applies to use /var/log or /tmp/ directory

Expected Behavior

Able to created and save logs to file. We have ran into issues with peeringdb_sync consistently. The initial peeringdb sync in our setup, which is to save data in a postgres database hosted on a separate virtual server has been failing. It looks the background job is being timed out or the job got suck due to a database locked. On gui the cache update status either shows "running" or "pending". This happens after a user logged in to peering-manager as "admin" and cleared all peeringdb cache. After this, we were not able to recreate the cache by using button on /cache gui. In order to troubleshoot, we used console logger . In order to understand more on how the system works, I am trying to run the setup on my local mac . For some reason, either console logging (write to a socket file) or file logging (with error shown above) are not working. Wondering if someone can provide some suggestion on how to proceed.

Observed Behavior

Unable to do so.

gmazoyer commented 2 months ago

While console logging seems to be working (writing to stdout/stderr), it seems that file logging does cause issues. My best guess is the lack of permissions. Making unit the owner of the /opt/peering-manager directory within the container should be enough to fix this.