Closed janaxhell closed 11 months ago
I had the same issue. I can't confirm everything works as of right now, but it will build.
To fix:
In 'Dockerfile' change
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
to FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
and
FROM mcr.microsoft.com/dotnet/aspnet:7.0
to FROM mcr.microsoft.com/dotnet/aspnet:8.0
.
Right, thanks for pointing that out. I have updated the server to .NET 8 some days ago, but forgot to update that in the docker files.
Thank you, I was able to build with that fix, now off to compose!
It doesn't work:
2023-12-18T14:10:26.758444287Z Running in selfhosted mode, skipping AzureKeyVault configuration
2023-12-18T14:10:27.977414519Z warn: Microsoft.EntityFrameworkCore.Model.Validation[10400]
2023-12-18T14:10:27.977448259Z Sensitive data logging is enabled. Log entries and exception messages may include sensitive application data; this mode should only be enabled during development.
2023-12-18T14:10:28.147875431Z fail: Microsoft.EntityFrameworkCore.Database.Connection[20004]
2023-12-18T14:10:28.147897184Z An error occurred using the connection to database '' on server 'mariadb'.
2023-12-18T14:10:28.170998468Z Unhandled exception. System.InvalidOperationException: An exception has been raised that is likely due to a transient failure. Consider enabling transient error resiliency by adding 'EnableRetryOnFailure()' to the 'UseMySql' call.
2023-12-18T14:10:28.171026015Z ---> MySqlConnector.MySqlException (0x80004005): Unable to connect to any of the specified MySQL hosts.
2023-12-18T14:10:28.171032248Z at MySqlConnector.Core.ServerSession.ConnectAsync(ConnectionSettings cs, MySqlConnection connection, Int32 startTickCount, ILoadBalancer loadBalancer, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/Core/ServerSession.cs:line 433
2023-12-18T14:10:28.171036514Z at MySqlConnector.MySqlConnection.CreateSessionAsync(ConnectionPool pool, Int32 startTickCount, Nullable`1 ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlConnection.cs:line 926
2023-12-18T14:10:28.171040563Z at MySqlConnector.MySqlConnection.OpenAsync(Nullable`1 ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlConnection.cs:line 406
2023-12-18T14:10:28.171044708Z at MySqlConnector.MySqlConnection.Open() in /_/src/MySqlConnector/MySqlConnection.cs:line 369
2023-12-18T14:10:28.171048510Z at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenDbConnection(Boolean errorsExpected)
2023-12-18T14:10:28.171052343Z at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenInternal(Boolean errorsExpected)
2023-12-18T14:10:28.171056132Z at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.Open(Boolean errorsExpected)
2023-12-18T14:10:28.171060904Z at Pomelo.EntityFrameworkCore.MySql.Storage.Internal.MySqlRelationalConnection.Open(Boolean errorsExpected)
2023-12-18T14:10:28.171066023Z at Pomelo.EntityFrameworkCore.MySql.Storage.Internal.MySqlDatabaseCreator.<>c__DisplayClass18_0.<Exists>b__0(DateTime giveUp)
2023-12-18T14:10:28.171072530Z at Microsoft.EntityFrameworkCore.ExecutionStrategyExtensions.<>c__DisplayClass12_0`2.<Execute>b__0(DbContext c, TState s)
2023-12-18T14:10:28.171078461Z at Pomelo.EntityFrameworkCore.MySql.Storage.Internal.MySqlExecutionStrategy.Execute[TState,TResult](TState state, Func`3 operation, Func`3 verifySucceeded)
2023-12-18T14:10:28.171083923Z --- End of inner exception stack trace ---
2023-12-18T14:10:28.171090228Z at Pomelo.EntityFrameworkCore.MySql.Storage.Internal.MySqlExecutionStrategy.Execute[TState,TResult](TState state, Func`3 operation, Func`3 verifySucceeded)
2023-12-18T14:10:28.171094636Z at Microsoft.EntityFrameworkCore.ExecutionStrategyExtensions.Execute[TState,TResult](IExecutionStrategy strategy, TState state, Func`2 operation, Func`2 verifySucceeded)
2023-12-18T14:10:28.171113889Z at Microsoft.EntityFrameworkCore.ExecutionStrategyExtensions.Execute[TState,TResult](IExecutionStrategy strategy, TState state, Func`2 operation)
2023-12-18T14:10:28.171119115Z at Pomelo.EntityFrameworkCore.MySql.Storage.Internal.MySqlDatabaseCreator.Exists(Boolean retryOnNotExists)
2023-12-18T14:10:28.171123689Z at Pomelo.EntityFrameworkCore.MySql.Storage.Internal.MySqlDatabaseCreator.Exists()
2023-12-18T14:10:28.171128281Z at Microsoft.EntityFrameworkCore.Storage.RelationalDatabaseCreator.EnsureCreated()
2023-12-18T14:10:28.171132414Z at Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade.EnsureCreated()
2023-12-18T14:10:28.171137065Z at Program.<Main>$(String[] args) in /app/src/Presentation/Program.cs:line 51
2023-12-18T14:10:28.171142364Z at Program.<Main>(String[] args)
2023-12-18T14:10:29.133267704Z /var/lib/librum-server/srv/run.sh: line 4: 8 Aborted (core dumped) dotnet Presentation.dll
2023-12-18T14:10:32.036032690Z Running in selfhosted mode, skipping AzureKeyVault configuration
2023-12-18T14:10:32.841466570Z warn: Microsoft.EntityFrameworkCore.Model.Validation[10400]
2023-12-18T14:10:32.841486282Z Sensitive data logging is enabled. Log entries and exception messages may include sensitive application data; this mode should only be enabled during development.
2023-12-18T14:10:34.004751031Z warn: Microsoft.AspNetCore.DataProtection.Repositories.FileSystemXmlRepository[60]
2023-12-18T14:10:34.004810682Z 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. For more information go to https://aka.ms/aspnet/dataprotectionwarning
2023-12-18T14:10:34.272113844Z warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35]
2023-12-18T14:10:34.272134146Z No XML encryptor configured. Key {ae082f8b-1129-4b5f-af1c-a12d930d9fdb} may be persisted to storage in unencrypted form.
2023-12-18T14:10:34.387457646Z warn: Application.BackgroundServices.DeleteUnconfirmedUsers[0]
2023-12-18T14:10:34.387483907Z Deleting unconfirmed users
2023-12-18T14:10:34.465289044Z warn: Microsoft.AspNetCore.Server.Kestrel[0]
2023-12-18T14:10:34.465314445Z Overriding address(es) 'http://*:8080'. Binding to endpoints defined via IConfiguration and/or UseKestrel() instead.
2023-12-18T14:10:55.210230684Z warn: Microsoft.AspNetCore.HttpsPolicy.HttpsRedirectionMiddleware[3]
2023-12-18T14:10:55.210260546Z Failed to determine the https port for redirect.
and if I try to open the webgui I get
This 192.168.1.94 page can’t be found
No webpage was found for the web address: http://192.168.1.94:5678/
HTTP ERROR 404
This is my compose, omv1 is a network I've created that already works fine with other containers:
---
version: "3.8"
services:
librum:
image: librum
hostname: librum
container_name: librum
ports:
- 5678:5000
networks:
- omv1
volumes:
- /srv/dev-disk-by-uuid-2628F1C228F19153/data/media/books:/var/lib/librum-server/librum_storage
environment:
- JWTValidIssuer=exampleIssuer
- JWTKey=exampleOfALongSecretToken
- SMTPEndpoint=smtp.XXXXX.com
- SMTPUsername=XXXXXXXXXXXXXX
- SMTPPassword=XXXXXXXXXXXXX
- SMTPMailFrom=XXXXXXXXXXXXXXX
- DBConnectionString=Server=mariadb;port=3306;Database=librum;Uid=librum;Pwd=mariadb;
- AdminEmail=XXXXXXXXXXXXX
- AdminPassword=XXXXXXXXXXX
restart: unless-stopped
depends_on:
- librum_db
librum_db:
image: mariadb:latest
hostname: mariadb
container_name: librum_db
networks:
- omv1
volumes:
- /srv/dev-disk-by-uuid-5b67514d-485e-4306-873e-b1cbb54ccf99/Config/librum/librum_db:/var/lib/mysql
environment:
- MARIADB_USER=librum
- MARIADB_PASSWORD=mariadb
- MARIADB_DATABASE=librum
- MARIADB_ROOT_PASSWORD=mariadb
restart: unless-stopped
# networks:
# librum:
# name: "librum"
# networks:
# omv1:
networks:
omv1:
external: true
volumes:
librum:
name: "books"
librum_db:
name: "librum_db"
Also, what is JWT key in the compose? Should I use it? Comment it? What is it for?
According to the error, it failed when connecting to the database:
An error occurred using the connection to database '' on server 'mariadb'.
Apparently, it's not picking it up from the environment variable. Has it been changed in any way?
No, all you see is all I did: build image, adapt compose with what you see, deploy stack from Portainer. No ENV touched by me.
I'm asking about the project in general. Seeing as it has been updated to use a newer version of .NET without updating the Dockerfile, maybe the DBString was updated as well, causing the error.
According to the error, it failed when connecting to the database:
An error occurred using the connection to database '' on server 'mariadb'.
Apparently, it's not picking it up from the environment variable. Has it been changed in any way?
I don't think anything changed there.
I had the same issue, running the example docker-compose.yml
Same issue. Appeared after updating to the latest version. I tried toying with the env variables, different formatting and such but nothing solved it.
I checked the DB itself and it appears to be populated correctly. However, I cannot go any further in order to determine if the error message causes actual problems because of issue #20 .
mariadb -h 127.0.0.1 -u librum -pmariadb librum
MariaDB [librum]> show tables;
+------------------+
| Tables_in_librum |
+------------------+
| AspNetRoleClaims |
| AspNetRoles |
| AspNetUserClaims |
| AspNetUserLogins |
| AspNetUserRoles |
| AspNetUserTokens |
| AspNetUsers |
| Bookmarks |
| Books |
| Highlights |
| RectF |
| Tags |
+------------------+
12 rows in set (0.000 sec)
I sadly don't have a lot of experience with docker. @tralph3 @tbabej @3036662 might know more here since they have setup the docker stuff
I think this issue should be closed as the original one was resolved. The following database connection issue should be a separate issue anyway.
That being said, I don't think it's an actual issue. A fresh setup continues to give this error and I think it's a simple timing issue. The librum-server container initializes before the db container and shoots the error. Once the db container is up, librum-server continues as normal. I think a simple heartbeat on the db container should fix the problem.
I took a look at it after 10 months of not using it at all and the problem is still there. I have updated to the latest image, tried to stop and start the app after the db was running, but all I see is a repeating error:
Unhandled exception. MySqlConnector.MySqlException (0x80004005): Unknown column 'a.AccountLastDowngraded' in 'field list'
at MySqlConnector.Core.ServerSession.ReceiveReplyAsyncAwaited(ValueTask`1 task) in /_/src/MySqlConnector/Core/ServerSession.cs:line 954
at MySqlConnector.Core.ResultSet.ReadResultSetHeaderAsync(IOBehavior ioBehavior) in /_/src/MySqlConnector/Core/ResultSet.cs:line 44
at MySqlConnector.MySqlDataReader.ActivateResultSet(CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlDataReader.cs:line 127
at MySqlConnector.MySqlDataReader.CreateAsync(CommandListPosition commandListPosition, ICommandPayloadCreator payloadCreator, IDictionary`2 cachedProcedures, IMySqlCommand command, CommandBehavior behavior, Activity activity, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlDataReader.cs:line 456
at MySqlConnector.Core.CommandExecutor.ExecuteReaderAsync(IReadOnlyList`1 commands, ICommandPayloadCreator payloadCreator, CommandBehavior behavior, Activity activity, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/Core/CommandExecutor.cs:line 56
at MySqlConnector.MySqlCommand.ExecuteReaderAsync(CommandBehavior behavior, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlCommand.cs:line 330
at MySqlConnector.MySqlCommand.ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlCommand.cs:line 323
at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable`1.AsyncEnumerator.InitializeReaderAsync(AsyncEnumerator enumerator, CancellationToken cancellationToken)
at Pomelo.EntityFrameworkCore.MySql.Storage.Internal.MySqlExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 verifySucceeded, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Query.Internal.SingleQueryingEnumerable`1.AsyncEnumerator.MoveNextAsync()
at Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.SingleOrDefaultAsync[TSource](IAsyncEnumerable`1 asyncEnumerable, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.SingleOrDefaultAsync[TSource](IAsyncEnumerable`1 asyncEnumerable, CancellationToken cancellationToken)
at Microsoft.AspNetCore.Identity.UserManager`1.FindByEmailAsync(String email)
at Program.<<Main>$>g__SeedWithAdminUser|0_2(IServiceProvider services) in /app/src/Presentation/Program.cs:line 97
at Program.<Main>$(String[] args) in /app/src/Presentation/Program.cs:line 68
at Program.<Main>(String[] args)
/var/lib/librum-server/srv/run.sh: line 4: 8 Aborted (core dumped) dotnet Presentation.dll
I have never been able to see this application running a single time since I tried to deploy it last year.
I'm trying to deploy this on docker x86, I've cloned the git, but when I try to build, the operation fails:
What can I check?