linuxserver / docker-bookstack

A Docker container for the BookStack documentation wiki
GNU General Public License v3.0
725 stars 105 forks source link

[BUG] "An Unknown Error Occurred" after login attempt #180

Closed jakarina closed 1 year ago

jakarina commented 1 year ago

Is there an existing issue for this?

Current Behavior

After completing docker installation, I am able to access to login page. After login attempt with initial admin email and password ("admin@admin.com" and "password"), I have a page with "an unknown error".

docker-compose.yml file:

---
version: "2"
services:
  bookstack:
    image: lscr.io/linuxserver/bookstack
    container_name: bookstack
    environment:
      - PUID=1000
      - PGID=1000
      - APP_URL=http://localhost:6875
      - DB_HOST=bookstack_db
      - DB_PORT=3306
      - DB_USER=bookstack
      - DB_PASS=123456789
      - DB_DATABASE=bookstackapp
    volumes:
      - ./bookstack_app_data:/config
    ports:
      - 6875:80
    restart: unless-stopped
    depends_on:
      - bookstack_db
  bookstack_db:
    image: lscr.io/linuxserver/mariadb
    container_name: bookstack_db
    environment:
      - PUID=1000
      - PGID=1000
      - MYSQL_ROOT_PASSWORD=123456789
      - TZ=Europe/London
      - MYSQL_DATABASE=bookstackapp
      - MYSQL_USER=bookstack
      - MYSQL_PASSWORD=123456789
    volumes:
      - ./bookstack_db_data:/config
    restart: unless-stopped

Expected Behavior

If I am to write wrong password on login page, it shows wrong password info. However, when I input the correct initial/default admin password, I get the following screen.

Screenshot

Ekran görüntüsü 2023-07-11 134916

Steps To Reproduce

1- Create a folder named "bookstack" 2- Open terminal and navigate to bookstack folder. 3- Create docker-compose.yml file with the given code above. 4- Run "docker-compose up -d" 5- Navigate to "http://localhost:6875" on the web browser. 6- Enter email and password

Environment

- OS: Windows 11 22H2
- How docker service was installed:

CPU architecture

x86-64

Docker creation

docker-compose up -d

Container logs

