Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unable to use AutoSetup with DatabaseShellsConfiguration #15665

Closed
weirdyang opened this issue Apr 5, 2024 · 1 comment
Closed

unable to use AutoSetup with DatabaseShellsConfiguration #15665

weirdyang opened this issue Apr 5, 2024 · 1 comment
Labels

Comments

@weirdyang
Copy link

weirdyang commented Apr 5, 2024

Describe the bug

When I enable AutoSetup and DatabaseShellsConfiguration, the container is unable to start.

To Reproduce

Steps to reproduce the behavior:

  1. Add both features in Startup.cs

image

  1. Run the container
  2. Navigate to the url to trigger the setup
  3. Check the logs
2024-04-05 19:28:36 { "timestamp": "2024-04-05 11:28:36.0032", "level": "WARN", "message": "Storing keys in a directory '\/root\/.aspnet\/DataProtection-Keys' that may not be persisted outside of the container. Protected data will be unavailable when container is destroyed.", "callSite": "Microsoft.Extensions.Logging.LoggingExtensions.UsingEphemeralFileSystemLocationInContainer" }
2024-04-05 19:28:36 { "timestamp": "2024-04-05 11:28:36.4200", "level": "WARN", "message": "No XML encryptor configured. Key {bb6be5ed-9e65-4b5f-8403-d38cab10db14} may be persisted to storage in unencrypted form.", "callSite": "Microsoft.Extensions.Logging.LoggingExtensions.NoXMLEncryptorConfiguredKeyMayBePersistedToStorageInUnencryptedForm" }
2024-04-05 19:28:36 { "timestamp": "2024-04-05 11:28:36.7576", "level": "INFO", "message": "Now listening on: http:\/\/[::]:80", "callSite": "Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync" }
2024-04-05 19:28:36 { "timestamp": "2024-04-05 11:28:36.7576", "level": "INFO", "message": "Now listening on: http:\/\/[::]:80", "callSite": "Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync" }
2024-04-05 19:28:36 { "timestamp": "2024-04-05 11:28:36.7576", "level": "INFO", "message": "Application started. Press Ctrl+C to shut down.", "callSite": "Microsoft.Extensions.Hosting.Internal.ConsoleLifetime.OnApplicationStarted" }
2024-04-05 19:28:36 { "timestamp": "2024-04-05 11:28:36.7576", "level": "INFO", "message": "Application started. Press Ctrl+C to shut down.", "callSite": "Microsoft.Extensions.Hosting.Internal.ConsoleLifetime.OnApplicationStarted" }
2024-04-05 19:28:36 { "timestamp": "2024-04-05 11:28:36.7663", "level": "INFO", "message": "Hosting environment: Production", "callSite": "Microsoft.Extensions.Hosting.Internal.ConsoleLifetime.OnApplicationStarted" }
2024-04-05 19:28:36 { "timestamp": "2024-04-05 11:28:36.7663", "level": "INFO", "message": "Hosting environment: Production", "callSite": "Microsoft.Extensions.Hosting.Internal.ConsoleLifetime.OnApplicationStarted" }
2024-04-05 19:28:36 { "timestamp": "2024-04-05 11:28:36.7663", "level": "INFO", "message": "Content root path: \/app", "callSite": "Microsoft.Extensions.Hosting.Internal.ConsoleLifetime.OnApplicationStarted" }
2024-04-05 19:28:36 { "timestamp": "2024-04-05 11:28:36.7663", "level": "INFO", "message": "Content root path: \/app", "callSite": "Microsoft.Extensions.Hosting.Internal.ConsoleLifetime.OnApplicationStarted" }
2024-04-05 19:30:18 { "timestamp": "2024-04-05 11:30:18.1390", "level": "INFO", "message": "Start creation of shells", "callSite": "OrchardCore.Environment.Shell.ShellHost.PreCreateAndRegisterShellsAsync" }
2024-04-05 19:30:19 { "timestamp": "2024-04-05 11:30:19.9092", "level": "ERROR", "message": "Connection id \"0HN2LCF2JD9GV\", Request id \"0HN2LCF2JD9GV:00000002\": An unhandled exception was thrown by the application.", "callSite": "Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ReportApplicationError" }
2024-04-06 05:41:49.4876|None|00-1f07678b321c97c02b01a248c5dbcb85-e6fea4625ecde3d2-00||Microsoft.AspNetCore.Server.Kestrel|ERROR|Connection id "0HN2LVH0D571G", Request id "0HN2LVH0D571G:00000002": An unhandled exception was thrown by the application. System.ArgumentException: Keyword not supported: 'mssql;database'.
   at Microsoft.Data.Common.DbConnectionOptions.ParseInternal(Dictionary`2 parsetable, String connectionString, Boolean buildChain, Dictionary`2 synonyms, Boolean firstKey)
   at Microsoft.Data.Common.DbConnectionOptions..ctor(String connectionString, Dictionary`2 synonyms)
   at Microsoft.Data.SqlClient.SqlConnectionString..ctor(String connectionString)
   at Microsoft.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous)
   at Microsoft.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions)
   at Microsoft.Data.SqlClient.SqlConnection.ConnectionString_Set(DbConnectionPoolKey key)
   at Microsoft.Data.SqlClient.SqlConnection.set_ConnectionString(String value)
   at YesSql.DbConnectionFactory`1.CreateConnection()
   at YesSql.Store.InitializeAsync()

Expected behavior

When I navigate the root address, a setup screen should be shown for a new instance, when I navigate to the auto setup path the auto set up should be triggered, and the site is usable.

I was able to get it to work if I do not include the ".AddDatabaseShellsConfiguration()" but I need to persist the data elsewhere as I require the containers to be stateless.

From my understanding, the AddDatabaseShellsConfiguration will show the setup page if it does not find any settings in the database.

my env variables

OrchardCore__OrchardCore_AutoSetup__Tenants__0__SiteTimeZone=Europe/Amsterdam
OrchardCore__OrchardCore_AutoSetup__Tenants__0__AdminUsername=admin22
OrchardCore__OrchardCore_AutoSetup__Tenants__0__AdminEmail=info@orchardproject.net
OrchardCore__OrchardCore_AutoSetup__Tenants__0__AdminPassword=P@ssword123
OrchardCore__OrchardCore_AutoSetup__Tenants__0__DatabaseProvider=SqlConnection
OrchardCore__OrchardCore_AutoSetup__Tenants__0__DatabaseConnectionString=Server=mssql;Database=master;User id=sa;Password=Pa55w0rd2020;
OrchardCore__OrchardCore_AutoSetup__Tenants__0__DatabaseTablePrefix=TEST_INSTANCE
OrchardCore__OrchardCore_AutoSetup__AutoSetupPath=/setup-site
OrchardCore__OrchardCore_Shells_Database__DatabaseProvider=SqlConnection
OrchardCore__OrchardCore_Shells_Database__ConnectionString=mssql;Database=master;User id=sa;Password=Pa55w0rd2020;
OrchardCore__OrchardCore_Shells_Database__TablePrefix=TEST_INSTANCE
OrchardCore__OrchardCore_Shells_Database__MigrateFromFiles=false

I have also tried removing the call to auto setup, but still get the same error.

            services
                .AddOrchardCms()
                .AddDatabaseShellsConfiguration();
@weirdyang
Copy link
Author

mistake in the config setup, sorry!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant