VibeNL / GhostfolioSidekick

A continuous running Docker container (a sidecar) to automatically import files from several brokers & crypto exchanges. And more.... See the readme.md for more information
MIT License
12 stars 4 forks source link

Cannot start docker container #129

Closed fraggom closed 7 months ago

fraggom commented 7 months ago

Hi everyone,

I am running into issues starting the docker container. It failed due to issues with the bind mounts and I couldn't find a solution. Logs say

Microsoft.Extensions.Hosting.Internal.Host Unhandled exception. System.UnauthorizedAccessException: Access to the path ... is denied.

My compose looks the following:

version: '3.9'
services:
  ghostfoliosidekick:
    image: vibenl/ghostfoliosidekick
    container_name: ghostfolio-sidekick
    networks:
      - ghostnet
    volumes:
      - /volume1/docker/ghostfoliosidekick/config:/gfsk/config
      - /volume1/docker/ghostfoliosidekick/import:/gfsk/import
    environment:
      GHOSTFOLIO_URL: ghostfolio-app:3333
      GHOSTFOLIO_ACCESTOKEN: abc
      FILEIMPORTER_PATH: /gfsk/import
      CONFIGURATIONFILE_PATH: /gfsk/config

networks:
  ghostnet:
    name: dockernet
    external: true

I was trying different destinations but always the same result. I was as well trying to start the container with user flags, but didn't work as well. Maybe you have an idea? thanks!

VibeNL commented 7 months ago

Your configuration seems fine, the only things I can think of are:

  1. Perhaps adding HTTPS:// before the url
  2. Double check the access token
  3. You can connect to the official ghostfolio instance and see if that works.

I have an integration test that tests to a live system, perhaps have a look at that for inspiration?

https://github.com/VibeNL/GhostfolioSidekick/blob/master/IntegrationTests/Run.cs

VibeNL commented 7 months ago

Next week I'll see if I can add some more helpful logging

fraggom commented 7 months ago

Thanks for the quick reply! So far, I am pretty sure this is a matter of file/folder permissions of the mounted folders.

Again, the logs:

"
2024/02/02 09:05:25,stderr,   at GhostfolioSidekick.Configuration.ApplicationSettings..ctor() in /src/Configuration/ApplicationSettings.cs:line 12

2024/02/02 09:05:25,stderr,"   at System.IO.File.ReadAllText(String path, Encoding encoding)
"
2024/02/02 09:05:25,stderr,"   at System.IO.StreamReader.ValidateArgsAndOpenPath(String path, Encoding encoding, Int32 bufferSize)
"
2024/02/02 09:05:25,stderr,"   at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
"
2024/02/02 09:05:25,stderr,"   at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, UnixFileMode openPermissions, Int64& fileLength, UnixFileMode& filePermissions, Boolean failForSymlink, Boolean& wasSymlink, Func`4 createOpenException)
"
2024/02/02 09:05:25,stderr,"   at Microsoft.Win32.SafeHandles.SafeFileHandle.Init(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Int64& fileLength, UnixFileMode& filePermissions)
"
2024/02/02 09:05:25,stderr,   --- End of inner exception stack trace ---

2024/02/02 09:05:25,stderr, ---> System.IO.IOException: Permission denied

2024/02/02 09:05:25,stderr,Unhandled exception. System.UnauthorizedAccessException: Access to the path '/app/gfsk/config' is denied.

the binds are mounted into the docker container with the respective owner flags of the host system. From what I see in the dockerhub, dotnet is running inside the container with a very specific uid:

ENV APP_UID=1654 ASPNETCORE_HTTP_PORTS=8080 DOTNET_RUNNING_IN_CONTAINER=true

Just a guess, since I am not an expert on this field, but I assume this could be the issue. I wonder no one else had this issue?!

VibeNL commented 7 months ago

I'm not a docker expert, but here is my config

ghostfoliosidekick: image: vibenl/ghostfoliosidekick:latest container_name: Ghostfolio-Ghostfoliosidekick hostname: ghostfoliosidekick security_opt:

fraggom commented 7 months ago

Thank you! :-) I found the issue. My problem was the configuration file path pointing at a folder instead of a file: So it was CONFIGURATIONFILE_PATH: /gfsk/config instead of CONFIGURATIONFILE_PATH: /gfsk/config/config.json

VibeNL commented 7 months ago

Your welcome 😁