NSPanelManager icon indicating copy to clipboard operation
NSPanelManager copied to clipboard

"502 Bad Gateway" in Unraid App

Open Ksyuint opened this issue 10 months ago • 19 comments

After installing fresh from "Community Applications" in Unraid, get "502 Bad Gateway" in browser. Using default config. No forwarding to “Initial Setup”. Do I have to call it up manually?

Ksyuint avatar Feb 12 '25 13:02 Ksyuint

Hi and thank you for your interest in the project. I myself don't use unraid but perhaps @sebastienvermeille could help you? Do you have any logs?

tpanajott avatar Feb 12 '25 16:02 tpanajott

Nice if I can help. Something is wrong with nginx:

... No migrations to apply. Starting Nginx Restarting nginx: nginx[2025-02-12 16:28:37.888] [error] [WebHelper.cpp:68] [9] Failed to perform HTTP request to 'http://127.0.0.1:8000/api/get_mqtt_manager_config'. Got response data: '' [2025-02-12 16:28:37.888] [error] [WebHelper.cpp:69] [9] curl_easy_perform() failed, got code: 7. Text interpretation: Couldn't connect to server [2025-02-12 16:28:37.888] [error] [WebHelper.cpp:70] [9] Curl error buffer: Failed to connect to 127.0.0.1 port 8000 after 0 ms: Couldn't connect to server [2025-02-12 16:28:37.888] [error] [mqtt_manager_config.cpp:116] [9] Failed to get config. Will try again. . Starting NSPanelManager web interface server [2025-02-12 16:28:38.913] [debug] [mqtt_manager_config.cpp:111] [9] Got config data. Processing config. [2025-02-12 16:28:38.914] [info] [mqtt_manager_config.cpp:127] [9] Got config from web manager, will process and load values. [2025-02-12 16:28:38.914] [critical] [mqtt_manager_config.cpp:148] [9] Manager port not configured! Setting 0. ...

Port 8000 is used exclusively by NSPanelManager, there are no conflicts. It is a fresh installation without changing anything...

Ksyuint avatar Feb 12 '25 16:02 Ksyuint

Those errors are normal on first start. I can't really see anything wrong there. It should say something about starting Django or uwsgi?

tpanajott avatar Feb 12 '25 16:02 tpanajott

Hi @Ksyuint I will try to reproduce the issue

sebastienvermeille avatar Feb 13 '25 09:02 sebastienvermeille

@Ksyuint I installed it on a fresh instance of Unraid and it just works:

Image

Please check your setup and provide more details of how you configure the docker container eventually.

sebastienvermeille avatar Feb 13 '25 17:02 sebastienvermeille

I myself have during development received the "502 Bad Gateway" which usually refers to the Django-part of the application not starting but Nginx is running. We would need the full log output of the container/addon to look further into this.

tpanajott avatar Feb 15 '25 21:02 tpanajott

I too get 502 error. Fresh install with this docker compose:

  nspanelmanager:
    image: nspanelmanager/nspanelmanager-amd64
    container_name: nspanelmanager
    volumes:
      - /mnt/usb_1/Docker/NSPanelManager:/data/
    environment:
      - TZ=Europe/Ljubljana
    ports:
      - 8857:8000

When I visit the URL I get 502 error and in log:

invalid request block size: 6190 (max 4096)...skip

Setting /etc/timezone to Europe/Ljubljana
Will use timezone: Europe/Ljubljana
Running migrations...
Did not find a running MQTTManager, starting MQTTManager...
[2025-02-28 09:36:30.163] [info] [main.cpp:83] Starting MQTTManager.
[2025-02-28 09:36:30.163] [info] [main.cpp:91] /dev/shm has 67108864 bytes free.
[2025-02-28 09:36:30.163] [info] [main.cpp:96] Will log to /dev/shm/mqttmanager.log with a max size of 6710886 bytes.
[2025-02-28 09:36:30.166] [debug] [mqtt_manager.hpp:40] [9] Adding 'nspanel/mqttmanager/command' to the list of topics to subscribe to.
[2025-02-28 09:36:30.166] [debug] [mqtt_manager.hpp:40] [9] Adding 'nspanel/+/status' to the list of topics to subscribe to.
[2025-02-28 09:36:30.166] [debug] [mqtt_manager.hpp:40] [9] Adding 'nspanel/+/status_report' to the list of topics to subscribe to.
[2025-02-28 09:36:30.166] [info] [mqtt_manager_config.cpp:43] [9] Read timezone Europe/Ljubljana from /etc/timezone.
[2025-02-28 09:36:30.166] [info] [mqtt_manager_config.cpp:106] [9] Gathering config from web manager.
[2025-02-28 09:36:30.169] [error] [WebHelper.cpp:68] [9] Failed to perform HTTP request to 'http://127.0.0.1:8000/api/get_mqtt_manager_config'. Got response data: ''
[2025-02-28 09:36:30.169] [error] [WebHelper.cpp:69] [9] curl_easy_perform() failed, got code: 7. Text interpretation: Couldn't connect to server
[2025-02-28 09:36:30.169] [error] [WebHelper.cpp:70] [9] Curl error buffer: Failed to connect to 127.0.0.1 port 8000 after 0 ms: Couldn't connect to server
[2025-02-28 09:36:30.170] [error] [mqtt_manager_config.cpp:116] [9] Failed to get config. Will try again.
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, sessions, web
Running migrations:
  No migrations to apply.
Starting Nginx
Restarting nginx: nginx[2025-02-28 09:36:31.170] [error] [WebHelper.cpp:68] [9] Failed to perform HTTP request to 'http://127.0.0.1:8000/api/get_mqtt_manager_config'. Got response data: ''
[2025-02-28 09:36:31.170] [error] [WebHelper.cpp:69] [9] curl_easy_perform() failed, got code: 7. Text interpretation: Couldn't connect to server
[2025-02-28 09:36:31.170] [error] [WebHelper.cpp:70] [9] Curl error buffer: Failed to connect to 127.0.0.1 port 8000 after 0 ms: Couldn't connect to server
[2025-02-28 09:36:31.170] [error] [mqtt_manager_config.cpp:116] [9] Failed to get config. Will try again.
.
Starting NSPanelManager web interface server
*** Starting uWSGI 2.0.22 (64bit) on [Fri Feb 28 10:36:31 2025] ***
compiled with version: 12.2.0 on 07 December 2024 23:27:22
os: Linux-6.8.12-2-pve #1 SMP PREEMPT_DYNAMIC PMX 6.8.12-2 (2024-09-05T10:03Z)
nodename: 4a1931412d7b
machine: x86_64
clock source: unix
detected number of CPU cores: 16
current working directory: /usr/src/app
writing pidfile to /tmp/project-master.pid
detected binary path: /usr/local/bin/uwsgi
!!! no internal routing support, rebuild with pcre support !!!
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
chdir() to /usr/src/app/nspanelmanager/
your processes number limit is 125781
your memory page size is 4096 bytes
 *** WARNING: you have enabled harakiri without post buffering. Slow upload could be rejected on post-unbuffered webservers ***
