Librum-Reader/Librum-Server

Self-hosting 404 Error

nickian opened this issue · 11 comments

I built and ran the docker image. When I visit the server in the browser, I get 404 error. Is this normal, is it waiting for more specific endpoints, or should there be a web UI?

Also, I should be able to login with the admin user/pass specified in the docker-compose.yml file, right? I'm getting an error.

I don't see any obvious errors on the Docker output (below).

I have the Flatpak installed, so I updated this file ~/.var/app/com.librumreader.librum/config/Librum-Reader to reflect my self-hosted server. But I get an error when trying to log in with the admin account.

Thanks

librum_db  | 2023-11-27 05:55:44+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:11.1.2+maria~ubu2204 started.
librum_db  | 2023-11-27 05:55:44+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
librum_db  | 2023-11-27 05:55:44+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:11.1.2+maria~ubu2204 started.
librum_db  | 2023-11-27 05:55:44+00:00 [Note] [Entrypoint]: MariaDB upgrade not required
librum_db  | 2023-11-27  5:55:44 0 [Note] Starting MariaDB 11.1.2-MariaDB-1:11.1.2+maria~ubu2204 source revision 9bc25d98209df6810f7a7d5e7dd3ae677a313ab5 as process 1
librum_db  | 2023-11-27  5:55:45 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
librum_db  | 2023-11-27  5:55:45 0 [Note] InnoDB: Using transactional memory
librum_db  | 2023-11-27  5:55:45 0 [Note] InnoDB: Number of transaction pools: 1
librum_db  | 2023-11-27  5:55:45 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
librum_db  | 2023-11-27  5:55:45 0 [Note] mariadbd: O_TMPFILE is not supported on /tmp (disabling future attempts)
librum_db  | 2023-11-27  5:55:45 0 [Note] InnoDB: Initializing buffer pool, total size = 128.000MiB, chunk size = 2.000MiB
librum_db  | 2023-11-27  5:55:45 0 [Note] InnoDB: Completed initialization of buffer pool
librum_db  | 2023-11-27  5:55:45 0 [Note] InnoDB: File system buffers for log disabled (block size=512 bytes)
librum_db  | 2023-11-27  5:55:45 0 [Note] InnoDB: End of log at LSN=145161
librum_db  | 2023-11-27  5:55:45 0 [Note] InnoDB: Opened 3 undo tablespaces
librum_db  | 2023-11-27  5:55:45 0 [Note] InnoDB: 128 rollback segments in 3 undo tablespaces are active.
librum_db  | 2023-11-27  5:55:45 0 [Note] InnoDB: Removed temporary tablespace data file: "./ibtmp1"
librum_db  | 2023-11-27  5:55:45 0 [Note] InnoDB: Setting file './ibtmp1' size to 12.000MiB. Physically writing the file full; Please wait ...
librum_db  | 2023-11-27  5:55:45 0 [Note] InnoDB: File './ibtmp1' size is now 12.000MiB.
librum_db  | 2023-11-27  5:55:45 0 [Note] InnoDB: log sequence number 145161; transaction id 191
librum_db  | 2023-11-27  5:55:45 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
librum_db  | 2023-11-27  5:55:45 0 [Note] Plugin 'FEEDBACK' is disabled.
librum_db  | 2023-11-27  5:55:45 0 [Note] Plugin 'wsrep-provider' is disabled.
librum_db  | 2023-11-27  5:55:45 0 [Note] Server socket created on IP: '0.0.0.0'.
librum_db  | 2023-11-27  5:55:45 0 [Note] Server socket created on IP: '::'.
librum_db  | 2023-11-27  5:55:45 0 [Note] InnoDB: Buffer pool(s) load completed at 231127  5:55:45
librum_db  | 2023-11-27  5:55:45 0 [Note] mariadbd: Event Scheduler: Loaded 0 events
librum_db  | 2023-11-27  5:55:45 0 [Note] mariadbd: ready for connections.
librum_db  | Version: '11.1.2-MariaDB-1:11.1.2+maria~ubu2204'  socket: '/run/mysqld/mysqld.sock'  port: 3306  mariadb.org binary distribution
librum     | Running in selfhosted mode, skipping AzureKeyVault configuration
librum     | warn: Microsoft.EntityFrameworkCore.Model.Validation[10400]
librum     |       Sensitive data logging is enabled. Log entries and exception messages may include sensitive application data; this mode should only be enabled during development.
librum     | warn: Microsoft.AspNetCore.DataProtection.Repositories.FileSystemXmlRepository[60]
librum     |       Storing keys in a directory '/var/lib/librum-server/.aspnet/DataProtection-Keys' that may not be persisted outside of the container. Protected data will be unavailable when container is destroyed.
librum     | warn: Application.BackgroundServices.DeleteUnconfirmedUsers[0]
librum     |       Deleting unconfirmed users
librum     | warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35]
librum     |       No XML encryptor configured. Key {64628198-69d8-4f91-8cc2-f8e01c10c941} may be persisted to storage in unencrypted form.
librum     | warn: Microsoft.AspNetCore.Server.Kestrel[0]
librum     |       Overriding address(es) 'http://+:80'. Binding to endpoints defined via IConfiguration and/or UseKestrel() instead.

Could you share the contents of your Librum.conf files here? There is no error in the output that you shared.

The only thing I changed in Librum.conf is updating the endpoint to https://mydomain.com and setting the self host variable to true. I also tried doing this in the Windows version in the registry editor.

I am now seeing this in the Docker output when I make a request to the server domain in my browser:

librum     | warn: Microsoft.AspNetCore.HttpsPolicy.HttpsRedirectionMiddleware[3]
librum     |       Failed to determine the https port for redirect.

I have an Nginx reverse proxy on this. Could it be something with this config?

server {
    listen 443 ssl;
    listen [::]:443 ssl;
    server_name librum.mydomain.com;

    ssl_certificate /etc/letsencrypt/live/mydomain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/mydomain.com/privkey.pem;
    
    include /etc/letsencrypt/options-ssl-nginx.conf;
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
    
    client_max_body_size 0;

    location / {
        proxy_pass http://localhost:5000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_read_timeout 60000s;
        proxy_set_header Host $http_host;
    }
}

server {
    listen      80;
    listen [::]:80;
    server_name librum.mydomain.com;
    return      301 https://$server_name$request_uri;
}

Sorry, I know to less about nginx to be able to help here.

tbabej commented

I suspect this is a setup problem, I run librum behind nginx reverse proxy and it works just fine. Don't see any obvious problems with the nginx config posted above, so more debugging is likely required. My Librum.conf contains the following:

[General]
selfHosted=true
serverHost=https://host.domain.com
theme=Dark

Does not appear to be an Nginx issue. I tried allowing port 5000 over my network, and just tried to access via IP (http://192.168.50.168:5000), same 404 error shows up.

What are you supposed to see in the browser when you visit the server URL?

You aren't supposed to see anything when visiting the URL in the browser. It is an API and has no web interface.

I wasn't expecting a web interface or anything. I just was more so wondering if you're supposed to see a 404 error or something different. A lot of APIs show a 200 status good message of some sort to indicate it's online.

send a GET request to /appInfo/health to get a 200

I'm experiencing the same issue. Trying to get this to run using docker.

This server is a rest api and not a browser application, thus getting a 404 is the correct behavior. #23 added a notice to avoid the 404 confusion.