Skip to content

got error Reason: Worker failed to boot. #3159

@FosterG4

Description

@FosterG4

What happened?

got error at start

Logs ``` bw-ui-1 | /usr/share/bunkerweb/db/Database.py:388: SAWarning: transaction already deassociated from connection bw-ui-1 | session.rollback() bw-ui-1 | [2026-02-06 17:10:42 +0700] [UI] [31] [❌] - Exception in worker process bw-ui-1 | Traceback (most recent call last): bw-ui-1 | File "/usr/share/bunkerweb/db/Database.py", line 385, in _db_session bw-ui-1 | yield session bw-ui-1 | File "/usr/share/bunkerweb/db/Database.py", line 2046, in get_non_default_settings bw-ui-1 | results = session.execute(stmt).fetchall() bw-ui-1 | ~~~~~~~~~~~~~~~^^^^^^ bw-ui-1 | File "/usr/share/bunkerweb/deps/python/sqlalchemy/orm/scoping.py", line 765, in execute bw-ui-1 | return self._proxied.execute( bw-ui-1 | ~~~~~~~~~~~~~~~~~~~~~^ bw-ui-1 | statement, bw-ui-1 | ^^^^^^^^^^ bw-ui-1 | ...<4 lines>... bw-ui-1 | _add_event=_add_event, bw-ui-1 | ^^^^^^^^^^^^^^^^^^^^^^ bw-ui-1 | ) bw-ui-1 | ^ bw-ui-1 | File "/usr/share/bunkerweb/deps/python/sqlalchemy/orm/session.py", line 2351, in execute bw-ui-1 | return self._execute_internal( bw-ui-1 | ~~~~~~~~~~~~~~~~~~~~~~^ bw-ui-1 | statement, bw-ui-1 | ^^^^^^^^^^ bw-ui-1 | ...<4 lines>... bw-ui-1 | _add_event=_add_event, bw-ui-1 | ^^^^^^^^^^^^^^^^^^^^^^ bw-ui-1 | ) bw-ui-1 | ^ bw-ui-1 | File "/usr/share/bunkerweb/deps/python/sqlalchemy/orm/session.py", line 2249, in _execute_internal bw-ui-1 | result: Result[Any] = compile_state_cls.orm_execute_statement( bw-ui-1 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ bw-ui-1 | self, bw-ui-1 | ^^^^^ bw-ui-1 | ...<4 lines>... bw-ui-1 | conn, bw-ui-1 | ^^^^^ bw-ui-1 | ) bw-ui-1 | ^ bw-ui-1 | File "/usr/share/bunkerweb/deps/python/sqlalchemy/orm/context.py", line 309, in orm_execute_statement bw-ui-1 | return cls.orm_setup_cursor_result( bw-ui-1 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^ bw-ui-1 | session, bw-ui-1 | ^^^^^^^^ bw-ui-1 | ...<4 lines>... bw-ui-1 | result, bw-ui-1 | ^^^^^^^ bw-ui-1 | ) bw-ui-1 | ^ bw-ui-1 | File "/usr/share/bunkerweb/deps/python/sqlalchemy/orm/context.py", line 616, in orm_setup_cursor_result bw-ui-1 | return loading.instances(result, querycontext) bw-ui-1 | ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^ bw-ui-1 | File "/usr/share/bunkerweb/deps/python/sqlalchemy/orm/loading.py", line 133, in instances bw-ui-1 | with util.safe_reraise(): bw-ui-1 | ~~~~~~~~~~~~~~~~~^^ bw-ui-1 | File "/usr/share/bunkerweb/deps/python/sqlalchemy/util/langhelpers.py", line 224, in __exit__ bw-ui-1 | raise exc_value.with_traceback(exc_tb) bw-ui-1 | File "/usr/share/bunkerweb/deps/python/sqlalchemy/orm/loading.py", line 115, in instances bw-ui-1 | query_entity.row_processor(context, cursor) bw-ui-1 | ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^ bw-ui-1 | File "/usr/share/bunkerweb/deps/python/sqlalchemy/orm/context.py", line 3084, in row_processor bw-ui-1 | getter = result._getter(column) bw-ui-1 | File "/usr/share/bunkerweb/deps/python/sqlalchemy/engine/result.py", line 1178, in _getter bw-ui-1 | return self._metadata._getter(key, raiseerr) bw-ui-1 | ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^ bw-ui-1 | File "/usr/share/bunkerweb/deps/python/sqlalchemy/engine/result.py", line 169, in _getter bw-ui-1 | index = self._index_for_key(key, raiseerr) bw-ui-1 | File "/usr/share/bunkerweb/deps/python/sqlalchemy/engine/cursor.py", line 1454, in _index_for_key bw-ui-1 | self._we_dont_return_rows() bw-ui-1 | ~~~~~~~~~~~~~~~~~~~~~~~~~^^ bw-ui-1 | File "/usr/share/bunkerweb/deps/python/sqlalchemy/engine/cursor.py", line 1448, in _we_dont_return_rows bw-ui-1 | raise exc.ResourceClosedError( bw-ui-1 | ...<2 lines>... bw-ui-1 | ) from err bw-ui-1 | sqlalchemy.exc.ResourceClosedError: This result object does not return rows. It has been closed automatically. bw-ui-1 | bw-ui-1 | During handling of the above exception, another exception occurred: bw-ui-1 | bw-ui-1 | Traceback (most recent call last): bw-ui-1 | File "/usr/share/bunkerweb/deps/python/sqlalchemy/engine/base.py", line 1128, in _rollback_impl bw-ui-1 | self.engine.dialect.do_rollback(self.connection) bw-ui-1 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^ bw-ui-1 | File "/usr/share/bunkerweb/deps/python/sqlalchemy/engine/default.py", line 712, in do_rollback bw-ui-1 | dbapi_connection.rollback() bw-ui-1 | ~~~~~~~~~~~~~~~~~~~~~~~~~^^ bw-ui-1 | File "/usr/share/bunkerweb/deps/python/pymysql/connections.py", line 505, in rollback bw-ui-1 | self._read_ok_packet() bw-ui-1 | ~~~~~~~~~~~~~~~~~~~~^^ bw-ui-1 | File "/usr/share/bunkerweb/deps/python/pymysql/connections.py", line 465, in _read_ok_packet bw-ui-1 | pkt = self._read_packet() bw-ui-1 | File "/usr/share/bunkerweb/deps/python/pymysql/connections.py", line 751, in _read_packet bw-ui-1 | packet_header = self._read_bytes(4) bw-ui-1 | File "/usr/share/bunkerweb/deps/python/pymysql/connections.py", line 805, in _read_bytes bw-ui-1 | raise err.OperationalError( bw-ui-1 | CR.CR_SERVER_LOST, "Lost connection to MySQL server during query" bw-ui-1 | ) bw-ui-1 | pymysql.err.OperationalError: (2013, 'Lost connection to MySQL server during query') bw-ui-1 | bw-ui-1 | The above exception was the direct cause of the following exception: bw-ui-1 | bw-ui-1 | Traceback (most recent call last): bw-ui-1 | File "/usr/share/bunkerweb/deps/python/gunicorn/arbiter.py", line 608, in spawn_worker bw-ui-1 | worker.init_process() bw-ui-1 | ~~~~~~~~~~~~~~~~~~~^^ bw-ui-1 | File "/usr/share/bunkerweb/deps/python/gunicorn/workers/gthread.py", line 94, in init_process bw-ui-1 | super().init_process() bw-ui-1 | ~~~~~~~~~~~~~~~~~~~~^^ bw-ui-1 | File "/usr/share/bunkerweb/deps/python/gunicorn/workers/base.py", line 135, in init_process bw-ui-1 | self.load_wsgi() bw-ui-1 | ~~~~~~~~~~~~~~^^ bw-ui-1 | File "/usr/share/bunkerweb/deps/python/gunicorn/workers/base.py", line 147, in load_wsgi bw-ui-1 | self.wsgi = self.app.wsgi() bw-ui-1 | ~~~~~~~~~~~~~^^ bw-ui-1 | File "/usr/share/bunkerweb/deps/python/gunicorn/app/base.py", line 66, in wsgi bw-ui-1 | self.callable = self.load() bw-ui-1 | ~~~~~~~~~^^ bw-ui-1 | File "/usr/share/bunkerweb/deps/python/gunicorn/app/wsgiapp.py", line 57, in load bw-ui-1 | return self.load_wsgiapp() bw-ui-1 | ~~~~~~~~~~~~~~~~~^^ bw-ui-1 | File "/usr/share/bunkerweb/deps/python/gunicorn/app/wsgiapp.py", line 47, in load_wsgiapp bw-ui-1 | return util.import_app(self.app_uri) bw-ui-1 | ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^ bw-ui-1 | File "/usr/share/bunkerweb/deps/python/gunicorn/util.py", line 370, in import_app bw-ui-1 | mod = importlib.import_module(module) bw-ui-1 | File "/usr/local/lib/python3.13/importlib/__init__.py", line 88, in import_module bw-ui-1 | return _bootstrap._gcd_import(name[level:], package, level) bw-ui-1 | ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bw-ui-1 | File "", line 1387, in _gcd_import bw-ui-1 | File "", line 1360, in _find_and_load bw-ui-1 | File "", line 1331, in _find_and_load_unlocked bw-ui-1 | File "", line 935, in _load_unlocked bw-ui-1 | File "", line 1023, in exec_module bw-ui-1 | File "", line 488, in _call_with_frames_removed bw-ui-1 | File "/usr/share/bunkerweb/ui/main.py", line 568, in bw-ui-1 | redis_settings = BW_CONFIG.get_config( bw-ui-1 | global_only=True, bw-ui-1 | ...<15 lines>... bw-ui-1 | ), bw-ui-1 | ) bw-ui-1 | File "/usr/share/bunkerweb/ui/app/models/config.py", line 101, in get_config bw-ui-1 | return self.__db.get_non_default_settings(global_only=global_only, methods=methods, with_drafts=with_drafts, filtered_settings=filtered_settings) bw-ui-1 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bw-ui-1 | File "/usr/share/bunkerweb/db/Database.py", line 2020, in get_non_default_settings bw-ui-1 | with self._db_session() as session: bw-ui-1 | ~~~~~~~~~~~~~~~~^^ bw-ui-1 | File "/usr/local/lib/python3.13/contextlib.py", line 162, in __exit__ bw-ui-1 | self.gen.throw(value) bw-ui-1 | ~~~~~~~~~~~~~~^^^^^^^ bw-ui-1 | File "/usr/share/bunkerweb/db/Database.py", line 382, in _db_session bw-ui-1 | with self.sql_engine.connect() as conn: bw-ui-1 | ~~~~~~~~~~~~~~~~~~~~~~~^^ bw-ui-1 | File "/usr/share/bunkerweb/deps/python/sqlalchemy/engine/base.py", line 232, in __exit__ bw-ui-1 | self.close() bw-ui-1 | ~~~~~~~~~~^^ bw-ui-1 | File "/usr/share/bunkerweb/deps/python/sqlalchemy/engine/base.py", line 1243, in close bw-ui-1 | self._transaction.close() bw-ui-1 | ~~~~~~~~~~~~~~~~~~~~~~~^^ bw-ui-1 | File "/usr/share/bunkerweb/deps/python/sqlalchemy/engine/base.py", line 2597, in close bw-ui-1 | self._do_close() bw-ui-1 | ~~~~~~~~~~~~~~^^ bw-ui-1 | File "/usr/share/bunkerweb/deps/python/sqlalchemy/engine/base.py", line 2735, in _do_close bw-ui-1 | self._close_impl() bw-ui-1 | ~~~~~~~~~~~~~~~~^^ bw-ui-1 | File "/usr/share/bunkerweb/deps/python/sqlalchemy/engine/base.py", line 2721, in _close_impl bw-ui-1 | self._connection_rollback_impl() bw-ui-1 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^ bw-ui-1 | File "/usr/share/bunkerweb/deps/python/sqlalchemy/engine/base.py", line 2713, in _connection_rollback_impl bw-ui-1 | self.connection._rollback_impl() bw-ui-1 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^ bw-ui-1 | File "/usr/share/bunkerweb/deps/python/sqlalchemy/engine/base.py", line 1130, in _rollback_impl bw-ui-1 | self._handle_dbapi_exception(e, None, None, None, None) bw-ui-1 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^ bw-ui-1 | File "/usr/share/bunkerweb/deps/python/sqlalchemy/engine/base.py", line 2363, in _handle_dbapi_exception bw-ui-1 | raise sqlalchemy_exception.with_traceback(exc_info[2]) from e bw-ui-1 | File "/usr/share/bunkerweb/deps/python/sqlalchemy/engine/base.py", line 1128, in _rollback_impl bw-ui-1 | self.engine.dialect.do_rollback(self.connection) bw-ui-1 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^ bw-ui-1 | File "/usr/share/bunkerweb/deps/python/sqlalchemy/engine/default.py", line 712, in do_rollback bw-ui-1 | dbapi_connection.rollback() bw-ui-1 | ~~~~~~~~~~~~~~~~~~~~~~~~~^^ bw-ui-1 | File "/usr/share/bunkerweb/deps/python/pymysql/connections.py", line 505, in rollback bw-ui-1 | self._read_ok_packet() bw-ui-1 | ~~~~~~~~~~~~~~~~~~~~^^ bw-ui-1 | File "/usr/share/bunkerweb/deps/python/pymysql/connections.py", line 465, in _read_ok_packet bw-ui-1 | pkt = self._read_packet() bw-ui-1 | File "/usr/share/bunkerweb/deps/python/pymysql/connections.py", line 751, in _read_packet bw-ui-1 | packet_header = self._read_bytes(4) bw-ui-1 | File "/usr/share/bunkerweb/deps/python/pymysql/connections.py", line 805, in _read_bytes bw-ui-1 | raise err.OperationalError( bw-ui-1 | CR.CR_SERVER_LOST, "Lost connection to MySQL server during query" bw-ui-1 | ) bw-ui-1 | sqlalchemy.exc.OperationalError: (pymysql.err.OperationalError) (2013, 'Lost connection to MySQL server during query') bw-ui-1 | (Background on this error at: https://sqlalche.me/e/20/e3q8) bw-ui-1 | [2026-02-06 17:10:42 +0700] [UI] [31] [ℹ️ ] - Worker exiting (pid: 31) bw-ui-1 | [2026-02-06 17:10:42 +0700] [UI] [21] [❌] - Worker (pid:31) exited with code 3 bw-ui-1 | [2026-02-06 17:10:42 +0700] [UI] [30] [ℹ️ ] - Caught stop operation bw-ui-1 | [2026-02-06 17:10:42 +0700] [UI] [30] [ℹ️ ] - Stopping web ui ... bw-ui-1 | [2026-02-06 17:10:42 +0700] [UI] [39] [ℹ️ ] - Caught stop operation bw-ui-1 | [2026-02-06 17:10:42 +0700] [UI] [32] [ℹ️ ] - Caught stop operation bw-ui-1 | [2026-02-06 17:10:42 +0700] [UI] [41] [ℹ️ ] - Caught stop operation bw-ui-1 | [2026-02-06 17:10:42 +0700] [UI] [33] [ℹ️ ] - Caught stop operation bw-ui-1 | [2026-02-06 17:10:42 +0700] [UI] [39] [ℹ️ ] - Stopping web ui ... bw-ui-1 | [2026-02-06 17:10:42 +0700] [UI] [41] [ℹ️ ] - Stopping web ui ... bw-ui-1 | [2026-02-06 17:10:42 +0700] [UI] [32] [ℹ️ ] - Stopping web ui ... bw-ui-1 | [2026-02-06 17:10:42 +0700] [UI] [33] [ℹ️ ] - Stopping web ui ... bw-ui-1 | [2026-02-06 17:10:42 +0700] [UI] [35] [ℹ️ ] - Caught stop operation bw-ui-1 | [2026-02-06 17:10:42 +0700] [UI] [37] [ℹ️ ] - Caught stop operation bw-ui-1 | [2026-02-06 17:10:42 +0700] [UI] [37] [ℹ️ ] - Stopping web ui ... bw-ui-1 | [2026-02-06 17:10:42 +0700] [UI] [35] [ℹ️ ] - Stopping web ui ... bw-ui-1 | [2026-02-06 17:10:42 +0700] [UI] [34] [ℹ️ ] - Caught stop operation bw-ui-1 | [2026-02-06 17:10:42 +0700] [UI] [36] [ℹ️ ] - Caught stop operation bw-ui-1 | [2026-02-06 17:10:42 +0700] [UI] [34] [ℹ️ ] - Stopping web ui ... bw-ui-1 | [2026-02-06 17:10:42 +0700] [UI] [36] [ℹ️ ] - Stopping web ui ... bw-ui-1 | [2026-02-06 17:10:43 +0700] [UI] [38] [ℹ️ ] - Worker exiting (pid: 38) bw-ui-1 | [2026-02-06 17:10:43 +0700] [UI] [42] [ℹ️ ] - Worker exiting (pid: 42) bw-ui-1 | [2026-02-06 17:10:43 +0700] [UI] [40] [ℹ️ ] - Worker exiting (pid: 40) bw-ui-1 | [2026-02-06 17:10:43 +0700] [UI] [43] [ℹ️ ] - Worker exiting (pid: 43) bw-ui-1 | [2026-02-06 17:10:43 +0700] [UI] [44] [ℹ️ ] - Worker exiting (pid: 44) bw-ui-1 | [2026-02-06 17:10:44 +0700] [UI] [21] [❌] - Shutting down: Master bw-ui-1 | [2026-02-06 17:10:44 +0700] [UI] [21] [❌] - Reason: Worker failed to boot. bw-ui-1 | [2026-02-06 17:10:45] - ENTRYPOINT - ℹ️ - Web UI stopped with exit code 3 ```