2023-07-11 12:48:39 [migrations] started
2023-07-11 12:48:39 [migrations] 01-nginx-site-confs-default: executing...
2023-07-11 12:48:39 [migrations] 01-nginx-site-confs-default: succeeded
2023-07-11 12:48:39 [migrations] 02-default-location: executing...
2023-07-11 12:48:40 [migrations] 02-default-location: succeeded
2023-07-11 12:48:40 [migrations] done
2023-07-11 12:48:40 ───────────────────────────────────────
2023-07-11 12:48:40 
2023-07-11 12:48:40       ██╗     ███████╗██╗ ██████╗ 
2023-07-11 12:48:40       ██║     ██╔════╝██║██╔═══██╗
2023-07-11 12:48:40       ██║     ███████╗██║██║   ██║
2023-07-11 12:48:40       ██║     ╚════██║██║██║   ██║
2023-07-11 12:48:40       ███████╗███████║██║╚██████╔╝
2023-07-11 12:48:40       ╚══════╝╚══════╝╚═╝ ╚═════╝ 
2023-07-11 12:48:40 
2023-07-11 12:48:40    Brought to you by linuxserver.io
2023-07-11 12:48:40 ───────────────────────────────────────
2023-07-11 12:48:40 
2023-07-11 12:48:40 To support LSIO projects visit:
2023-07-11 12:48:40 https://www.linuxserver.io/donate/
2023-07-11 12:48:40 
2023-07-11 12:48:40 ───────────────────────────────────────
2023-07-11 12:48:40 GID/UID
2023-07-11 12:48:40 ───────────────────────────────────────
2023-07-11 12:48:40 
2023-07-11 12:48:40 User UID:    1000
2023-07-11 12:48:40 User GID:    1000
2023-07-11 12:48:40 ───────────────────────────────────────
2023-07-11 12:48:40 
2023-07-11 12:48:40 Setting resolver to  127.0.0.11
2023-07-11 12:48:40 Setting worker_processes to 8
2023-07-11 12:48:40 generating self-signed keys in /config/keys, you can replace these with your own keys if required
2023-07-11 12:48:39 grep: /config/nginx/site-confs/default.conf: No such file or directory
2023-07-11 12:48:40 ......+..+...+....+...+..+..........+..+.+.................................+.....+..........+............+...............+...+++++++++++++++++++++++++++++++++++++++*.+..+............+.......+..................+...........+......+.+.........+...+............+++++++++++++++++++++++++++++++++++++++*.......+.+..............+.+..............+..........++++++
2023-07-11 12:48:40 .+......+........+.+.....+......+....+............+..+.+..+...+......+...+...+...+.+..............+++++++++++++++++++++++++++++++++++++++*....+.+......+...............+...+.....+......+++++++++++++++++++++++++++++++++++++++*...+.+...........+...+....+..+.+...+............+.....+...+....+..+.+..+............+....+.....+.........+.......+...............+...+......+.....+....+..+.+..+.+.....+.+..................+..........................+....+......+..............+..........+...............+...+.........+.....+...+..........+..+..........+.....+....+.....+....+..+......+...........................+......+....+...+...............+.....+...+....+...+.....+...+....+...+........+.........+...+....+........+.+......+.........+......++++++
2023-07-11 12:48:40 -----
2023-07-11 12:48:40 Generating BookStack app key for first run
2023-07-11 12:48:40 App Key set to base64:1CxzcGeum3gLJOt1wUSdnwW4ume6C71aXLNjgkElL9U= you can modify the file to update /config/BOOKSTACK_APP_KEY.txt
2023-07-11 12:48:40 Running config - DB_HOST set
2023-07-11 12:48:40 **** Insert DB_PORT='3306' into /config/www/.env ****
2023-07-11 12:48:40 **** APP_URL in /config/www/.env is being updated from https://example.com to http://localhost:6875 ****
2023-07-11 12:48:40 **** If this is an existing install, you should run the following line from your host terminal to update the database URL entries: ****
2023-07-11 12:48:40 ************************************************************************
2023-07-11 12:48:40 docker exec -it bookstack php /app/www/artisan bookstack:update-url https://example.com http://localhost:6875
2023-07-11 12:48:40 ************************************************************************
2023-07-11 12:48:40 Waiting for DB to be available
2023-07-11 12:48:54 
2023-07-11 12:48:54    INFO  Preparing database.  
2023-07-11 12:48:54 
2023-07-11 12:48:54   Creating migration table ......................................... 36ms DONE
2023-07-11 12:48:54 
2023-07-11 12:48:54    INFO  Running migrations.  
2023-07-11 12:48:54 
2023-07-11 12:48:55   2014_10_12_000000_create_users_table ............................ 155ms DONE
2023-07-11 12:48:55   2014_10_12_100000_create_password_resets_table .................. 149ms DONE
2023-07-11 12:48:55   2015_07_12_114933_create_books_table ............................. 32ms DONE
2023-07-11 12:48:55   2015_07_12_190027_create_pages_table ............................. 30ms DONE
2023-07-11 12:48:55   2015_07_13_172121_create_images_table ............................ 30ms DONE
2023-07-11 12:48:55   2015_07_27_172342_create_chapters_table .......................... 33ms DONE
2023-07-11 12:48:55   2015_08_08_200447_add_users_to_entities ......................... 214ms DONE
2023-07-11 12:48:55   2015_08_09_093534_create_page_revisions_table .................... 29ms DONE
2023-07-11 12:48:55   2015_08_16_142133_create_activities_table ........................ 29ms DONE
2023-07-11 12:48:56   2015_08_29_105422_add_roles_and_permissions ..................... 976ms DONE
2023-07-11 12:48:56   2015_08_30_125859_create_settings_table .......................... 94ms DONE
2023-07-11 12:48:56   2015_08_31_175240_add_search_indexes .............................. 0ms DONE
2023-07-11 12:48:56   2015_09_04_165821_create_social_accounts_table .................. 157ms DONE
2023-07-11 12:48:57   2015_09_05_164707_add_email_confirmation_table .................. 179ms DONE
2023-07-11 12:48:57   2015_11_21_145609_create_views_table ............................. 31ms DONE
2023-07-11 12:48:58   2015_11_26_221857_add_entity_indexes .......................... 1,048ms DONE
2023-07-11 12:48:58   2015_12_05_145049_fulltext_weighting .............................. 0ms DONE
2023-07-11 12:48:58   2015_12_07_195238_add_image_upload_types ........................ 122ms DONE
2023-07-11 12:48:58   2015_12_09_195748_add_user_avatars ............................... 40ms DONE
2023-07-11 12:48:58   2016_01_11_210908_add_external_auth_to_users .................... 127ms DONE
2023-07-11 12:48:58   2016_02_25_184030_add_slug_to_revisions ......................... 156ms DONE
2023-07-11 12:48:58   2016_02_27_120329_update_permissions_and_roles .................. 219ms DONE
2023-07-11 12:48:59   2016_02_28_084200_add_entity_access_controls .................... 561ms DONE
2023-07-11 12:48:59   2016_03_09_203143_add_page_revision_types ....................... 108ms DONE
2023-07-11 12:48:59   2016_03_13_082138_add_page_drafts ............................... 129ms DONE
2023-07-11 12:48:59   2016_03_25_123157_add_markdown_support ........................... 89ms DONE
2023-07-11 12:48:59   2016_04_09_100730_add_view_permissions_to_roles .................. 62ms DONE
2023-07-11 12:49:00   2016_04_20_192649_create_joint_permissions_table ................ 587ms DONE
2023-07-11 12:49:00   2016_05_06_185215_create_tags_table ............................. 264ms DONE
2023-07-11 12:49:00   2016_07_07_181521_add_summary_to_page_revisions .................. 40ms DONE
2023-07-11 12:49:00   2016_09_29_101449_remove_hidden_roles ........................... 147ms DONE
2023-07-11 12:49:01   2016_10_09_142037_create_attachments_table ...................... 118ms DONE
2023-07-11 12:49:01   2017_01_21_163556_create_cache_table ............................. 89ms DONE
2023-07-11 12:49:01   2017_01_21_163602_create_sessions_table .......................... 98ms DONE
2023-07-11 12:49:01   2017_03_19_091553_create_search_index_table ..................... 393ms DONE
2023-07-11 12:49:01   2017_04_20_185112_add_revision_counts ........................... 167ms DONE
2023-07-11 12:49:01   2017_07_02_152834_update_db_encoding_to_ut8mb4 .................... 0ms DONE
2023-07-11 12:49:01   2017_08_01_130541_create_comments_table ......................... 158ms DONE
2023-07-11 12:49:01   2017_08_29_102650_add_cover_image_display ........................ 28ms DONE
2023-07-11 12:49:02   2018_07_15_173514_add_role_external_auth_id ..................... 108ms DONE
2023-07-11 12:49:03   2018_08_04_115700_create_bookshelves_table ...................... 962ms DONE
2023-07-11 12:49:03   2019_07_07_112515_add_template_support .......................... 305ms FAIL
2023-07-11 12:49:03 
2023-07-11 12:49:03    Illuminate\Database\QueryException 
2023-07-11 12:49:03 
2023-07-11 12:49:03   SQLSTATE[HY000] [2002] Connection refused (SQL: alter table `pages` add index `pages_template_index`(`template`))
2023-07-11 12:49:03 
2023-07-11 12:49:03   at /app/www/vendor/laravel/framework/src/Illuminate/Database/Connection.php:760
2023-07-11 12:49:03     756▕         // If an exception occurs when attempting to run a query, we'll format the error
2023-07-11 12:49:03     757▕         // message to include the bindings with SQL, which will make this exception a
2023-07-11 12:49:03     758▕         // lot more helpful to the developer instead of just the database's errors.
2023-07-11 12:49:03     759▕         catch (Exception $e) {
2023-07-11 12:49:03   ➜ 760▕             throw new QueryException(
2023-07-11 12:49:03     761▕                 $query, $this->prepareBindings($bindings), $e
2023-07-11 12:49:03     762▕             );
2023-07-11 12:49:03     763▕         }
2023-07-11 12:49:03     764▕     }
2023-07-11 12:49:03 
2023-07-11 12:49:03       +18 vendor frames 
2023-07-11 12:49:03   19  /app/www/database/migrations/2019_07_07_112515_add_template_support.php:17
2023-07-11 12:49:03       Illuminate\Support\Facades\Facade::__callStatic()
2023-07-11 12:49:03 
2023-07-11 12:49:03       +25 vendor frames 
2023-07-11 12:49:03   45  /app/www/artisan:35
2023-07-11 12:49:03       Illuminate\Foundation\Console\Kernel::handle()
2023-07-11 12:49:03 [custom-init] No custom files found, skipping...
2023-07-11 12:49:03 [ls.io-init] done.
github-actions[bot] commented 1 year ago

Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid.