detected max file descriptor number: 524288
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to TCP address 127.0.0.1:8001 fd 3
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
Python version: 3.11.11 (main, Dec  4 2024, 20:38:25) [GCC 12.2.0]
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x7e6b12e56658
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 437520 bytes (427 KB) for 5 cores
*** Operational MODE: preforking ***
WSGI app 0 (mountpoint='') ready in 1 seconds on interpreter 0x7e6b12e56658 pid: 32 (default app)
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 32)
spawned uWSGI worker 1 (pid: 42, cores: 1)
spawned uWSGI worker 2 (pid: 43, cores: 1)
spawned uWSGI worker 3 (pid: 44, cores: 1)
spawned uWSGI worker 4 (pid: 45, cores: 1)
spawned uWSGI worker 5 (pid: 46, cores: 1)
[2025-02-28 09:36:32.503] [debug] [mqtt_manager_config.cpp:111] [9] Got config data. Processing config.
[pid: 42|app: 0|req: 1/1] 127.0.0.1 () {30 vars in 385 bytes} [Fri Feb 28 09:36:32 2025] GET /api/get_mqtt_manager_config => generated 2919 bytes in 95 msecs (HTTP/1.1 200) 6 headers in 200 bytes (1 switches on core 0)
[2025-02-28 09:36:32.506] [info] [mqtt_manager_config.cpp:127] [9] Got config from web manager, will process and load values.
[2025-02-28 09:36:32.506] [critical] [mqtt_manager_config.cpp:148] [9] Manager port not configured! Setting 0.
[2025-02-28 09:36:32.506] [debug] [mqtt_manager_config.cpp:162] [9] Loading lights...
[2025-02-28 09:36:32.506] [debug] [mqtt_manager_config.cpp:168] [9] Loading NSPanels...
[2025-02-28 09:36:32.507] [debug] [mqtt_manager_config.cpp:174] [9] Loading Scenes...
[2025-02-28 09:36:32.507] [debug] [mqtt_manager_config.cpp:186] [9] Checking for removed scenes.
[2025-02-28 09:36:32.507] [debug] [mqtt_manager_config.cpp:202] [9] Loading Rooms...
[2025-02-28 09:36:32.507] [debug] [mqtt_manager_config.cpp:214] [9] Checking for removed rooms.
[2025-02-28 09:36:32.507] [debug] [mqtt_manager_config.cpp:230] [9] Loading relay groups...
[2025-02-28 09:36:32.507] [debug] [mqtt_manager_config.cpp:242] [9] Checking for removed relay groups.
[2025-02-28 09:36:32.507] [debug] [mqtt_manager_config.cpp:122] [9] Config loaded. Calling listeners.
[2025-02-28 09:36:32.507] [info] [entity_manager.cpp:142] [9] New config loaded, processing changes.
[2025-02-28 09:36:32.507] [info] [weather.cpp:26] [9] No running instance of weather manager found. Will start new thread.
[2025-02-28 09:36:32.508] [debug] [entity_manager.cpp:147] [9] Updating NSPanels.
[2025-02-28 09:36:32.508] [debug] [entity_manager.cpp:156] [9] Checking for removed NSPanels.
[2025-02-28 09:36:32.508] [debug] [entity_manager.cpp:175] [9] Updating lights.
[2025-02-28 09:36:32.508] [debug] [entity_manager.cpp:186] [9] Existing lights updated.
[2025-02-28 09:36:32.508] [debug] [entity_manager.cpp:189] [9] Checking for removed lights.
[2025-02-28 09:36:32.508] [debug] [entity_manager.cpp:218] [9] Updating rooms.
[2025-02-28 09:36:32.508] [debug] [entity_manager.cpp:222] [9] Trying to get room by id.
[2025-02-28 09:36:32.508] [debug] [entity_manager.cpp:224] [9] Got result. Trying to get mutex.
[2025-02-28 09:36:32.508] [debug] [entity_manager.cpp:226] [9] Got mutex.
[2025-02-28 09:36:32.508] [debug] [room.cpp:16] [9] Room 1::Dummy room initialized.
[2025-02-28 09:36:32.508] [debug] [entity_manager.cpp:235] [9] Existing rooms updated.
[2025-02-28 09:36:32.508] [debug] [entity_manager.cpp:238] [9] Checking for removed rooms.
[2025-02-28 09:36:32.508] [debug] [entity_manager.cpp:268] [9] Updating NSPanel relay groups.
[2025-02-28 09:36:32.508] [debug] [entity_manager.cpp:274] [9] Existing relay groups updated.
[2025-02-28 09:36:32.508] [debug] [entity_manager.cpp:278] [9] Checking for removed relay groups.
[2025-02-28 09:36:32.508] [debug] [entity_manager.cpp:307] [9] Updating scenes.
[2025-02-28 09:36:32.508] [debug] [entity_manager.cpp:313] [9] Existing scenes updated.
[2025-02-28 09:36:32.508] [debug] [entity_manager.cpp:317] [9] Checking for removed scenes.
[2025-02-28 09:36:32.508] [info] [entity_manager.cpp:344] [9] Performing post init on 1 entities.
[2025-02-28 09:36:32.508] [debug] [entity_manager.cpp:346] [9] Performing PostInit on entity type 3 with id 1
[2025-02-28 09:36:32.508] [info] [entity_manager.cpp:350] [9] Total loaded NSPanels: 0
[2025-02-28 09:36:32.509] [info] [entity_manager.cpp:351] [9] Total loaded Entities: 1
[2025-02-28 09:36:32.509] [info] [main.cpp:153] [9] Starting Websocket Server on port 8002.
[2025-02-28 09:36:32.509] [critical] [main.cpp:157] [9] No MQTT server or port configured! Will exit with code 1.
[2025-02-28 09:36:32.509] [debug] [websocket_server.cpp:13] [49] Creating new ix::WebSocketServer.
terminate called without an active exception
Setting /etc/timezone to Europe/Ljubljana
Will use timezone: Europe/Ljubljana
Running migrations...
No secret key exists, creating!
Did not find a running MQTTManager, starting MQTTManager...
ERROR:root:Failed to populate Home Assistant addon settings.
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 89, in _execute
    return self.cursor.execute(sql, params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/db/backends/sqlite3/base.py", line 328, in execute
    return super().execute(query, params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
sqlite3.OperationalError: no such table: web_settings

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/app/nspanelmanager/web/apps.py", line 68, in ready
    start_mqtt_manager()
  File "/usr/src/app/nspanelmanager/web/apps.py", line 20, in start_mqtt_manager
    mqttmanager_env["MQTT_SERVER"] = get_setting_with_default(
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/app/nspanelmanager/web/settings_helper.py", line 6, in get_setting_with_default
    if objects.count() > 0:
       ^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 608, in count
    return self.query.get_count(using=self.db)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/db/models/sql/query.py", line 568, in get_count
    return obj.get_aggregation(using, {"__count": Count("*")})["__count"]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/db/models/sql/query.py", line 554, in get_aggregation
    result = compiler.execute_sql(SINGLE)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/db/models/sql/compiler.py", line 1562, in execute_sql
    cursor.execute(sql, params)
  File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 102, in execute
    return super().execute(sql, params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 67, in execute
    return self._execute_with_wrappers(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers
    return executor(sql, params, many, context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 84, in _execute
    with self.db.wrap_database_errors:
  File "/usr/local/lib/python3.11/site-packages/django/db/utils.py", line 91, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 89, in _execute
    return self.cursor.execute(sql, params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/db/backends/sqlite3/base.py", line 328, in execute
    return super().execute(query, params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
django.db.utils.OperationalError: no such table: web_settings
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, sessions, web
Running migrations:
  Applying contenttypes.0001_initial... OK
  Applying auth.0001_initial... OK
  Applying admin.0001_initial... OK
  Applying admin.0002_logentry_remove_auto_add... OK
  Applying admin.0003_logentry_add_action_flag_choices... OK
  Applying contenttypes.0002_remove_content_type_name... OK
  Applying auth.0002_alter_permission_name_max_length... OK
  Applying auth.0003_alter_user_email_max_length... OK
  Applying auth.0004_alter_user_username_opts... OK
  Applying auth.0005_alter_user_last_login_null... OK
  Applying auth.0006_require_contenttypes_0002... OK
  Applying auth.0007_alter_validators_add_error_messages... OK
  Applying auth.0008_alter_user_username_max_length... OK
  Applying auth.0009_alter_user_last_name_max_length... OK
  Applying auth.0010_alter_group_name_max_length... OK
  Applying auth.0011_update_proxy_permissions... OK
  Applying auth.0012_alter_user_first_name_max_length... OK
  Applying sessions.0001_initial... OK
  Applying web.0001_initial... OK
  Applying web.0002_nspanel_ip_address... OK
  Applying web.0003_nspanel_version... OK
  Applying web.0004_firmware... OK
  Applying web.0005_alter_firmware_binary_data... OK
  Applying web.0006_delete_firmware... OK
  Applying web.0007_room_displayorder... OK
  Applying web.0008_light_color_temperature_topic_light_rgb_topic_and_more... OK
  Applying web.0009_light_friendly_name... OK
  Applying web.0010_light_color_temperature_light_rgb_state_topic_and_more... OK
  Applying web.0011_light_is_ceiling_light... OK
  Applying web.0012_settings... OK
  Applying web.0013_light_type... OK
  Applying web.0014_remove_light_cmd_topic_and_more... OK
  Applying web.0015_light_openhab_item_color_temp_and_more... OK
  Applying web.0016_light_openhab_control_mode_light_openhab_item_switch... OK
  Applying web.0017_nspanel_status_data... OK
  Applying web.0018_alter_nspanel_status_data... OK
  Applying web.0019_nspanel_online_state... OK
  Applying web.0020_roomviewpagelight_light_room_view_page... OK
  Applying web.0021_remove_light_room_view_page_light_room_view_position_and_more... OK
  Applying web.0022_remove_nspanel_status_data_nspanel_heap_used_pct_and_more... OK
  Applying web.0023_light_home_assistant_name... OK
  Applying web.0024_light_openhab_item_rgb... OK
  Applying web.0025_auto_20230412_2122... OK
  Applying web.0026_light_openhab_name... OK
  Applying web.0027_nspanel_button1_detached_mode_light_and_more... OK
  Applying web.0028_scene... OK
  Applying web.0029_rename_name_scene_friendly_name... OK
  Applying web.0030_remove_scene_lights_lightstate... OK
  Applying web.0031_lightstate_color_temperature... OK
  Applying web.0032_nspanel_temperature... OK
  Applying web.0033_nspanelsettings... OK
  Applying web.0034_nspanel_md5_data_file_nspanel_md5_firmware_and_more... OK
  Applying web.0035_remove_nspanel_last_seen... OK
  Applying web.0036_relaygroupbinding_relaygroup... OK
  Applying web.0037_remove_relaygroup_relay_group_bindings_and_more... OK
  Applying web.0038_nspanel_register_relay1_as_light_and_more... OK
  Applying web.0039_scene_scene_type... OK
  Applying web.0040_scene_backend_name... OK
  Applying web.0041_nspanel_denied... OK
  Applying web.0042_nspanel_accepted... OK
Starting Nginx
Restarting nginx: nginx.
Starting NSPanelManager web interface server
*** Starting uWSGI 2.0.22 (64bit) on [Fri Feb 28 10:38:29 2025] ***
compiled with version: 12.2.0 on 07 December 2024 23:27:22
os: Linux-6.8.12-2-pve #1 SMP PREEMPT_DYNAMIC PMX 6.8.12-2 (2024-09-05T10:03Z)
nodename: 4a1931412d7b
machine: x86_64
clock source: unix
detected number of CPU cores: 16
current working directory: /usr/src/app
writing pidfile to /tmp/project-master.pid
detected binary path: /usr/local/bin/uwsgi
!!! no internal routing support, rebuild with pcre support !!!
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
chdir() to /usr/src/app/nspanelmanager/
your processes number limit is 125781
your memory page size is 4096 bytes
 *** WARNING: you have enabled harakiri without post buffering. Slow upload could be rejected on post-unbuffered webservers ***
detected max file descriptor number: 524288
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to TCP address 127.0.0.1:8001 fd 3
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
Python version: 3.11.11 (main, Dec  4 2024, 20:38:25) [GCC 12.2.0]
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x799d79e17658
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 437520 bytes (427 KB) for 5 cores
*** Operational MODE: preforking ***
Did not find a running MQTTManager, starting MQTTManager...
WSGI app 0 (mountpoint='') ready in 1 seconds on interpreter 0x799d79e17658 pid: 31 (default app)
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 31)
spawned uWSGI worker 1 (pid: 42, cores: 1)
[2025-02-28 09:38:30.656] [info] [main.cpp:83] Starting MQTTManager.
[2025-02-28 09:38:30.656] [info] [main.cpp:91] /dev/shm has 67108864 bytes free.
[2025-02-28 09:38:30.656] [info] [main.cpp:96] Will log to /dev/shm/mqttmanager.log with a max size of 6710886 bytes.
spawned uWSGI worker 2 (pid: 43, cores: 1)
[2025-02-28 09:38:30.659] [debug] [mqtt_manager.hpp:40] [41] Adding 'nspanel/mqttmanager/command' to the list of topics to subscribe to.
[2025-02-28 09:38:30.659] [debug] [mqtt_manager.hpp:40] [41] Adding 'nspanel/+/status' to the list of topics to subscribe to.
[2025-02-28 09:38:30.659] [debug] [mqtt_manager.hpp:40] [41] Adding 'nspanel/+/status_report' to the list of topics to subscribe to.
[2025-02-28 09:38:30.659] [info] [mqtt_manager_config.cpp:43] [41] Read timezone Europe/Ljubljana from /etc/timezone.
[2025-02-28 09:38:30.659] [info] [mqtt_manager_config.cpp:106] [41] Gathering config from web manager.
spawned uWSGI worker 3 (pid: 44, cores: 1)
spawned uWSGI worker 4 (pid: 45, cores: 1)
spawned uWSGI worker 5 (pid: 46, cores: 1)
[2025-02-28 09:38:30.739] [debug] [mqtt_manager_config.cpp:111] [41] Got config data. Processing config.
[pid: 44|app: 0|req: 1/1] 127.0.0.1 () {30 vars in 385 bytes} [Fri Feb 28 09:38:30 2025] GET /api/get_mqtt_manager_config => generated 2919 bytes in 76 msecs (HTTP/1.1 200) 6 headers in 200 bytes (1 switches on core 0)
[2025-02-28 09:38:30.741] [info] [mqtt_manager_config.cpp:127] [41] Got config from web manager, will process and load values.
[2025-02-28 09:38:30.742] [critical] [mqtt_manager_config.cpp:148] [41] Manager port not configured! Setting 0.
[2025-02-28 09:38:30.742] [debug] [mqtt_manager_config.cpp:162] [41] Loading lights...
[2025-02-28 09:38:30.742] [debug] [mqtt_manager_config.cpp:168] [41] Loading NSPanels...
[2025-02-28 09:38:30.742] [debug] [mqtt_manager_config.cpp:174] [41] Loading Scenes...
[2025-02-28 09:38:30.742] [debug] [mqtt_manager_config.cpp:186] [41] Checking for removed scenes.
[2025-02-28 09:38:30.742] [debug] [mqtt_manager_config.cpp:202] [41] Loading Rooms...
[2025-02-28 09:38:30.742] [debug] [mqtt_manager_config.cpp:214] [41] Checking for removed rooms.
[2025-02-28 09:38:30.743] [debug] [mqtt_manager_config.cpp:230] [41] Loading relay groups...
[2025-02-28 09:38:30.743] [debug] [mqtt_manager_config.cpp:242] [41] Checking for removed relay groups.
[2025-02-28 09:38:30.743] [debug] [mqtt_manager_config.cpp:122] [41] Config loaded. Calling listeners.
[2025-02-28 09:38:30.743] [info] [entity_manager.cpp:142] [41] New config loaded, processing changes.
[2025-02-28 09:38:30.743] [info] [weather.cpp:26] [41] No running instance of weather manager found. Will start new thread.
[2025-02-28 09:38:30.743] [debug] [entity_manager.cpp:147] [41] Updating NSPanels.
[2025-02-28 09:38:30.743] [debug] [entity_manager.cpp:156] [41] Checking for removed NSPanels.
[2025-02-28 09:38:30.743] [debug] [entity_manager.cpp:175] [41] Updating lights.
[2025-02-28 09:38:30.743] [debug] [entity_manager.cpp:186] [41] Existing lights updated.
[2025-02-28 09:38:30.743] [debug] [entity_manager.cpp:189] [41] Checking for removed lights.
[2025-02-28 09:38:30.743] [debug] [entity_manager.cpp:218] [41] Updating rooms.
[2025-02-28 09:38:30.744] [debug] [entity_manager.cpp:222] [41] Trying to get room by id.
[2025-02-28 09:38:30.744] [debug] [entity_manager.cpp:224] [41] Got result. Trying to get mutex.
[2025-02-28 09:38:30.744] [debug] [entity_manager.cpp:226] [41] Got mutex.
[2025-02-28 09:38:30.744] [debug] [room.cpp:16] [41] Room 1::Dummy room initialized.
[2025-02-28 09:38:30.744] [debug] [entity_manager.cpp:235] [41] Existing rooms updated.
[2025-02-28 09:38:30.744] [debug] [entity_manager.cpp:238] [41] Checking for removed rooms.
[2025-02-28 09:38:30.744] [debug] [entity_manager.cpp:268] [41] Updating NSPanel relay groups.
[2025-02-28 09:38:30.744] [debug] [entity_manager.cpp:274] [41] Existing relay groups updated.
[2025-02-28 09:38:30.744] [debug] [entity_manager.cpp:278] [41] Checking for removed relay groups.
[2025-02-28 09:38:30.744] [debug] [entity_manager.cpp:307] [41] Updating scenes.
[2025-02-28 09:38:30.744] [debug] [entity_manager.cpp:313] [41] Existing scenes updated.
[2025-02-28 09:38:30.744] [debug] [entity_manager.cpp:317] [41] Checking for removed scenes.
[2025-02-28 09:38:30.744] [info] [entity_manager.cpp:344] [41] Performing post init on 1 entities.
[2025-02-28 09:38:30.744] [debug] [entity_manager.cpp:346] [41] Performing PostInit on entity type 3 with id 1
[2025-02-28 09:38:30.744] [info] [entity_manager.cpp:350] [41] Total loaded NSPanels: 0
[2025-02-28 09:38:30.744] [info] [entity_manager.cpp:351] [41] Total loaded Entities: 1
[2025-02-28 09:38:30.745] [info] [main.cpp:153] [41] Starting Websocket Server on port 8002.
[2025-02-28 09:38:30.745] [critical] [main.cpp:157] [41] No MQTT server or port configured! Will exit with code 1.
[2025-02-28 09:38:30.745] [debug] [websocket_server.cpp:13] [49] Creating new ix::WebSocketServer.
terminate called without an active exception
subprocess 41 exited by signal 6
invalid request block size: 6228 (max 4096)...skip
invalid request block size: 6186 (max 4096)...skip
invalid request block size: 6236 (max 4096)...skip
invalid request block size: 6190 (max 4096)...skip

thehijacker avatar Feb 28 '25 09:02 thehijacker

I too get 502 error. Fresh install with this docker compose:

  nspanelmanager:
    image: nspanelmanager/nspanelmanager-amd64
    container_name: nspanelmanager
    volumes:
      - /mnt/usb_1/Docker/NSPanelManager:/data/
    environment:
      - TZ=Europe/Ljubljana
    ports:
      - 8857:8000

When I visit the URL I get 502 error and in log:

invalid request block size: 6190 (max 4096)...skip

Setting /etc/timezone to Europe/Ljubljana
Will use timezone: Europe/Ljubljana
Running migrations...
Did not find a running MQTTManager, starting MQTTManager...
[2025-02-28 09:36:30.163] [info] [main.cpp:83] Starting MQTTManager.
[2025-02-28 09:36:30.163] [info] [main.cpp:91] /dev/shm has 67108864 bytes free.
[2025-02-28 09:36:30.163] [info] [main.cpp:96] Will log to /dev/shm/mqttmanager.log with a max size of 6710886 bytes.
[2025-02-28 09:36:30.166] [debug] [mqtt_manager.hpp:40] [9] Adding 'nspanel/mqttmanager/command' to the list of topics to subscribe to.
[2025-02-28 09:36:30.166] [debug] [mqtt_manager.hpp:40] [9] Adding 'nspanel/+/status' to the list of topics to subscribe to.
[2025-02-28 09:36:30.166] [debug] [mqtt_manager.hpp:40] [9] Adding 'nspanel/+/status_report' to the list of topics to subscribe to.
[2025-02-28 09:36:30.166] [info] [mqtt_manager_config.cpp:43] [9] Read timezone Europe/Ljubljana from /etc/timezone.
[2025-02-28 09:36:30.166] [info] [mqtt_manager_config.cpp:106] [9] Gathering config from web manager.
[2025-02-28 09:36:30.169] [error] [WebHelper.cpp:68] [9] Failed to perform HTTP request to 'http://127.0.0.1:8000/api/get_mqtt_manager_config'. Got response data: ''
[2025-02-28 09:36:30.169] [error] [WebHelper.cpp:69] [9] curl_easy_perform() failed, got code: 7. Text interpretation: Couldn't connect to server
[2025-02-28 09:36:30.169] [error] [WebHelper.cpp:70] [9] Curl error buffer: Failed to connect to 127.0.0.1 port 8000 after 0 ms: Couldn't connect to server
[2025-02-28 09:36:30.170] [error] [mqtt_manager_config.cpp:116] [9] Failed to get config. Will try again.
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, sessions, web
Running migrations:
  No migrations to apply.
Starting Nginx
Restarting nginx: nginx[2025-02-28 09:36:31.170] [error] [WebHelper.cpp:68] [9] Failed to perform HTTP request to 'http://127.0.0.1:8000/api/get_mqtt_manager_config'. Got response data: ''
[2025-02-28 09:36:31.170] [error] [WebHelper.cpp:69] [9] curl_easy_perform() failed, got code: 7. Text interpretation: Couldn't connect to server
[2025-02-28 09:36:31.170] [error] [WebHelper.cpp:70] [9] Curl error buffer: Failed to connect to 127.0.0.1 port 8000 after 0 ms: Couldn't connect to server
[2025-02-28 09:36:31.170] [error] [mqtt_manager_config.cpp:116] [9] Failed to get config. Will try again.
.
Starting NSPanelManager web interface server
*** Starting uWSGI 2.0.22 (64bit) on [Fri Feb 28 10:36:31 2025] ***
compiled with version: 12.2.0 on 07 December 2024 23:27:22
os: Linux-6.8.12-2-pve #1 SMP PREEMPT_DYNAMIC PMX 6.8.12-2 (2024-09-05T10:03Z)
nodename: 4a1931412d7b
machine: x86_64
clock source: unix
detected number of CPU cores: 16
current working directory: /usr/src/app
writing pidfile to /tmp/project-master.pid
detected binary path: /usr/local/bin/uwsgi
!!! no internal routing support, rebuild with pcre support !!!
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
chdir() to /usr/src/app/nspanelmanager/
your processes number limit is 125781
your memory page size is 4096 bytes
 *** WARNING: you have enabled harakiri without post buffering. Slow upload could be rejected on post-unbuffered webservers ***
detected max file descriptor number: 524288
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to TCP address 127.0.0.1:8001 fd 3
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
Python version: 3.11.11 (main, Dec  4 2024, 20:38:25) [GCC 12.2.0]
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x7e6b12e56658
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 437520 bytes (427 KB) for 5 cores
*** Operational MODE: preforking ***
WSGI app 0 (mountpoint='') ready in 1 seconds on interpreter 0x7e6b12e56658 pid: 32 (default app)
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 32)
spawned uWSGI worker 1 (pid: 42, cores: 1)
spawned uWSGI worker 2 (pid: 43, cores: 1)
spawned uWSGI worker 3 (pid: 44, cores: 1)
spawned uWSGI worker 4 (pid: 45, cores: 1)
spawned uWSGI worker 5 (pid: 46, cores: 1)
[2025-02-28 09:36:32.503] [debug] [mqtt_manager_config.cpp:111] [9] Got config data. Processing config.
[pid: 42|app: 0|req: 1/1] 127.0.0.1 () {30 vars in 385 bytes} [Fri Feb 28 09:36:32 2025] GET /api/get_mqtt_manager_config => generated 2919 bytes in 95 msecs (HTTP/1.1 200) 6 headers in 200 bytes (1 switches on core 0)
[2025-02-28 09:36:32.506] [info] [mqtt_manager_config.cpp:127] [9] Got config from web manager, will process and load values.
[2025-02-28 09:36:32.506] [critical] [mqtt_manager_config.cpp:148] [9] Manager port not configured! Setting 0.
[2025-02-28 09:36:32.506] [debug] [mqtt_manager_config.cpp:162] [9] Loading lights...
[2025-02-28 09:36:32.506] [debug] [mqtt_manager_config.cpp:168] [9] Loading NSPanels...
[2025-02-28 09:36:32.507] [debug] [mqtt_manager_config.cpp:174] [9] Loading Scenes...
[2025-02-28 09:36:32.507] [debug] [mqtt_manager_config.cpp:186] [9] Checking for removed scenes.
[2025-02-28 09:36:32.507] [debug] [mqtt_manager_config.cpp:202] [9] Loading Rooms...
[2025-02-28 09:36:32.507] [debug] [mqtt_manager_config.cpp:214] [9] Checking for removed rooms.
[2025-02-28 09:36:32.507] [debug] [mqtt_manager_config.cpp:230] [9] Loading relay groups...
[2025-02-28 09:36:32.507] [debug] [mqtt_manager_config.cpp:242] [9] Checking for removed relay groups.
[2025-02-28 09:36:32.507] [debug] [mqtt_manager_config.cpp:122] [9] Config loaded. Calling listeners.
[2025-02-28 09:36:32.507] [info] [entity_manager.cpp:142] [9] New config loaded, processing changes.
[2025-02-28 09:36:32.507] [info] [weather.cpp:26] [9] No running instance of weather manager found. Will start new thread.
[2025-02-28 09:36:32.508] [debug] [entity_manager.cpp:147] [9] Updating NSPanels.
[2025-02-28 09:36:32.508] [debug] [entity_manager.cpp:156] [9] Checking for removed NSPanels.
[2025-02-28 09:36:32.508] [debug] [entity_manager.cpp:175] [9] Updating lights.
[2025-02-28 09:36:32.508] [debug] [entity_manager.cpp:186] [9] Existing lights updated.
[2025-02-28 09:36:32.508] [debug] [entity_manager.cpp:189] [9] Checking for removed lights.
[2025-02-28 09:36:32.508] [debug] [entity_manager.cpp:218] [9] Updating rooms.
[2025-02-28 09:36:32.508] [debug] [entity_manager.cpp:222] [9] Trying to get room by id.
[2025-02-28 09:36:32.508] [debug] [entity_manager.cpp:224] [9] Got result. Trying to get mutex.
[2025-02-28 09:36:32.508] [debug] [entity_manager.cpp:226] [9] Got mutex.
[2025-02-28 09:36:32.508] [debug] [room.cpp:16] [9] Room 1::Dummy room initialized.
[2025-02-28 09:36:32.508] [debug] [entity_manager.cpp:235] [9] Existing rooms updated.
[2025-02-28 09:36:32.508] [debug] [entity_manager.cpp:238] [9] Checking for removed rooms.
[2025-02-28 09:36:32.508] [debug] [entity_manager.cpp:268] [9] Updating NSPanel relay groups.
[2025-02-28 09:36:32.508] [debug] [entity_manager.cpp:274] [9] Existing relay groups updated.
[2025-02-28 09:36:32.508] [debug] [entity_manager.cpp:278] [9] Checking for removed relay groups.
[2025-02-28 09:36:32.508] [debug] [entity_manager.cpp:307] [9] Updating scenes.
[2025-02-28 09:36:32.508] [debug] [entity_manager.cpp:313] [9] Existing scenes updated.
[2025-02-28 09:36:32.508] [debug] [entity_manager.cpp:317] [9] Checking for removed scenes.
[2025-02-28 09:36:32.508] [info] [entity_manager.cpp:344] [9] Performing post init on 1 entities.
[2025-02-28 09:36:32.508] [debug] [entity_manager.cpp:346] [9] Performing PostInit on entity type 3 with id 1
[2025-02-28 09:36:32.508] [info] [entity_manager.cpp:350] [9] Total loaded NSPanels: 0
[2025-02-28 09:36:32.509] [info] [entity_manager.cpp:351] [9] Total loaded Entities: 1
[2025-02-28 09:36:32.509] [info] [main.cpp:153] [9] Starting Websocket Server on port 8002.
[2025-02-28 09:36:32.509] [critical] [main.cpp:157] [9] No MQTT server or port configured! Will exit with code 1.
[2025-02-28 09:36:32.509] [debug] [websocket_server.cpp:13] [49] Creating new ix::WebSocketServer.
terminate called without an active exception
Setting /etc/timezone to Europe/Ljubljana
Will use timezone: Europe/Ljubljana
Running migrations...
No secret key exists, creating!
Did not find a running MQTTManager, starting MQTTManager...
ERROR:root:Failed to populate Home Assistant addon settings.
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 89, in _execute
    return self.cursor.execute(sql, params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/db/backends/sqlite3/base.py", line 328, in execute
    return super().execute(query, params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
sqlite3.OperationalError: no such table: web_settings

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/app/nspanelmanager/web/apps.py", line 68, in ready
    start_mqtt_manager()
  File "/usr/src/app/nspanelmanager/web/apps.py", line 20, in start_mqtt_manager
    mqttmanager_env["MQTT_SERVER"] = get_setting_with_default(
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/app/nspanelmanager/web/settings_helper.py", line 6, in get_setting_with_default
    if objects.count() > 0:
       ^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/db/models/query.py", line 608, in count
    return self.query.get_count(using=self.db)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/db/models/sql/query.py", line 568, in get_count
    return obj.get_aggregation(using, {"__count": Count("*")})["__count"]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/db/models/sql/query.py", line 554, in get_aggregation
    result = compiler.execute_sql(SINGLE)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/db/models/sql/compiler.py", line 1562, in execute_sql
    cursor.execute(sql, params)
  File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 102, in execute
    return super().execute(sql, params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 67, in execute
    return self._execute_with_wrappers(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers
    return executor(sql, params, many, context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 84, in _execute
    with self.db.wrap_database_errors:
  File "/usr/local/lib/python3.11/site-packages/django/db/utils.py", line 91, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/usr/local/lib/python3.11/site-packages/django/db/backends/utils.py", line 89, in _execute
    return self.cursor.execute(sql, params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/django/db/backends/sqlite3/base.py", line 328, in execute
    return super().execute(query, params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
django.db.utils.OperationalError: no such table: web_settings
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, sessions, web
Running migrations:
  Applying contenttypes.0001_initial... OK
  Applying auth.0001_initial... OK
  Applying admin.0001_initial... OK
  Applying admin.0002_logentry_remove_auto_add... OK
  Applying admin.0003_logentry_add_action_flag_choices... OK
  Applying contenttypes.0002_remove_content_type_name... OK
  Applying auth.0002_alter_permission_name_max_length... OK
  Applying auth.0003_alter_user_email_max_length... OK
  Applying auth.0004_alter_user_username_opts... OK
  Applying auth.0005_alter_user_last_login_null... OK
  Applying auth.0006_require_contenttypes_0002... OK
  Applying auth.0007_alter_validators_add_error_messages... OK
  Applying auth.0008_alter_user_username_max_length... OK
  Applying auth.0009_alter_user_last_name_max_length... OK
  Applying auth.0010_alter_group_name_max_length... OK
  Applying auth.0011_update_proxy_permissions... OK
  Applying auth.0012_alter_user_first_name_max_length... OK
  Applying sessions.0001_initial... OK
  Applying web.0001_initial... OK
  Applying web.0002_nspanel_ip_address... OK
  Applying web.0003_nspanel_version... OK
  Applying web.0004_firmware... OK
  Applying web.0005_alter_firmware_binary_data... OK
  Applying web.0006_delete_firmware... OK
  Applying web.0007_room_displayorder... OK
  Applying web.0008_light_color_temperature_topic_light_rgb_topic_and_more... OK
  Applying web.0009_light_friendly_name... OK
  Applying web.0010_light_color_temperature_light_rgb_state_topic_and_more... OK
  Applying web.0011_light_is_ceiling_light... OK
  Applying web.0012_settings... OK
  Applying web.0013_light_type... OK
  Applying web.0014_remove_light_cmd_topic_and_more... OK
  Applying web.0015_light_openhab_item_color_temp_and_more... OK
  Applying web.0016_light_openhab_control_mode_light_openhab_item_switch... OK
  Applying web.0017_nspanel_status_data... OK
  Applying web.0018_alter_nspanel_status_data... OK
  Applying web.0019_nspanel_online_state... OK
  Applying web.0020_roomviewpagelight_light_room_view_page... OK
  Applying web.0021_remove_light_room_view_page_light_room_view_position_and_more... OK
  Applying web.0022_remove_nspanel_status_data_nspanel_heap_used_pct_and_more... OK
  Applying web.0023_light_home_assistant_name... OK
  Applying web.0024_light_openhab_item_rgb... OK
  Applying web.0025_auto_20230412_2122... OK
  Applying web.0026_light_openhab_name... OK
  Applying web.0027_nspanel_button1_detached_mode_light_and_more... OK
  Applying web.0028_scene... OK
  Applying web.0029_rename_name_scene_friendly_name... OK
  Applying web.0030_remove_scene_lights_lightstate... OK
  Applying web.0031_lightstate_color_temperature... OK
  Applying web.0032_nspanel_temperature... OK
  Applying web.0033_nspanelsettings... OK
  Applying web.0034_nspanel_md5_data_file_nspanel_md5_firmware_and_more... OK
  Applying web.0035_remove_nspanel_last_seen... OK
  Applying web.0036_relaygroupbinding_relaygroup... OK
  Applying web.0037_remove_relaygroup_relay_group_bindings_and_more... OK
  Applying web.0038_nspanel_register_relay1_as_light_and_more... OK
  Applying web.0039_scene_scene_type... OK
  Applying web.0040_scene_backend_name... OK
  Applying web.0041_nspanel_denied... OK
  Applying web.0042_nspanel_accepted... OK
Starting Nginx
Restarting nginx: nginx.
Starting NSPanelManager web interface server
*** Starting uWSGI 2.0.22 (64bit) on [Fri Feb 28 10:38:29 2025] ***
compiled with version: 12.2.0 on 07 December 2024 23:27:22
os: Linux-6.8.12-2-pve #1 SMP PREEMPT_DYNAMIC PMX 6.8.12-2 (2024-09-05T10:03Z)
nodename: 4a1931412d7b
machine: x86_64
clock source: unix
detected number of CPU cores: 16
current working directory: /usr/src/app
writing pidfile to /tmp/project-master.pid
detected binary path: /usr/local/bin/uwsgi
!!! no internal routing support, rebuild with pcre support !!!
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
chdir() to /usr/src/app/nspanelmanager/
your processes number limit is 125781
your memory page size is 4096 bytes
 *** WARNING: you have enabled harakiri without post buffering. Slow upload could be rejected on post-unbuffered webservers ***
detected max file descriptor number: 524288
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to TCP address 127.0.0.1:8001 fd 3
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
Python version: 3.11.11 (main, Dec  4 2024, 20:38:25) [GCC 12.2.0]
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x799d79e17658
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 437520 bytes (427 KB) for 5 cores
*** Operational MODE: preforking ***
Did not find a running MQTTManager, starting MQTTManager...
WSGI app 0 (mountpoint='') ready in 1 seconds on interpreter 0x799d79e17658 pid: 31 (default app)
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 31)
spawned uWSGI worker 1 (pid: 42, cores: 1)
[2025-02-28 09:38:30.656] [info] [main.cpp:83] Starting MQTTManager.
[2025-02-28 09:38:30.656] [info] [main.cpp:91] /dev/shm has 67108864 bytes free.
[2025-02-28 09:38:30.656] [info] [main.cpp:96] Will log to /dev/shm/mqttmanager.log with a max size of 6710886 bytes.
spawned uWSGI worker 2 (pid: 43, cores: 1)
[2025-02-28 09:38:30.659] [debug] [mqtt_manager.hpp:40] [41] Adding 'nspanel/mqttmanager/command' to the list of topics to subscribe to.
[2025-02-28 09:38:30.659] [debug] [mqtt_manager.hpp:40] [41] Adding 'nspanel/+/status' to the list of topics to subscribe to.
[2025-02-28 09:38:30.659] [debug] [mqtt_manager.hpp:40] [41] Adding 'nspanel/+/status_report' to the list of topics to subscribe to.
[2025-02-28 09:38:30.659] [info] [mqtt_manager_config.cpp:43] [41] Read timezone Europe/Ljubljana from /etc/timezone.
[2025-02-28 09:38:30.659] [info] [mqtt_manager_config.cpp:106] [41] Gathering config from web manager.
spawned uWSGI worker 3 (pid: 44, cores: 1)
spawned uWSGI worker 4 (pid: 45, cores: 1)
spawned uWSGI worker 5 (pid: 46, cores: 1)
[2025-02-28 09:38:30.739] [debug] [mqtt_manager_config.cpp:111] [41] Got config data. Processing config.
[pid: 44|app: 0|req: 1/1] 127.0.0.1 () {30 vars in 385 bytes} [Fri Feb 28 09:38:30 2025] GET /api/get_mqtt_manager_config => generated 2919 bytes in 76 msecs (HTTP/1.1 200) 6 headers in 200 bytes (1 switches on core 0)
[2025-02-28 09:38:30.741] [info] [mqtt_manager_config.cpp:127] [41] Got config from web manager, will process and load values.
[2025-02-28 09:38:30.742] [critical] [mqtt_manager_config.cpp:148] [41] Manager port not configured! Setting 0.
[2025-02-28 09:38:30.742] [debug] [mqtt_manager_config.cpp:162] [41] Loading lights...
[2025-02-28 09:38:30.742] [debug] [mqtt_manager_config.cpp:168] [41] Loading NSPanels...
[2025-02-28 09:38:30.742] [debug] [mqtt_manager_config.cpp:174] [41] Loading Scenes...
[2025-02-28 09:38:30.742] [debug] [mqtt_manager_config.cpp:186] [41] Checking for removed scenes.
[2025-02-28 09:38:30.742] [debug] [mqtt_manager_config.cpp:202] [41] Loading Rooms...
[2025-02-28 09:38:30.742] [debug] [mqtt_manager_config.cpp:214] [41] Checking for removed rooms.
[2025-02-28 09:38:30.743] [debug] [mqtt_manager_config.cpp:230] [41] Loading relay groups...
[2025-02-28 09:38:30.743] [debug] [mqtt_manager_config.cpp:242] [41] Checking for removed relay groups.
[2025-02-28 09:38:30.743] [debug] [mqtt_manager_config.cpp:122] [41] Config loaded. Calling listeners.
[2025-02-28 09:38:30.743] [info] [entity_manager.cpp:142] [41] New config loaded, processing changes.
[2025-02-28 09:38:30.743] [info] [weather.cpp:26] [41] No running instance of weather manager found. Will start new thread.
[2025-02-28 09:38:30.743] [debug] [entity_manager.cpp:147] [41] Updating NSPanels.
[2025-02-28 09:38:30.743] [debug] [entity_manager.cpp:156] [41] Checking for removed NSPanels.
[2025-02-28 09:38:30.743] [debug] [entity_manager.cpp:175] [41] Updating lights.
[2025-02-28 09:38:30.743] [debug] [entity_manager.cpp:186] [41] Existing lights updated.
[2025-02-28 09:38:30.743] [debug] [entity_manager.cpp:189] [41] Checking for removed lights.
[2025-02-28 09:38:30.743] [debug] [entity_manager.cpp:218] [41] Updating rooms.
[2025-02-28 09:38:30.744] [debug] [entity_manager.cpp:222] [41] Trying to get room by id.
[2025-02-28 09:38:30.744] [debug] [entity_manager.cpp:224] [41] Got result. Trying to get mutex.
[2025-02-28 09:38:30.744] [debug] [entity_manager.cpp:226] [41] Got mutex.
[2025-02-28 09:38:30.744] [debug] [room.cpp:16] [41] Room 1::Dummy room initialized.
[2025-02-28 09:38:30.744] [debug] [entity_manager.cpp:235] [41] Existing rooms updated.
[2025-02-28 09:38:30.744] [debug] [entity_manager.cpp:238] [41] Checking for removed rooms.
[2025-02-28 09:38:30.744] [debug] [entity_manager.cpp:268] [41] Updating NSPanel relay groups.
[2025-02-28 09:38:30.744] [debug] [entity_manager.cpp:274] [41] Existing relay groups updated.
[2025-02-28 09:38:30.744] [debug] [entity_manager.cpp:278] [41] Checking for removed relay groups.
[2025-02-28 09:38:30.744] [debug] [entity_manager.cpp:307] [41] Updating scenes.
[2025-02-28 09:38:30.744] [debug] [entity_manager.cpp:313] [41] Existing scenes updated.
[2025-02-28 09:38:30.744] [debug] [entity_manager.cpp:317] [41] Checking for removed scenes.
[2025-02-28 09:38:30.744] [info] [entity_manager.cpp:344] [41] Performing post init on 1 entities.
[2025-02-28 09:38:30.744] [debug] [entity_manager.cpp:346] [41] Performing PostInit on entity type 3 with id 1
[2025-02-28 09:38:30.744] [info] [entity_manager.cpp:350] [41] Total loaded NSPanels: 0
[2025-02-28 09:38:30.744] [info] [entity_manager.cpp:351] [41] Total loaded Entities: 1
[2025-02-28 09:38:30.745] [info] [main.cpp:153] [41] Starting Websocket Server on port 8002.
[2025-02-28 09:38:30.745] [critical] [main.cpp:157] [41] No MQTT server or port configured! Will exit with code 1.
[2025-02-28 09:38:30.745] [debug] [websocket_server.cpp:13] [49] Creating new ix::WebSocketServer.
terminate called without an active exception
subprocess 41 exited by signal 6
invalid request block size: 6228 (max 4096)...skip
invalid request block size: 6186 (max 4096)...skip
invalid request block size: 6236 (max 4096)...skip
invalid request block size: 6190 (max 4096)...skip

It seems that it tried to set a setting in the database before the DB was created. Have you tried restarting the container? This should only be an issue on first start though this should be fixed.

tpanajott avatar Feb 28 '25 09:02 tpanajott

It seems that it tried to set a setting in the database before the DB was created. Have you tried restarting the container? This should only be an issue on first start though this should be fixed.

Yes I have tried many restarts. Doesn't help. I have now tried to install this as addon in Home Assistant and there it works fine, but I would preffer to have it as standalone on my Docker server.

Should I try the beta images?

thehijacker avatar Feb 28 '25 09:02 thehijacker

It seems that it tried to set a setting in the database before the DB was created. Have you tried restarting the container? This should only be an issue on first start though this should be fixed.

Yes I have tried many restarts. Doesn't help. I have now tried to install this as addon in Home Assistant and there it works fine, but I would preffer to have it as standalone on my Docker server.

Should I try the beta images?

Hm, strange. Beta images and stable are urrently exactly the same so that won't help. If you get the exact same log messages (the ones that say Applying XXXX... Ok even after restart that means that it hasn't been able to store the database persistently in your mapped directory (/mnt/usb_1/Docker/NSPanelManager). Could you verify that a database file has been created there or that those log messages don't repeat on restart of the container?

tpanajott avatar Feb 28 '25 10:02 tpanajott

I have the same problem. The application was already installed once and worked. After deleting the application and reinstalling it, I had this problem (502). Are there perhaps temporary files somewhere (Docker volumes et cetra)? How can I restart the Setup or Config Wizard?

Ksyuint avatar Feb 28 '25 10:02 Ksyuint

I have the same problem. The application was already installed once and worked. After deleting the application and reinstalling it, I had this problem (502). Are there perhaps temporary files somewhere (Docker volumes et cetra)? How can I restart the Setup or Config Wizard?

Well, in order to restart you need to delete the persistent database file (or simply move/rename it) that is stored on the persistent volume mapped to the /data-directory for the container. Can't recall the exact name but I belive that it should be something like nspanelmanager_db.sqlite.

tpanajott avatar Feb 28 '25 10:02 tpanajott

Content of directory:

root@docker-server:/mnt/usb_1/Docker/NSPanelManager# ll
total 236
drwxr-xr-x  2 root root   4096 Feb 28 10:57 ./
drwxrwxrwx 97 root root   4096 Feb 28 10:57 ../
-rw-r--r--  1 root root 229376 Feb 28 10:57 nspanelmanager_db.sqlite3
-rw-r--r--  1 root root     50 Feb 28 10:57 secret.key

And fresh log from container restart:

Setting /etc/timezone to Europe/Ljubljana
Will use timezone: Europe/Ljubljana
Running migrations...
Did not find a running MQTTManager, starting MQTTManager...
[2025-02-28 10:13:18.049] [info] [main.cpp:83] Starting MQTTManager.
[2025-02-28 10:13:18.050] [info] [main.cpp:91] /dev/shm has 67108864 bytes free.
[2025-02-28 10:13:18.050] [info] [main.cpp:96] Will log to /dev/shm/mqttmanager.log with a max size of 6710886 bytes.
[2025-02-28 10:13:18.052] [debug] [mqtt_manager.hpp:40] [9] Adding 'nspanel/mqttmanager/command' to the list of topics to subscribe to.
[2025-02-28 10:13:18.053] [debug] [mqtt_manager.hpp:40] [9] Adding 'nspanel/+/status' to the list of topics to subscribe to.
[2025-02-28 10:13:18.053] [debug] [mqtt_manager.hpp:40] [9] Adding 'nspanel/+/status_report' to the list of topics to subscribe to.
[2025-02-28 10:13:18.053] [info] [mqtt_manager_config.cpp:43] [9] Read timezone Europe/Ljubljana from /etc/timezone.
[2025-02-28 10:13:18.053] [info] [mqtt_manager_config.cpp:106] [9] Gathering config from web manager.
[2025-02-28 10:13:18.057] [error] [WebHelper.cpp:68] [9] Failed to perform HTTP request to 'http://127.0.0.1:8000/api/get_mqtt_manager_config'. Got response data: ''
[2025-02-28 10:13:18.057] [error] [WebHelper.cpp:69] [9] curl_easy_perform() failed, got code: 7. Text interpretation: Couldn't connect to server
[2025-02-28 10:13:18.057] [error] [WebHelper.cpp:70] [9] Curl error buffer: Failed to connect to 127.0.0.1 port 8000 after 0 ms: Couldn't connect to server
[2025-02-28 10:13:18.057] [error] [mqtt_manager_config.cpp:116] [9] Failed to get config. Will try again.
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, sessions, web
Running migrations:
  No migrations to apply.
Starting Nginx
Restarting nginx: nginx[2025-02-28 10:13:19.058] [error] [WebHelper.cpp:68] [9] Failed to perform HTTP request to 'http://127.0.0.1:8000/api/get_mqtt_manager_config'. Got response data: ''
[2025-02-28 10:13:19.058] [error] [WebHelper.cpp:69] [9] curl_easy_perform() failed, got code: 7. Text interpretation: Couldn't connect to server
[2025-02-28 10:13:19.058] [error] [WebHelper.cpp:70] [9] Curl error buffer: Failed to connect to 127.0.0.1 port 8000 after 0 ms: Couldn't connect to server
[2025-02-28 10:13:19.058] [error] [mqtt_manager_config.cpp:116] [9] Failed to get config. Will try again.
.
Starting NSPanelManager web interface server
*** Starting uWSGI 2.0.22 (64bit) on [Fri Feb 28 11:13:19 2025] ***
compiled with version: 12.2.0 on 07 December 2024 23:27:22
os: Linux-6.8.12-2-pve #1 SMP PREEMPT_DYNAMIC PMX 6.8.12-2 (2024-09-05T10:03Z)
nodename: 05e9713c42da
machine: x86_64
clock source: unix
detected number of CPU cores: 16
current working directory: /usr/src/app
writing pidfile to /tmp/project-master.pid
detected binary path: /usr/local/bin/uwsgi
!!! no internal routing support, rebuild with pcre support !!!
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
chdir() to /usr/src/app/nspanelmanager/
your processes number limit is 125781
your memory page size is 4096 bytes
 *** WARNING: you have enabled harakiri without post buffering. Slow upload could be rejected on post-unbuffered webservers ***
detected max file descriptor number: 524288
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to TCP address 127.0.0.1:8001 fd 3
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
Python version: 3.11.11 (main, Dec  4 2024, 20:38:25) [GCC 12.2.0]
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x73bea7c8f658
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 437520 bytes (427 KB) for 5 cores
*** Operational MODE: preforking ***
WSGI app 0 (mountpoint='') ready in 1 seconds on interpreter 0x73bea7c8f658 pid: 32 (default app)
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 32)
spawned uWSGI worker 1 (pid: 42, cores: 1)
spawned uWSGI worker 2 (pid: 43, cores: 1)
spawned uWSGI worker 3 (pid: 44, cores: 1)
spawned uWSGI worker 4 (pid: 45, cores: 1)
spawned uWSGI worker 5 (pid: 46, cores: 1)
[2025-02-28 10:13:20.337] [debug] [mqtt_manager_config.cpp:111] [9] Got config data. Processing config.
[pid: 42|app: 0|req: 1/1] 127.0.0.1 () {30 vars in 385 bytes} [Fri Feb 28 10:13:20 2025] GET /api/get_mqtt_manager_config => generated 2919 bytes in 84 msecs (HTTP/1.1 200) 6 headers in 200 bytes (1 switches on core 0)
[2025-02-28 10:13:20.339] [info] [mqtt_manager_config.cpp:127] [9] Got config from web manager, will process and load values.
[2025-02-28 10:13:20.340] [critical] [mqtt_manager_config.cpp:148] [9] Manager port not configured! Setting 0.
[2025-02-28 10:13:20.340] [debug] [mqtt_manager_config.cpp:162] [9] Loading lights...
[2025-02-28 10:13:20.340] [debug] [mqtt_manager_config.cpp:168] [9] Loading NSPanels...
[2025-02-28 10:13:20.340] [debug] [mqtt_manager_config.cpp:174] [9] Loading Scenes...
[2025-02-28 10:13:20.340] [debug] [mqtt_manager_config.cpp:186] [9] Checking for removed scenes.
[2025-02-28 10:13:20.340] [debug] [mqtt_manager_config.cpp:202] [9] Loading Rooms...
[2025-02-28 10:13:20.341] [debug] [mqtt_manager_config.cpp:214] [9] Checking for removed rooms.
[2025-02-28 10:13:20.341] [debug] [mqtt_manager_config.cpp:230] [9] Loading relay groups...
[2025-02-28 10:13:20.341] [debug] [mqtt_manager_config.cpp:242] [9] Checking for removed relay groups.
[2025-02-28 10:13:20.341] [debug] [mqtt_manager_config.cpp:122] [9] Config loaded. Calling listeners.
[2025-02-28 10:13:20.341] [info] [entity_manager.cpp:142] [9] New config loaded, processing changes.
[2025-02-28 10:13:20.342] [info] [weather.cpp:26] [9] No running instance of weather manager found. Will start new thread.
[2025-02-28 10:13:20.342] [debug] [entity_manager.cpp:147] [9] Updating NSPanels.
[2025-02-28 10:13:20.342] [debug] [entity_manager.cpp:156] [9] Checking for removed NSPanels.
[2025-02-28 10:13:20.342] [debug] [entity_manager.cpp:175] [9] Updating lights.
[2025-02-28 10:13:20.342] [debug] [entity_manager.cpp:186] [9] Existing lights updated.
[2025-02-28 10:13:20.342] [debug] [entity_manager.cpp:189] [9] Checking for removed lights.
[2025-02-28 10:13:20.342] [debug] [entity_manager.cpp:218] [9] Updating rooms.
[2025-02-28 10:13:20.342] [debug] [entity_manager.cpp:222] [9] Trying to get room by id.
[2025-02-28 10:13:20.342] [debug] [entity_manager.cpp:224] [9] Got result. Trying to get mutex.
[2025-02-28 10:13:20.342] [debug] [entity_manager.cpp:226] [9] Got mutex.
[2025-02-28 10:13:20.342] [debug] [room.cpp:16] [9] Room 1::Dummy room initialized.
[2025-02-28 10:13:20.342] [debug] [entity_manager.cpp:235] [9] Existing rooms updated.
[2025-02-28 10:13:20.342] [debug] [entity_manager.cpp:238] [9] Checking for removed rooms.
[2025-02-28 10:13:20.343] [debug] [entity_manager.cpp:268] [9] Updating NSPanel relay groups.
[2025-02-28 10:13:20.343] [debug] [entity_manager.cpp:274] [9] Existing relay groups updated.
[2025-02-28 10:13:20.343] [debug] [entity_manager.cpp:278] [9] Checking for removed relay groups.
[2025-02-28 10:13:20.343] [debug] [entity_manager.cpp:307] [9] Updating scenes.
[2025-02-28 10:13:20.343] [debug] [entity_manager.cpp:313] [9] Existing scenes updated.
[2025-02-28 10:13:20.343] [debug] [entity_manager.cpp:317] [9] Checking for removed scenes.
[2025-02-28 10:13:20.343] [info] [entity_manager.cpp:344] [9] Performing post init on 1 entities.
[2025-02-28 10:13:20.343] [debug] [entity_manager.cpp:346] [9] Performing PostInit on entity type 3 with id 1
[2025-02-28 10:13:20.343] [info] [entity_manager.cpp:350] [9] Total loaded NSPanels: 0
[2025-02-28 10:13:20.343] [info] [entity_manager.cpp:351] [9] Total loaded Entities: 1
[2025-02-28 10:13:20.343] [info] [main.cpp:153] [9] Starting Websocket Server on port 8002.
[2025-02-28 10:13:20.343] [critical] [main.cpp:157] [9] No MQTT server or port configured! Will exit with code 1.
terminate called without an active exception
[2025-02-28 10:13:20.343] [debug] [websocket_server.cpp:13] [49] Creating new ix::WebSocketServer.
invalid request block size: 6259 (max 4096)...skip
invalid request block size: 6186 (max 4096)...skip

Same 502 error.

thehijacker avatar Feb 28 '25 10:02 thehijacker

I had also completely deleted the folder beforehand and reloaded NSPanelManager. Unfortunately no improvement. I deleted /mnt/user/appdata/nspanelmanager with all files and started docker again, still 502...

Well, in order to restart you need to delete the persistent database file (or simply move/rename it) that is stored on the persistent volume mapped to the /data-directory for the container. Can't recall the exact name but I belive that it should be something like nspanelmanager_db.sqlite.

Ksyuint avatar Feb 28 '25 10:02 Ksyuint

Content of directory:

root@docker-server:/mnt/usb_1/Docker/NSPanelManager# ll
total 236
drwxr-xr-x  2 root root   4096 Feb 28 10:57 ./
drwxrwxrwx 97 root root   4096 Feb 28 10:57 ../
-rw-r--r--  1 root root 229376 Feb 28 10:57 nspanelmanager_db.sqlite3
-rw-r--r--  1 root root     50 Feb 28 10:57 secret.key

And fresh log from container restart:

Setting /etc/timezone to Europe/Ljubljana
Will use timezone: Europe/Ljubljana
Running migrations...
Did not find a running MQTTManager, starting MQTTManager...
[2025-02-28 10:13:18.049] [info] [main.cpp:83] Starting MQTTManager.
[2025-02-28 10:13:18.050] [info] [main.cpp:91] /dev/shm has 67108864 bytes free.
[2025-02-28 10:13:18.050] [info] [main.cpp:96] Will log to /dev/shm/mqttmanager.log with a max size of 6710886 bytes.
[2025-02-28 10:13:18.052] [debug] [mqtt_manager.hpp:40] [9] Adding 'nspanel/mqttmanager/command' to the list of topics to subscribe to.
[2025-02-28 10:13:18.053] [debug] [mqtt_manager.hpp:40] [9] Adding 'nspanel/+/status' to the list of topics to subscribe to.
[2025-02-28 10:13:18.053] [debug] [mqtt_manager.hpp:40] [9] Adding 'nspanel/+/status_report' to the list of topics to subscribe to.
[2025-02-28 10:13:18.053] [info] [mqtt_manager_config.cpp:43] [9] Read timezone Europe/Ljubljana from /etc/timezone.
[2025-02-28 10:13:18.053] [info] [mqtt_manager_config.cpp:106] [9] Gathering config from web manager.
[2025-02-28 10:13:18.057] [error] [WebHelper.cpp:68] [9] Failed to perform HTTP request to 'http://127.0.0.1:8000/api/get_mqtt_manager_config'. Got response data: ''
[2025-02-28 10:13:18.057] [error] [WebHelper.cpp:69] [9] curl_easy_perform() failed, got code: 7. Text interpretation: Couldn't connect to server
[2025-02-28 10:13:18.057] [error] [WebHelper.cpp:70] [9] Curl error buffer: Failed to connect to 127.0.0.1 port 8000 after 0 ms: Couldn't connect to server
[2025-02-28 10:13:18.057] [error] [mqtt_manager_config.cpp:116] [9] Failed to get config. Will try again.
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, sessions, web
Running migrations:
  No migrations to apply.
Starting Nginx
Restarting nginx: nginx[2025-02-28 10:13:19.058] [error] [WebHelper.cpp:68] [9] Failed to perform HTTP request to 'http://127.0.0.1:8000/api/get_mqtt_manager_config'. Got response data: ''
[2025-02-28 10:13:19.058] [error] [WebHelper.cpp:69] [9] curl_easy_perform() failed, got code: 7. Text interpretation: Couldn't connect to server
[2025-02-28 10:13:19.058] [error] [WebHelper.cpp:70] [9] Curl error buffer: Failed to connect to 127.0.0.1 port 8000 after 0 ms: Couldn't connect to server
[2025-02-28 10:13:19.058] [error] [mqtt_manager_config.cpp:116] [9] Failed to get config. Will try again.
.
Starting NSPanelManager web interface server
*** Starting uWSGI 2.0.22 (64bit) on [Fri Feb 28 11:13:19 2025] ***
compiled with version: 12.2.0 on 07 December 2024 23:27:22
os: Linux-6.8.12-2-pve #1 SMP PREEMPT_DYNAMIC PMX 6.8.12-2 (2024-09-05T10:03Z)
nodename: 05e9713c42da
machine: x86_64
clock source: unix
detected number of CPU cores: 16
current working directory: /usr/src/app
writing pidfile to /tmp/project-master.pid
detected binary path: /usr/local/bin/uwsgi
!!! no internal routing support, rebuild with pcre support !!!
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
chdir() to /usr/src/app/nspanelmanager/
your processes number limit is 125781
your memory page size is 4096 bytes
 *** WARNING: you have enabled harakiri without post buffering. Slow upload could be rejected on post-unbuffered webservers ***
detected max file descriptor number: 524288
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to TCP address 127.0.0.1:8001 fd 3
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
Python version: 3.11.11 (main, Dec  4 2024, 20:38:25) [GCC 12.2.0]
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x73bea7c8f658
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 437520 bytes (427 KB) for 5 cores
*** Operational MODE: preforking ***
WSGI app 0 (mountpoint='') ready in 1 seconds on interpreter 0x73bea7c8f658 pid: 32 (default app)
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 32)
spawned uWSGI worker 1 (pid: 42, cores: 1)
spawned uWSGI worker 2 (pid: 43, cores: 1)
spawned uWSGI worker 3 (pid: 44, cores: 1)
spawned uWSGI worker 4 (pid: 45, cores: 1)
spawned uWSGI worker 5 (pid: 46, cores: 1)
[2025-02-28 10:13:20.337] [debug] [mqtt_manager_config.cpp:111] [9] Got config data. Processing config.
[pid: 42|app: 0|req: 1/1] 127.0.0.1 () {30 vars in 385 bytes} [Fri Feb 28 10:13:20 2025] GET /api/get_mqtt_manager_config => generated 2919 bytes in 84 msecs (HTTP/1.1 200) 6 headers in 200 bytes (1 switches on core 0)
[2025-02-28 10:13:20.339] [info] [mqtt_manager_config.cpp:127] [9] Got config from web manager, will process and load values.
[2025-02-28 10:13:20.340] [critical] [mqtt_manager_config.cpp:148] [9] Manager port not configured! Setting 0.
[2025-02-28 10:13:20.340] [debug] [mqtt_manager_config.cpp:162] [9] Loading lights...
[2025-02-28 10:13:20.340] [debug] [mqtt_manager_config.cpp:168] [9] Loading NSPanels...
[2025-02-28 10:13:20.340] [debug] [mqtt_manager_config.cpp:174] [9] Loading Scenes...
[2025-02-28 10:13:20.340] [debug] [mqtt_manager_config.cpp:186] [9] Checking for removed scenes.
[2025-02-28 10:13:20.340] [debug] [mqtt_manager_config.cpp:202] [9] Loading Rooms...
[2025-02-28 10:13:20.341] [debug] [mqtt_manager_config.cpp:214] [9] Checking for removed rooms.
[2025-02-28 10:13:20.341] [debug] [mqtt_manager_config.cpp:230] [9] Loading relay groups...
[2025-02-28 10:13:20.341] [debug] [mqtt_manager_config.cpp:242] [9] Checking for removed relay groups.
[2025-02-28 10:13:20.341] [debug] [mqtt_manager_config.cpp:122] [9] Config loaded. Calling listeners.
[2025-02-28 10:13:20.341] [info] [entity_manager.cpp:142] [9] New config loaded, processing changes.
[2025-02-28 10:13:20.342] [info] [weather.cpp:26] [9] No running instance of weather manager found. Will start new thread.
[2025-02-28 10:13:20.342] [debug] [entity_manager.cpp:147] [9] Updating NSPanels.
[2025-02-28 10:13:20.342] [debug] [entity_manager.cpp:156] [9] Checking for removed NSPanels.
[2025-02-28 10:13:20.342] [debug] [entity_manager.cpp:175] [9] Updating lights.
[2025-02-28 10:13:20.342] [debug] [entity_manager.cpp:186] [9] Existing lights updated.
[2025-02-28 10:13:20.342] [debug] [entity_manager.cpp:189] [9] Checking for removed lights.
[2025-02-28 10:13:20.342] [debug] [entity_manager.cpp:218] [9] Updating rooms.
[2025-02-28 10:13:20.342] [debug] [entity_manager.cpp:222] [9] Trying to get room by id.
[2025-02-28 10:13:20.342] [debug] [entity_manager.cpp:224] [9] Got result. Trying to get mutex.
[2025-02-28 10:13:20.342] [debug] [entity_manager.cpp:226] [9] Got mutex.
[2025-02-28 10:13:20.342] [debug] [room.cpp:16] [9] Room 1::Dummy room initialized.
[2025-02-28 10:13:20.342] [debug] [entity_manager.cpp:235] [9] Existing rooms updated.
[2025-02-28 10:13:20.342] [debug] [entity_manager.cpp:238] [9] Checking for removed rooms.
[2025-02-28 10:13:20.343] [debug] [entity_manager.cpp:268] [9] Updating NSPanel relay groups.
[2025-02-28 10:13:20.343] [debug] [entity_manager.cpp:274] [9] Existing relay groups updated.
[2025-02-28 10:13:20.343] [debug] [entity_manager.cpp:278] [9] Checking for removed relay groups.
[2025-02-28 10:13:20.343] [debug] [entity_manager.cpp:307] [9] Updating scenes.
[2025-02-28 10:13:20.343] [debug] [entity_manager.cpp:313] [9] Existing scenes updated.
[2025-02-28 10:13:20.343] [debug] [entity_manager.cpp:317] [9] Checking for removed scenes.
[2025-02-28 10:13:20.343] [info] [entity_manager.cpp:344] [9] Performing post init on 1 entities.
[2025-02-28 10:13:20.343] [debug] [entity_manager.cpp:346] [9] Performing PostInit on entity type 3 with id 1
[2025-02-28 10:13:20.343] [info] [entity_manager.cpp:350] [9] Total loaded NSPanels: 0
[2025-02-28 10:13:20.343] [info] [entity_manager.cpp:351] [9] Total loaded Entities: 1
[2025-02-28 10:13:20.343] [info] [main.cpp:153] [9] Starting Websocket Server on port 8002.
[2025-02-28 10:13:20.343] [critical] [main.cpp:157] [9] No MQTT server or port configured! Will exit with code 1.
terminate called without an active exception
[2025-02-28 10:13:20.343] [debug] [websocket_server.cpp:13] [49] Creating new ix::WebSocketServer.
invalid request block size: 6259 (max 4096)...skip
invalid request block size: 6186 (max 4096)...skip

Same 502 error.

Hmm, strange. It seems that the MQTTManager process has no problem talking to the Django part of the container according to the logs but it seems that going through Nginx doesn't work. Could you perhaps navigate into the container using something like Portainer or docker exec (docker exec -it nspanemanager /bin/bash or something like that) and try running curl 127.0.0.1:8000. That should return a lot of data from the Nginx->Django web interface communication. If that works then the problem is when trying to communicate into the container.

tpanajott avatar Feb 28 '25 10:02 tpanajott

Executing curl 127.0.0.1:8000 inside container I get a lot of HTML code. So that works. What else can I try to debug this?

thehijacker avatar Feb 28 '25 10:02 thehijacker

Executing curl 127.0.0.1:8000 inside container I get a lot of HTML code. So that works. What else can I try to debug this?

Hmm, really strange. That would mean something goes wrong when the request comes from outside the container into the container. I really have no idea what it could be. @sebastienvermeille when you tried did you do so running the container with default port 8000 or did you change the port?

tpanajott avatar Feb 28 '25 10:02 tpanajott

Yes I also tried with default port 8000. I got exactly the same error message.

thehijacker avatar Feb 28 '25 10:02 thehijacker

Yes I also tried with default port 8000. I got exactly the same error message.

Hmm, really strange. It seems that Nginx starts and runs normaly as it works from within the container but it seems that something goes wrong when it tries to handle connections from outside. Perhaps check if the are relevant logs in the /var/log directory for nginx and see if that reports any errors.

tpanajott avatar Feb 28 '25 10:02 tpanajott