How to reproduce?

just docker compose up -d

Configuration file(s) (yaml or .env)

Compose
x-ui-env: &bw-ui-env
  # We anchor the environment variables to avoid duplication
  AUTOCONF_MODE: "yes"
  DATABASE_URI: "mariadb+pymysql://bunkerweb:password@bw-db:3306/db" # Remember to set a stronger password for the database
  TZ: "Asia/Jakarta"
  DATABASE_POOL_PRE_PING: "true"
  DATABASE_POOL_RECYCLE: "1800"

services:
  bunkerweb:
    image: ghcr.io/bunkerity/bunkerweb:1.6.7
    ports:
      - "80:8080/tcp"
      - "443:8443/tcp"
      - "443:8443/udp" # QUIC
    environment:
      AUTOCONF_MODE: "yes"
      API_WHITELIST_IP: "127.0.0.0/24 10.20.30.0/24"
      USE_REDIS: "yes"
      REDIS_HOST: "redis"
      #REDIS_HOST: "172.100.0.2"
      #REDIS_PORT: "6399"
      #REDIS_DATABASE: "0"
      #REDIS_PASSWORD: "69XN8hGDMvd6GqPT20NRkU7YiXrotr4MxILtElvP6DZ" # Remember to set a stronger password for Redis
    restart: "unless-stopped"
    networks:
      - bw-universe
      - bw-services
