davewalker5 / DroneFlightLog

SQLite-based drone flight logbook implemented in C# with separate REST API and ASP.NET MVC UI
MIT License
2 stars 1 forks source link

Docker: After creating the DB file via dotnet, adding user, uploading, results in blank browser window #15

Closed coreyandrews closed 6 months ago

coreyandrews commented 6 months ago

Hello,

I am using the following docker compose:

Running via Portainer Stack - on Debian Linux

version: "3.7" services: drone-ui: container_name: droneflightlogmvc image: davewalker5/droneflightlogmvc:latest restart: always ports:

After creating the DB file via the database instructions wiki and uploading it to the data folder, when I launch the website, I am prompted to log in. After logging in, it just shows a blank page with no text. It redirects to: http://10.0.0.50:8082/Flights/Add

Would you have any suggestions to why this is?

Cap 1 Cap2

@davewalker5

davewalker5 commented 6 months ago

Hi @coreyandrews - sorry you're having problems with it. I'll see if I can reproduce the problem and help after work today. I'm in the UK so that'll be about 17:30 UK time, to give you an idea. If I get any time before then, I'll try and take a look sooner

davewalker5 commented 6 months ago

Hi @coreyandrews

Had a look at this and based on the tests I've done the Docker Compose file is fine (assuming the database file is in the same folder as the docker compose file and you run "docker compose up" from that folder).

I think there's an issue with the database setup or the handling of a completely empty database by the app, though, that I'm looking at - I've got a stack trace that I can work through to find the error.

coreyandrews commented 6 months ago

Hi @davewalker5 , Okay sounds great!

My steps for the database were as follows:

Open Command Prompt in the folder DroneFlightLog.Manager, run "dotnet run", run "dotnet run -- update", run "dotnet run -- (username) (password)". I then copied the .db file to the data folder as listed in the docker compose. If you need me to record a quick video from beginning to end, let me know!

davewalker5 commented 6 months ago

Hi @coreyandrews

It's a bug in the UI when the database is completely empty. I've sorted a fix that I'll push hopefully this evening. I'll let you know once that's been pushed to Docker Hub then you'll need to pull the latest version of the UI container image and it should behave

davewalker5 commented 6 months ago

Hi @coreyandrews

New version of the UI's container image has been pushed to Docker Hub (v1.1.3.0) - if you delete your current copy from docker then do a "docker compose up" it should pull the new version that works with an empty database.

One thing to be aware if is regarding the volume mounts. It may not affect you as you said you're on linux. I've got a couple of Windows laptops and one works fine with the separate "volumes" section in the Docker Compose file, like the one you attached.

The other one didn't mount the folder if I specified the mount in that way (I'm still looking into why) and I had to specify it in-line in the service definition in docker compose (I had the compose file and DB in a temp folder, C:\Temp, for testing):

drone-api: container_name: droneflightlogservice image: davewalker5/droneflightlogapisqlite:latest restart: always ports:

This is a Docker config thing on my machine rather than an issue with the app but if you get an "invalid password" error when you try to log in it's worth checking this out.

coreyandrews commented 6 months ago

Hey @davewalker5 Okay, were working much better! Until we get to this point (URL)/FlightDetails/Index/1 , then we have a blank screen again :P

I can atleast create a plan, add all the data info. But after the flight plan is created, it redirects to the link above, and then blank page.

davewalker5 commented 6 months ago

Hi @coreyandrews - I'll take a look and get back to you

davewalker5 commented 6 months ago

Hi @coreyandrews

Identified the issue - the app lets you log arbitrary custom properties against flights. You set the core details for a flight on the "Log Flight" page then on hitting "Save" you're taken to the flight details page where you can add values for the custom properties, if you have any defined.

There was a bug that meant it fell over if there were no custom properties defined in the database.

I've fixed that and pushed version 1.1.4.0 of the UI container image - same scenario, delete the current UI container image from docker then "docker compose up" should pull the new one. If you log in and then browse to (URL)/FlightDetails/Index/1 you should see the flight details (though I'm assuming the "custom properties" section of the page will be empty as I'm guessing you don't have any defined).

coreyandrews commented 6 months ago

All good now! Thank you for making this logbook! It will be super useful for me :)

If in the future you are looking to work on the project a bit more, a small request would be to add a minimal maintenance log. Here in Canada, we need to keep track of maintenance done on the drone both during a flight session, and when not flying (like at home, if upgrading...).

coreyandrews commented 6 months ago

Hi @coreyandrews

Identified the issue - the app lets you log arbitrary custom properties against flights. You set the core details for a flight on the "Log Flight" page then on hitting "Save" you're taken to the flight details page where you can add values for the custom properties, if you have any defined.

There was a bug that meant it fell over if there were no custom properties defined in the database.

I've fixed that and pushed version 1.1.4.0 of the UI container image - same scenario, delete the current UI container image from docker then "docker compose up" should pull the new one. If you log in and then browse to (URL)/FlightDetails/Index/1 you should see the flight details (though I'm assuming the "custom properties" section of the page will be empty as I'm guessing you don't have any defined).

Oh, would the custom properties allow me to do matinenance notes if any were done on a flight?

davewalker5 commented 6 months ago

So I use them for tracking things like battery levels, number of landings and the weather conditions at the time of a flight:

Screenshot 2024-03-08 153853

They don't give you a huge amount of space to type in so might need something specific to be able to enter a maintenance log. I guess, too, the custom properties are associated with the flights rather than the drone where the maintenance log would need to be associated with a drone.