ssddanbrown commented 1 year ago

Likely the same kind of scenario as #125 since you're on windows.

jakarina commented 1 year ago

Likely the same kind of scenario as #125 since you're on windows.

@ssddanbrown you are right. I've resolved the issue by inspiring some stuff from #125.

This is definitely an issue with Windows + WSL2 (Windows Subsystem for Linux).

I changed the path-to-data from ./bookstack_app_data:/config to bookstack_app_data:/config and also ./bookstack_db_data:/config to bookstack_db_data:/config

very end of the yml file also added:

volumes:
  bookstackdata:
  bookstackdbdata:

By doing this, docker-compose created the volume inside WSL filesystem not in the windows current folder. To ease up the solution for people, I also added final version of docker-compose.yml below:

---
version: "2"
services:
  bookstack:
    image: lscr.io/linuxserver/bookstack
    container_name: bookstack
    environment:
      - PUID=1000
      - PGID=1000
      - APP_URL=http://localhost:6875
      - DB_HOST=bookstack_db
      - DB_PORT=3306
      - DB_USER=bookstack
      - DB_PASS=123456789
      - DB_DATABASE=bookstackapp
    volumes:
      - bookstack_app_data:/config
    ports:
      - 6875:80
    restart: unless-stopped
    depends_on:
      - bookstack_db
  bookstack_db:
    image: lscr.io/linuxserver/mariadb
    container_name: bookstack_db
    environment:
      - PUID=1000
      - PGID=1000
      - MYSQL_ROOT_PASSWORD=123456789
      - TZ=Europe/London
      - MYSQL_DATABASE=bookstackapp
      - MYSQL_USER=bookstack
      - MYSQL_PASSWORD=123456789
    volumes:
      - bookstack_db_data:/config
    restart: unless-stopped
volumes:
  bookstackdata:
  bookstackdbdata:

@ssddanbrown thanks for your help.