#      - redis_redis-net
    logging:
      driver: syslog
      options:
        tag: "bunkerweb" # This will be the tag used by syslog-ng to create the log file
        syslog-address: "udp://10.20.30.254:514" # This is the syslog-ng container address

  bw-scheduler:
    image: ghcr.io/bunkerity/bunkerweb-scheduler:1.6.7
    environment:
      <<: *bw-ui-env
      BUNKERWEB_INSTANCES: "" # We don't need to specify the BunkerWeb instance here as they are automatically detected by the autoconf service
      SERVER_NAME: "" # The server name will be filled with services labels
      MULTISITE: "yes" # Mandatory setting for autoconf / ui
      USE_CROWDSEC: "no"
      CROWDSEC_API: "http://crowdsec:8080" # This is the address of the CrowdSec container API in the same network
      CROWDSEC_APPSEC_URL: "http://crowdsec:7422" # Comment if you don't want to use the AppSec Component
      CROWDSEC_API_KEY: "CROWDSEC_API_KEY" # Remember to set a stronger key for the bouncer
      API_WHITELIST_IP: "127.0.0.0/24 10.20.30.0/24"
      USE_BACKUP: "yes"                # Added
      BACKUP_SCHEDULE: "daily"         # Added
      BACKUP_ROTATION: "7"             # Added
      BACKUP_DIRECTORY: "/var/lib/bunkerweb/backups"  # Added
    volumes:
      - bw-storage:/data # This is used to persist the cache and other data like the backups
    restart: "unless-stopped"
    networks:
      - bw-universe
      - bw-db
    logging:
      driver: syslog
      options:
        tag: "bw-scheduler" # This will be the tag used by syslog-ng to create the log file
        syslog-address: "udp://10.20.30.254:514" # This is the syslog-ng container address

  bw-autoconf:
    image: ghcr.io/bunkerity/bunkerweb-autoconf:1.6.7
    depends_on:
      - bunkerweb
      - bw-docker
    environment:
      <<: *bw-ui-env
      DOCKER_HOST: "tcp://bw-docker:2375" # This is the Docker socket address
    restart: "unless-stopped"
    networks:
      - bw-universe
      - bw-docker
      - bw-db
    logging:
      driver: syslog
      options:
        tag: "bw-autoconf" # This will be the tag used by syslog-ng to create the log file
        syslog-address: "udp://10.20.30.254:514" # This is the syslog-ng container address

  bw-ui:
    image: ghcr.io/bunkerity/bunkerweb-ui:1.6.7
    environment:
      <<: *bw-ui-env
      ADMIN_USERNAME: "username" # Remember to set a stronger username for the admin user
      ADMIN_PASSWORD: "password" # Remember to set a stronger password for the admin user
      TOTP_SECRETS: "secretkey" # Remember to set a stronger secret key (see the Prerequisites section)
    volumes:
      - bw-logs:/var/log/bunkerweb
    restart: "unless-stopped"
    networks:
      - bw-universe
      - bw-db
    labels:
      - "bunkerweb.SERVER_NAME=domain.tld" # Change it to your domain
      - "bunkerweb.USE_TEMPLATE=ui"
      - "bunkerweb.USE_REVERSE_PROXY=yes"
      - "bunkerweb.REVERSE_PROXY_URL=/" # Change it to a hard to guess URI
      - "bunkerweb.REVERSE_PROXY_HOST=http://bw-ui:7000"      
    logging:
      driver: syslog
      options:
        tag: "bw-ui" # This will be the tag used by syslog-ng to create the log file
        syslog-address: "udp://10.20.30.254:514" # This is the syslog-ng container address

  bw-db:
    image: mariadb:11
    environment:
      MYSQL_RANDOM_ROOT_PASSWORD: "yes"
      MYSQL_DATABASE: "db"
      MYSQL_USER: "bunkerweb"
      MYSQL_PASSWORD: "111111111111111"
    command:
      - --max_allowed_packet=2G
#      - --wait_timeout=90800
#      - --interactive_timeout=90800
#      - --net_read_timeout=600
#      - --net_write_timeout=600
#      - --connect_timeout=600   
    volumes:
      - bw-data:/var/lib/mysql
    restart: "unless-stopped"
    networks:
      bw-db:
      bw-universe:
        ipv4_address: 10.20.30.200
    healthcheck:
      test: /usr/share/bunkerweb/helpers/healthcheck.sh
      interval: 10s
      timeout: 10s
      start_period: 10s
      retries: 6

  redis: # Redis service for the persistence of reports/bans/stats
    image: redis:8-alpine
    command: >
      redis-server
      --maxmemory 256mb
      --maxmemory-policy allkeys-lru
      --save 60 1000
      --appendonly yes
    volumes:
      - redis-data:/data
    restart: "unless-stopped"
    networks:
      - bw-universe

  bw-docker:
    image: tecnativa/docker-socket-proxy:nightly
    environment:
      CONTAINERS: "1"
      LOG_LEVEL: "warning"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
    restart: "unless-stopped"
    networks:
      - bw-docker

  crowdsec:
    image: crowdsecurity/crowdsec:v1.7.6 # Use the latest version but always pin the version for a better stability/security
    volumes:
      - cs-data:/var/lib/crowdsec/data # To persist the CrowdSec data
      - bw-logs:/var/log:ro # The logs of BunkerWeb for CrowdSec to parse
      - ./acquis.yaml:/etc/crowdsec/acquis.yaml # The acquisition file for BunkerWeb logs
      - ./appsec.yaml:/etc/crowdsec/acquis.d/appsec.yaml # Comment if you don't want to use the AppSec Component
    environment:
      BOUNCER_KEY_bunkerweb: "111111111111111" # Remember to set a stronger key for the bouncer
      COLLECTIONS: "crowdsecurity/nginx crowdsecurity/appsec-virtual-patching crowdsecurity/appsec-generic-rules"
      #      COLLECTIONS: "crowdsecurity/nginx" # If you don't want to use the AppSec Component use this line instead
    networks:
      - bw-universe
  
  bw-syslog:
    image: balabit/syslog-ng:4.8.0
    # image: lscr.io/linuxserver/syslog-ng:4.8.1-r1-ls147 # For aarch64 architecture
    cap_add:
      - NET_BIND_SERVICE  # Bind to low ports
      - NET_BROADCAST  # Send broadcasts
      - NET_RAW  # Use raw sockets
      - DAC_READ_SEARCH  # Read files bypassing permissions
      - DAC_OVERRIDE  # Override file permissions
      - CHOWN  # Change ownership
      - SYSLOG  # Write to system logs
    volumes:
      - bw-logs:/var/log/bunkerweb # This is the volume used to store the logs
      - ./syslog-ng.conf:/etc/syslog-ng/syslog-ng.conf # This is the syslog-ng configuration file
    networks:
      bw-universe:
        ipv4_address: 10.20.30.254 # Make sure to set the correct IP address