Can you point me in the direction of somewhere I can get the info on what you need to record?

coreyandrews commented 6 months ago

Actually, you could probably put it under Flight properties to be honest... Its quite basic:

Under CARs 901.48: These are the requirements we need to record for any flight.

Screenshot 2024-03-08 at 10 54 43 AM
davewalker5 commented 6 months ago

I'll look to put that in - be a useful addition

davewalker5 commented 6 months ago

Hi @coreyandrews

If you're interested, I've just released a new version of the Drone Flight Log that provides support for a maintenance log. It's fairly basic at the moment - plain text notes for the records and no rich text editing - but as far as I can see it supports the requirements in the screenshot you pasted on this issue.

If you want to upgrade to it, I've added a section "Upgrading to a New Release" to the Wiki that gives instructions and the release notes for the release are here:

https://github.com/davewalker5/DroneFlightLog/releases/tag/1.2.0.0

Note that it does require a database update so please back up your database before applying the update!

coreyandrews commented 6 months ago

Hi @coreyandrews

If you're interested, I've just released a new version of the Drone Flight Log that provides support for a maintenance log. It's fairly basic at the moment - plain text notes for the records and no rich text editing - but as far as I can see it supports the requirements in the screenshot you pasted on this issue.

If you want to upgrade to it, I've added a section "Upgrading to a New Release" to the Wiki that gives instructions and the release notes for the release are here:

https://github.com/davewalker5/DroneFlightLog/releases/tag/1.2.0.0

Note that it does require a database update so please back up your database before applying the update!

Oooh! Thank you for adding the maintenance log! I'm going to update now! :)

coreyandrews commented 6 months ago

@davewalker5

Getting the following error code at these links:

http://(URL)/MaintenanceRecords/Add http://(URL)/Maintainers

Error. An error occurred while processing your request.

Request ID: (HIDDEN) Development Mode

Swapping to Development environment will display more detailed information about the error that occurred.

The Development environment shouldn't be enabled for deployed applications. It can result in displaying sensitive information from exceptions to end users. For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development and restarting the app.

davewalker5 commented 6 months ago

@coreyandrews Can you pull the docker compose logs for the UI and API when you get the error? So run docker compose with the "-d" flag to return to the terminal once the containers are started, browse to the page giving the error and then run:

docker compose logs drone-api

And:

docker compose logs drone-ui

One or both of them should give a stack trace that should indicate where the problem is (not been able to reproduce it on my machine so far)

coreyandrews commented 6 months ago

@davewalker5 Okay, So I ended up starting from scratch and everything works fine now.

I was able to reproduce the same error above by going to maintainers (URL/Maintainers) and editing yourself. Don't change anything. Once saved, it should redirect to the development error.

coreyandrews commented 6 months ago

droneflightlogmvc | info: System.Net.Http.HttpClient.MaintainersClient.ClientHandler[101] droneflightlogmvc | Received HTTP response headers after 10.0157ms - 500 droneflightlogmvc | info: System.Net.Http.HttpClient.MaintainersClient.LogicalHandler[101] droneflightlogmvc | End processing HTTP request after 10.2276ms - 500 droneflightlogmvc | fail: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware[1] droneflightlogmvc | An unhandled exception has occurred while executing the request. droneflightlogmvc | System.ArgumentNullException: Value cannot be null. (Parameter 'value') droneflightlogmvc | at Newtonsoft.Json.Utilities.ValidationUtils.ArgumentNotNull(Object value, String parameterName) droneflightlogmvc | at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings) droneflightlogmvc | at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings) droneflightlogmvc | at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value) droneflightlogmvc | at DroneFlightLog.Mvc.Api.MaintainersClient.UpdateMaintainerAsync(Int32 id, String firstNames, String surname) in C:\OneDrive\Development\Projects\DroneFlightLog\DroneFlightLog.Mvc\Api\MaintainersClient.cs:line 96 droneflightlogmvc | at DroneFlightLog.Mvc.Controllers.MaintainersController.Edit(EditMaintainerViewModel model) in C:\OneDrive\Development\Projects\DroneFlightLog\DroneFlightLog.Mvc\Controllers\MaintainersController.cs:line 92 droneflightlogmvc | at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) droneflightlogmvc | at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.gAwaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask) droneflightlogmvc | at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) droneflightlogmvc | at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context) droneflightlogmvc | at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) droneflightlogmvc | at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.gAwaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) droneflightlogmvc | at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.gAwaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) droneflightlogmvc | at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context) droneflightlogmvc | at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) droneflightlogmvc | at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) droneflightlogmvc | at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.gAwaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope) droneflightlogmvc | at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.gAwaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope) droneflightlogmvc | at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) droneflightlogmvc | at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) droneflightlogmvc | at DroneFlightLog.Mvc.Startup.<>c.<b__5_1>d.MoveNext() in C:\OneDrive\Development\Projects\DroneFlightLog\DroneFlightLog.Mvc\Startup.cs:line 131 droneflightlogmvc | --- End of stack trace from previous location --- droneflightlogmvc | at DroneFlightLog.Mvc.Startup.<>c.<b5_0>d.MoveNext() in C:\OneDrive\Development\Projects\DroneFlightLog\DroneFlightLog.Mvc\Startup.cs:line 124 droneflightlogmvc | --- End of stack trace from previous location --- droneflightlogmvc | at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context) droneflightlogmvc | at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context) droneflightlogmvc | at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddlewareImpl.g__Awaited|10_0(ExceptionHandlerMiddlewareImpl middleware, HttpContext context, Task task)