noel
04/22/2024, 12:31 PMdotnet publish --os linux
.
Before running the service i started the web with dotnet build and synchornized some files so it installation would match my lcoal dev. That said, with dotnet build
Umbraco worked perfectly fine - frontend, backend, file handling all went well.
But with the service running the backend doesn't seem to work anymore. The browser is trying to fetch files like https://mydomain.com/umbraco/login/login.iife.js but the kestrel server just returns a 404. Nothing obvious is logged.
I didn't find anything similiar yet - has anyone an idea what might be the cause / solution to the cause?
This is my .service file:
[Unit]
Description=Noels umbraco CMS web
Wants=network.target
After=network.target
[Service]
WorkingDirectory=/var/www/html/myWebProject/
ExecStart=/usr/bin/dotnet /var/www/html/myWebProject/bin/Release/net8.0/linux-x64/publish/myWebProject.dll
SyslogIdentifier=NCSumbraco
User=root
Restart=always
RestartSec=5
KillSignal=SIGINT
Environment=ASPNETCORE_ENVIRONMENT=Production
Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false
Environment=ASPNETCORE_URLS=https://*:44332
[Install]
WantedBy=multi-user.target
Thanks!kdx-perbol
04/22/2024, 4:28 PMASPNETCORE_ENVIRONMENT=Production
means only appSettings.json
and appsettings.Production.json
would be read. Nothing important in appSettings.Development.json
by mistake?kdx-perbol
04/22/2024, 4:29 PMwwwroot
) do you still get a 404?noel
04/22/2024, 7:07 PM/css/layout.css
) file in wwwroot
rasmusjp
04/23/2024, 7:26 AMdotnet publish
the output directory (in this case bin/Release/net8.0/linux-x64/publish
) will contain everything you need to run the app, so this is the only directory you need to deploy to your server. Then in the systemd service the working directory should be updated to be the publish folder and you should be able to simplify ExecStart
to dotnet myWebProject.dll
.noel
04/23/2024, 3:34 PM[Service]
WorkingDirectory=/var/www/html/myWebProject/bin/Release/net8.0/linux-x64/publish
ExecStart=dotnet myWebProject.dll
Should my web point directly to the publish
dir instead of myWebProject
?
This is the "stack trace" after it crashing (called via journalctl -u umbraco
)
Started umbraco.service - umbraco CMS web.
Apr 23 15:24:54 debian umbraco[246178]: Unhandled exception. System.IO.DirectoryNotFoundException: /var/www/html/myWebProject/bin/Release/net8.0/linux-x64/publish/wwwroot/media/
Apr 23 15:24:54 debian umbraco[246178]: at Microsoft.Extensions.FileProviders.PhysicalFileProvider..ctor(String root, ExclusionFilters filters)
Apr 23 15:24:54 debian umbraco[246178]: at Umbraco.Cms.Core.IO.PhysicalFileSystem.Create()
Apr 23 15:24:54 debian umbraco[246178]: at Umbraco.Extensions.FileSystemExtensions.TryCreateFileProvider(IFileSystem fileSystem, IFileProvider& fileProvider)
Apr 23 15:24:54 debian umbraco[246178]: at Umbraco.Cms.Core.IO.ShadowWrapper.Create()
Apr 23 15:24:54 debian umbraco[246178]: at Umbraco.Extensions.FileSystemExtensions.TryCreateFileProvider(IFileSystem fileSystem, IFileProvider& fileProvider)
Apr 23 15:24:54 debian umbraco[246178]: at Umbraco.Extensions.ApplicationBuilderExtensions.UseUmbracoMediaFileProvider(IApplicationBuilder app)
Apr 23 15:24:54 debian umbraco[246178]: at Umbraco.Cms.Web.Common.ApplicationBuilder.UmbracoApplicationBuilder.RegisterDefaultRequiredMiddleware()
Apr 23 15:24:54 debian umbraco[246178]: at Umbraco.Cms.Web.Common.ApplicationBuilder.UmbracoApplicationBuilder.WithMiddleware(Action`1 configureUmbracoMiddleware)
Apr 23 15:24:54 debian umbraco[246178]: at Program.<Main>$(String[] args) in /var/www/html/myWebProject/Program.cs:line 15
Apr 23 15:24:54 debian umbraco[246178]: at Program.<Main>(String[] args)
Had to remove [systemd] trace because of character limit.rasmusjp
04/23/2024, 3:50 PMpublish/wwwroot/media
directory is missing, what happens if you create it manually?noel
04/23/2024, 9:54 PMBoot Failed Umbraco failed to boot, if you are the owner of the website please see the log file for more details.
but neither the Umbraco nor the service log contain any helpful information (at least for me).
I'll adjust the log settings tomorrow and follow up if i found something useful.
https://cdn.discordapp.com/attachments/1231945368112201748/1232449656882073690/umbracoLog_notVerbose.json?ex=66297fb0&is=66282e30&hm=dd18f125d8c157905afd77f2890ff378ebe71712535965433b8c873b8ad2836c&huwred
04/24/2024, 5:53 AMDan
04/24/2024, 7:59 AMnoel
04/24/2024, 7:48 PMJSON
{
"@t": "2024-04-24T19:27:39.6112680Z",
"@mt": "Configured database is reporting as not being available.",
"@l": "Warning",
"@x": "Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 14: 'unable to open database file'.\n at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)\n at Microsoft.Data.Sqlite.SqliteConnectionInternal..ctor(SqliteConnectionStringBuilder connectionOptions, SqliteConnectionPool pool)\n at Microsoft.Data.Sqlite.SqliteConnectionPool.GetConnection()\n at Microsoft.Data.Sqlite.SqliteConnectionFactory.GetConnection(SqliteConnection outerConnection)\n at Microsoft.Data.Sqlite.SqliteConnection.Open()\n at Umbraco.Extensions.DbConnectionExtensions.IsAvailable(IDbConnection connection)",
"SourceContext": "object",
"ProcessId": 268939,
"ProcessName": "dotnet",
"ThreadId": 1,
"ApplicationId": "50200c2e81ad54bc53fb151e21469ccb6cb77a58",
"MachineName": "debian",
"Log4NetLevel": "WARN "
}
{
"@t": "2024-04-24T19:27:39.6176903Z",
"@mt": "Could not immediately connect to database, trying again.",
"@l": "Debug",
"SourceContext": "Umbraco.Cms.Infrastructure.Runtime.RuntimeState",
"ProcessId": 268939,
"ProcessName": "dotnet",
"ThreadId": 1,
"ApplicationId": "50200c2e81ad54bc53fb151e21469ccb6cb77a58",
"MachineName": "debian",
"Log4NetLevel": "DEBUG"
}
I'm not sure why but the sqlite database file was missing in the publish/umbraco/Data
dir.
After a quick minor update and copying the sqlite file to the dir it seems to work just fine - at least for now ^^
Thank you guys!Sebastiaan
04/25/2024, 7:01 AMkdx-perbol
04/25/2024, 8:03 AMSebastiaan
04/25/2024, 8:12 AMApp_Data
is special?