volumes:
  bw-data:
  bw-storage:
  bw-logs:
  cs-data:
  redis-data:

networks:
  bw-universe:
    name: bw-universe
    ipam:
      driver: default
      config:
        - subnet: 10.20.30.0/24
  bw-services:
    name: bw-services
  bw-db:
    name: bw-db
  bw-docker:
    name: bw-docker
  redis_redis-net:
    external: true

Relevant log output

bw-ui-1         | /usr/share/bunkerweb/db/Database.py:388: SAWarning: transaction already deassociated from connection
bw-ui-1         |   session.rollback()
bw-ui-1         | [2026-02-06 17:10:42 +0700] [UI] [31] [❌] - Exception in worker process
bw-ui-1         | Traceback (most recent call last):
bw-ui-1         |   File "/usr/share/bunkerweb/db/Database.py", line 385, in _db_session
bw-ui-1         |     yield session
bw-ui-1         |   File "/usr/share/bunkerweb/db/Database.py", line 2046, in get_non_default_settings
bw-ui-1         |     results = session.execute(stmt).fetchall()
bw-ui-1         |               ~~~~~~~~~~~~~~~^^^^^^
bw-ui-1         |   File "/usr/share/bunkerweb/deps/python/sqlalchemy/orm/scoping.py", line 765, in execute
bw-ui-1         |     return self._proxied.execute(
bw-ui-1         |            ~~~~~~~~~~~~~~~~~~~~~^
bw-ui-1         |         statement,
bw-ui-1         |         ^^^^^^^^^^
bw-ui-1         |     ...<4 lines>...
bw-ui-1         |         _add_event=_add_event,
bw-ui-1         |         ^^^^^^^^^^^^^^^^^^^^^^
bw-ui-1         |     )
bw-ui-1         |     ^
bw-ui-1         |   File "/usr/share/bunkerweb/deps/python/sqlalchemy/orm/session.py", line 2351, in execute
bw-ui-1         |     return self._execute_internal(
bw-ui-1         |            ~~~~~~~~~~~~~~~~~~~~~~^
bw-ui-1         |         statement,
bw-ui-1         |         ^^^^^^^^^^
bw-ui-1         |     ...<4 lines>...
bw-ui-1         |         _add_event=_add_event,
bw-ui-1         |         ^^^^^^^^^^^^^^^^^^^^^^
bw-ui-1         |     )
bw-ui-1         |     ^
bw-ui-1         |   File "/usr/share/bunkerweb/deps/python/sqlalchemy/orm/session.py", line 2249, in _execute_internal
bw-ui-1         |     result: Result[Any] = compile_state_cls.orm_execute_statement(
bw-ui-1         |                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
bw-ui-1         |         self,
bw-ui-1         |         ^^^^^
bw-ui-1         |     ...<4 lines>...
bw-ui-1         |         conn,
bw-ui-1         |         ^^^^^
bw-ui-1         |     )
bw-ui-1         |     ^
bw-ui-1         |   File "/usr/share/bunkerweb/deps/python/sqlalchemy/orm/context.py", line 309, in orm_execute_statement
bw-ui-1         |     return cls.orm_setup_cursor_result(
bw-ui-1         |            ~~~~~~~~~~~~~~~~~~~~~~~~~~~^
bw-ui-1         |         session,
bw-ui-1         |         ^^^^^^^^
bw-ui-1         |     ...<4 lines>...
bw-ui-1         |         result,
bw-ui-1         |         ^^^^^^^
bw-ui-1         |     )
bw-ui-1         |     ^
bw-ui-1         |   File "/usr/share/bunkerweb/deps/python/sqlalchemy/orm/context.py", line 616, in orm_setup_cursor_result
bw-ui-1         |     return loading.instances(result, querycontext)
bw-ui-1         |            ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
bw-ui-1         |   File "/usr/share/bunkerweb/deps/python/sqlalchemy/orm/loading.py", line 133, in instances
bw-ui-1         |     with util.safe_reraise():
bw-ui-1         |          ~~~~~~~~~~~~~~~~~^^
bw-ui-1         |   File "/usr/share/bunkerweb/deps/python/sqlalchemy/util/langhelpers.py", line 224, in __exit__
bw-ui-1         |     raise exc_value.with_traceback(exc_tb)
bw-ui-1         |   File "/usr/share/bunkerweb/deps/python/sqlalchemy/orm/loading.py", line 115, in instances
bw-ui-1         |     query_entity.row_processor(context, cursor)
bw-ui-1         |     ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
bw-ui-1         |   File "/usr/share/bunkerweb/deps/python/sqlalchemy/orm/context.py", line 3084, in row_processor
bw-ui-1         |     getter = result._getter(column)
bw-ui-1         |   File "/usr/share/bunkerweb/deps/python/sqlalchemy/engine/result.py", line 1178, in _getter
bw-ui-1         |     return self._metadata._getter(key, raiseerr)
bw-ui-1         |            ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
bw-ui-1         |   File "/usr/share/bunkerweb/deps/python/sqlalchemy/engine/result.py", line 169, in _getter
bw-ui-1         |     index = self._index_for_key(key, raiseerr)
bw-ui-1         |   File "/usr/share/bunkerweb/deps/python/sqlalchemy/engine/cursor.py", line 1454, in _index_for_key
bw-ui-1         |     self._we_dont_return_rows()
bw-ui-1         |     ~~~~~~~~~~~~~~~~~~~~~~~~~^^
bw-ui-1         |   File "/usr/share/bunkerweb/deps/python/sqlalchemy/engine/cursor.py", line 1448, in _we_dont_return_rows
bw-ui-1         |     raise exc.ResourceClosedError(
bw-ui-1         |     ...<2 lines>...
bw-ui-1         |     ) from err
bw-ui-1         | sqlalchemy.exc.ResourceClosedError: This result object does not return rows. It has been closed automatically.
bw-ui-1         | 
bw-ui-1         | During handling of the above exception, another exception occurred:
bw-ui-1         | 
bw-ui-1         | Traceback (most recent call last):
bw-ui-1         |   File "/usr/share/bunkerweb/deps/python/sqlalchemy/engine/base.py", line 1128, in _rollback_impl
bw-ui-1         |     self.engine.dialect.do_rollback(self.connection)
bw-ui-1         |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
bw-ui-1         |   File "/usr/share/bunkerweb/deps/python/sqlalchemy/engine/default.py", line 712, in do_rollback
bw-ui-1         |     dbapi_connection.rollback()
bw-ui-1         |     ~~~~~~~~~~~~~~~~~~~~~~~~~^^
bw-ui-1         |   File "/usr/share/bunkerweb/deps/python/pymysql/connections.py", line 505, in rollback
bw-ui-1         |     self._read_ok_packet()
bw-ui-1         |     ~~~~~~~~~~~~~~~~~~~~^^
bw-ui-1         |   File "/usr/share/bunkerweb/deps/python/pymysql/connections.py", line 465, in _read_ok_packet
bw-ui-1         |     pkt = self._read_packet()
bw-ui-1         |   File "/usr/share/bunkerweb/deps/python/pymysql/connections.py", line 751, in _read_packet
bw-ui-1         |     packet_header = self._read_bytes(4)
bw-ui-1         |   File "/usr/share/bunkerweb/deps/python/pymysql/connections.py", line 805, in _read_bytes
bw-ui-1         |     raise err.OperationalError(
bw-ui-1         |         CR.CR_SERVER_LOST, "Lost connection to MySQL server during query"
bw-ui-1         |     )
bw-ui-1         | pymysql.err.OperationalError: (2013, 'Lost connection to MySQL server during query')
bw-ui-1         | 
bw-ui-1         | The above exception was the direct cause of the following exception:
bw-ui-1         | 
bw-ui-1         | Traceback (most recent call last):
bw-ui-1         |   File "/usr/share/bunkerweb/deps/python/gunicorn/arbiter.py", line 608, in spawn_worker
bw-ui-1         |     worker.init_process()
bw-ui-1         |     ~~~~~~~~~~~~~~~~~~~^^
bw-ui-1         |   File "/usr/share/bunkerweb/deps/python/gunicorn/workers/gthread.py", line 94, in init_process
bw-ui-1         |     super().init_process()
bw-ui-1         |     ~~~~~~~~~~~~~~~~~~~~^^
bw-ui-1         |   File "/usr/share/bunkerweb/deps/python/gunicorn/workers/base.py", line 135, in init_process
bw-ui-1         |     self.load_wsgi()
bw-ui-1         |     ~~~~~~~~~~~~~~^^
bw-ui-1         |   File "/usr/share/bunkerweb/deps/python/gunicorn/workers/base.py", line 147, in load_wsgi
bw-ui-1         |     self.wsgi = self.app.wsgi()
bw-ui-1         |                 ~~~~~~~~~~~~~^^
bw-ui-1         |   File "/usr/share/bunkerweb/deps/python/gunicorn/app/base.py", line 66, in wsgi
bw-ui-1         |     self.callable = self.load()
bw-ui-1         |                     ~~~~~~~~~^^
bw-ui-1         |   File "/usr/share/bunkerweb/deps/python/gunicorn/app/wsgiapp.py", line 57, in load
bw-ui-1         |     return self.load_wsgiapp()
bw-ui-1         |            ~~~~~~~~~~~~~~~~~^^
bw-ui-1         |   File "/usr/share/bunkerweb/deps/python/gunicorn/app/wsgiapp.py", line 47, in load_wsgiapp
bw-ui-1         |     return util.import_app(self.app_uri)
bw-ui-1         |            ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
bw-ui-1         |   File "/usr/share/bunkerweb/deps/python/gunicorn/util.py", line 370, in import_app
bw-ui-1         |     mod = importlib.import_module(module)
bw-ui-1         |   File "/usr/local/lib/python3.13/importlib/__init__.py", line 88, in import_module
bw-ui-1         |     return _bootstrap._gcd_import(name[level:], package, level)
bw-ui-1         |            ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
bw-ui-1         |   File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
bw-ui-1         |   File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
bw-ui-1         |   File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
bw-ui-1         |   File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
bw-ui-1         |   File "<frozen importlib._bootstrap_external>", line 1023, in exec_module
bw-ui-1         |   File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
bw-ui-1         |   File "/usr/share/bunkerweb/ui/main.py", line 568, in <module>
bw-ui-1         |     redis_settings = BW_CONFIG.get_config(
bw-ui-1         |         global_only=True,
bw-ui-1         |     ...<15 lines>...
bw-ui-1         |         ),
bw-ui-1         |     )
bw-ui-1         |   File "/usr/share/bunkerweb/ui/app/models/config.py", line 101, in get_config
bw-ui-1         |     return self.__db.get_non_default_settings(global_only=global_only, methods=methods, with_drafts=with_drafts, filtered_settings=filtered_settings)
bw-ui-1         |            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
bw-ui-1         |   File "/usr/share/bunkerweb/db/Database.py", line 2020, in get_non_default_settings
bw-ui-1         |     with self._db_session() as session:
bw-ui-1         |          ~~~~~~~~~~~~~~~~^^
bw-ui-1         |   File "/usr/local/lib/python3.13/contextlib.py", line 162, in __exit__
bw-ui-1         |     self.gen.throw(value)
bw-ui-1         |     ~~~~~~~~~~~~~~^^^^^^^
bw-ui-1         |   File "/usr/share/bunkerweb/db/Database.py", line 382, in _db_session
bw-ui-1         |     with self.sql_engine.connect() as conn:
bw-ui-1         |          ~~~~~~~~~~~~~~~~~~~~~~~^^
bw-ui-1         |   File "/usr/share/bunkerweb/deps/python/sqlalchemy/engine/base.py", line 232, in __exit__
bw-ui-1         |     self.close()
bw-ui-1         |     ~~~~~~~~~~^^
bw-ui-1         |   File "/usr/share/bunkerweb/deps/python/sqlalchemy/engine/base.py", line 1243, in close
bw-ui-1         |     self._transaction.close()
bw-ui-1         |     ~~~~~~~~~~~~~~~~~~~~~~~^^
bw-ui-1         |   File "/usr/share/bunkerweb/deps/python/sqlalchemy/engine/base.py", line 2597, in close
bw-ui-1         |     self._do_close()
bw-ui-1         |     ~~~~~~~~~~~~~~^^
bw-ui-1         |   File "/usr/share/bunkerweb/deps/python/sqlalchemy/engine/base.py", line 2735, in _do_close
bw-ui-1         |     self._close_impl()
bw-ui-1         |     ~~~~~~~~~~~~~~~~^^
bw-ui-1         |   File "/usr/share/bunkerweb/deps/python/sqlalchemy/engine/base.py", line 2721, in _close_impl
bw-ui-1         |     self._connection_rollback_impl()
bw-ui-1         |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
bw-ui-1         |   File "/usr/share/bunkerweb/deps/python/sqlalchemy/engine/base.py", line 2713, in _connection_rollback_impl
bw-ui-1         |     self.connection._rollback_impl()
bw-ui-1         |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
bw-ui-1         |   File "/usr/share/bunkerweb/deps/python/sqlalchemy/engine/base.py", line 1130, in _rollback_impl
bw-ui-1         |     self._handle_dbapi_exception(e, None, None, None, None)
bw-ui-1         |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
bw-ui-1         |   File "/usr/share/bunkerweb/deps/python/sqlalchemy/engine/base.py", line 2363, in _handle_dbapi_exception
bw-ui-1         |     raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
bw-ui-1         |   File "/usr/share/bunkerweb/deps/python/sqlalchemy/engine/base.py", line 1128, in _rollback_impl
bw-ui-1         |     self.engine.dialect.do_rollback(self.connection)
bw-ui-1         |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
bw-ui-1         |   File "/usr/share/bunkerweb/deps/python/sqlalchemy/engine/default.py", line 712, in do_rollback
bw-ui-1         |     dbapi_connection.rollback()
bw-ui-1         |     ~~~~~~~~~~~~~~~~~~~~~~~~~^^
bw-ui-1         |   File "/usr/share/bunkerweb/deps/python/pymysql/connections.py", line 505, in rollback
bw-ui-1         |     self._read_ok_packet()
bw-ui-1         |     ~~~~~~~~~~~~~~~~~~~~^^
bw-ui-1         |   File "/usr/share/bunkerweb/deps/python/pymysql/connections.py", line 465, in _read_ok_packet
bw-ui-1         |     pkt = self._read_packet()
bw-ui-1         |   File "/usr/share/bunkerweb/deps/python/pymysql/connections.py", line 751, in _read_packet
bw-ui-1         |     packet_header = self._read_bytes(4)
bw-ui-1         |   File "/usr/share/bunkerweb/deps/python/pymysql/connections.py", line 805, in _read_bytes
bw-ui-1         |     raise err.OperationalError(
bw-ui-1         |         CR.CR_SERVER_LOST, "Lost connection to MySQL server during query"
bw-ui-1         |     )
bw-ui-1         | sqlalchemy.exc.OperationalError: (pymysql.err.OperationalError) (2013, 'Lost connection to MySQL server during query')
bw-ui-1         | (Background on this error at: https://sqlalche.me/e/20/e3q8)
bw-ui-1         | [2026-02-06 17:10:42 +0700] [UI] [31] [ℹ️ ] - Worker exiting (pid: 31)
bw-ui-1         | [2026-02-06 17:10:42 +0700] [UI] [21] [❌] - Worker (pid:31) exited with code 3
bw-ui-1         | [2026-02-06 17:10:42 +0700] [UI] [30] [ℹ️ ] - Caught stop operation
bw-ui-1         | [2026-02-06 17:10:42 +0700] [UI] [30] [ℹ️ ] - Stopping web ui ...
bw-ui-1         | [2026-02-06 17:10:42 +0700] [UI] [39] [ℹ️ ] - Caught stop operation
bw-ui-1         | [2026-02-06 17:10:42 +0700] [UI] [32] [ℹ️ ] - Caught stop operation
bw-ui-1         | [2026-02-06 17:10:42 +0700] [UI] [41] [ℹ️ ] - Caught stop operation
bw-ui-1         | [2026-02-06 17:10:42 +0700] [UI] [33] [ℹ️ ] - Caught stop operation
bw-ui-1         | [2026-02-06 17:10:42 +0700] [UI] [39] [ℹ️ ] - Stopping web ui ...
bw-ui-1         | [2026-02-06 17:10:42 +0700] [UI] [41] [ℹ️ ] - Stopping web ui ...
bw-ui-1         | [2026-02-06 17:10:42 +0700] [UI] [32] [ℹ️ ] - Stopping web ui ...
bw-ui-1         | [2026-02-06 17:10:42 +0700] [UI] [33] [ℹ️ ] - Stopping web ui ...
bw-ui-1         | [2026-02-06 17:10:42 +0700] [UI] [35] [ℹ️ ] - Caught stop operation
bw-ui-1         | [2026-02-06 17:10:42 +0700] [UI] [37] [ℹ️ ] - Caught stop operation
bw-ui-1         | [2026-02-06 17:10:42 +0700] [UI] [37] [ℹ️ ] - Stopping web ui ...
bw-ui-1         | [2026-02-06 17:10:42 +0700] [UI] [35] [ℹ️ ] - Stopping web ui ...
bw-ui-1         | [2026-02-06 17:10:42 +0700] [UI] [34] [ℹ️ ] - Caught stop operation
bw-ui-1         | [2026-02-06 17:10:42 +0700] [UI] [36] [ℹ️ ] - Caught stop operation
bw-ui-1         | [2026-02-06 17:10:42 +0700] [UI] [34] [ℹ️ ] - Stopping web ui ...
bw-ui-1         | [2026-02-06 17:10:42 +0700] [UI] [36] [ℹ️ ] - Stopping web ui ...
bw-ui-1         | [2026-02-06 17:10:43 +0700] [UI] [38] [ℹ️ ] - Worker exiting (pid: 38)
bw-ui-1         | [2026-02-06 17:10:43 +0700] [UI] [42] [ℹ️ ] - Worker exiting (pid: 42)
bw-ui-1         | [2026-02-06 17:10:43 +0700] [UI] [40] [ℹ️ ] - Worker exiting (pid: 40)
bw-ui-1         | [2026-02-06 17:10:43 +0700] [UI] [43] [ℹ️ ] - Worker exiting (pid: 43)
bw-ui-1         | [2026-02-06 17:10:43 +0700] [UI] [44] [ℹ️ ] - Worker exiting (pid: 44)
bw-ui-1         | [2026-02-06 17:10:44 +0700] [UI] [21] [❌] - Shutting down: Master
bw-ui-1         | [2026-02-06 17:10:44 +0700] [UI] [21] [❌] - Reason: Worker failed to boot.
bw-ui-1         | [2026-02-06 17:10:45] - ENTRYPOINT - ℹ️ - Web UI stopped with exit code 3

BunkerWeb version

1.6.7

What integration are you using?

Docker

Linux distribution (if applicable)

AlmaLinux 9

Removed private data

  • I have removed all private data from the configuration file and the logs

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

Labels

help wantedExtra attention is needed

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions