anthonyraymond / joal

An open source command line RatioMaster with an optional WebUI.
Apache License 2.0
572 stars 63 forks source link

Error while installing with Docker Compose #231

Closed Eseltwift closed 3 months ago

Eseltwift commented 3 months ago

Hello ✋

I have just reinstalled one of my servers, and Joal at the same time. However, this time I can't get it to work.

I'm installing Joal via Docker Compose, from my joal-compose.yaml file:

name: joal

services:
  joal:
    container_name: joal
    image: anthonyraymond/joal
    environment:
      - TZ=${TIME_ZONE}
    ports:
      - 8585:8585
    volumes:
      - ${DOCKER_DIR}/joal:/data
    command: ["--joal-conf=/data", "--spring.main.web-environment=true", "--server.port=8585", "--joal.ui.path.prefix=aAzZTJGxqCP7HQD8MCwNQ25YyCVjCrQV", "--joal.ui.secret-token=aAzZTJGxqCP7HQD8MCwNQ25YyCVjCrQV", "--restart=unless>
    restart: unless-stopped

The container is installed, but I can't access the web interface via the address http://10.10.10.202:8585/aAzZTJGxqCP7HQD8MCwNQ25YyCVjCrQV/ui/

I should point out that my environment variables (TIME_ZONE, DOCKER_DIR) are working properly with my other Docker containers started from the same directory. I also have other similar services (with web interface accessible from a specific port) that work perfectly.

Here's what the command docker logs joal returns:

[INFO ] 2024-04-05 20:17:04.894 [           main] o.a.j.JackOfAllTradesApplication: Starting JackOfAllTradesApplication v2.1.36 using Java 11.0.13 on 5156b8f26973 with PID 1 (/joal/joal.jar started by root in /joal)
[INFO ] 2024-04-05 20:17:04.902 [           main] o.a.j.JackOfAllTradesApplication: No active profile set, falling back to 1 default profile: "default"
[INFO ] 2024-04-05 20:17:05.969 [           main] o.s.b.w.e.t.TomcatWebServer: Tomcat initialized with port(s): 8585 (http)
[INFO ] 2024-04-05 20:17:05.988 [           main] o.a.c.h.Http11NioProtocol: Initializing ProtocolHandler ["http-nio-8585"]
[INFO ] 2024-04-05 20:17:05.989 [           main] o.a.c.c.StandardService: Starting service [Tomcat]
[INFO ] 2024-04-05 20:17:05.991 [           main] o.a.c.c.StandardEngine: Starting Servlet engine: [Apache Tomcat/9.0.65]
[INFO ] 2024-04-05 20:17:06.064 [           main] o.a.c.c.C.[.[.[/]: Initializing Spring embedded WebApplicationContext
[INFO ] 2024-04-05 20:17:06.065 [           main] o.s.b.w.s.c.ServletWebServerApplicationContext: Root WebApplicationContext: initialization completed in 1114 ms
[WARN ] 2024-04-05 20:17:06.199 [           main] o.a.j.c.SeedManager: Sub-folder 'torrents' is missing in joal conf folder: [/data/torrents]
[WARN ] 2024-04-05 20:17:06.199 [           main] o.a.j.c.SeedManager: Sub-folder 'clients' is missing in joal conf folder: [/data/clients]
[ERROR] 2024-04-05 20:17:06.201 [           main] o.a.j.c.t.w.TorrentFileProvider: Folder [/data/torrents] does not exist
[WARN ] 2024-04-05 20:17:06.202 [           main] o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'applicationClosingListener' defined in URL [jar:file:/joal/joal.jar!/BOOT-INF/classes!/org/araymond/joal/ApplicationClosingListener.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'seedManager' defined in class path resource [org/araymond/joal/web/config/BeanConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.araymond.joal.core.SeedManager]: Factory method 'seedManager' threw exception; nested exception is java.io.FileNotFoundException: Torrent folder [/data/torrents] not found
[INFO ] 2024-04-05 20:17:06.204 [           main] o.a.c.c.StandardService: Stopping service [Tomcat]
[INFO ] 2024-04-05 20:17:06.216 [           main] o.s.b.a.l.ConditionEvaluationReportLoggingListener:

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
[ERROR] 2024-04-05 20:17:06.235 [           main] o.s.b.SpringApplication: Application run failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'applicationClosingListener' defined in URL [jar:file:/joal/joal.jar!/BOOT-INF/classes!/org/araymond/joal/ApplicationClosingListener.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'seedManager' defined in class path resource [org/araymond/joal/web/config/BeanConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.araymond.joal.core.SeedManager]: Factory method 'seedManager' threw exception; nested exception is java.io.FileNotFoundException: Torrent folder [/data/torrents] not found
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:800)
        at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:229)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1372)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1222)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:955)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583)
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147)
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:734)
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:308)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1295)
        at org.araymond.joal.JackOfAllTradesApplication.main(JackOfAllTradesApplication.java:15)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.base/java.lang.reflect.Method.invoke(Unknown Source)
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:108)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
        at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:65)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'seedManager' defined in class path resource [org/araymond/joal/web/config/BeanConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.araymond.joal.core.SeedManager]: Factory method 'seedManager' threw exception; nested exception is java.io.FileNotFoundException: Torrent folder [/data/torrents] not found
        at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:658)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:638)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
        at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1391)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311)
        at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:887)
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:791)
        ... 27 more
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.araymond.joal.core.SeedManager]: Factory method 'seedManager' threw exception; nested exception is java.io.FileNotFoundException: Torrent folder [/data/torrents] not found
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653)
        ... 41 more
Caused by: java.io.FileNotFoundException: Torrent folder [/data/torrents] not found
        at org.araymond.joal.core.torrent.watcher.TorrentFileProvider.<init>(TorrentFileProvider.java:53)
        at org.araymond.joal.core.SeedManager.<init>(SeedManager.java:72)
        at org.araymond.joal.web.config.BeanConfig.seedManager(BeanConfig.java:21)
        at org.araymond.joal.web.config.BeanConfig$$EnhancerBySpringCGLIB$$729af91d.CGLIB$seedManager$0(<generated>)
        at org.araymond.joal.web.config.BeanConfig$$EnhancerBySpringCGLIB$$729af91d$$FastClassBySpringCGLIB$$297d05d9.invoke(<generated>)
        at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
        at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331)
        at org.araymond.joal.web.config.BeanConfig$$EnhancerBySpringCGLIB$$729af91d.seedManager(<generated>)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.base/java.lang.reflect.Method.invoke(Unknown Source)
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
        ... 42 more

I've tried manually creating the /joal/data/torrents and /joal/data/clients directories, but this doesn't change anything (even with 777 permissions). The only change I've managed to get is that when I create torrents and clients directories directly in /joal (not in /joal/data), the logs indicate that /data/config.json is missing, but creating it doesn't solve the problem. Anyway, it seems to be going round in circles...

anthonyraymond commented 3 months ago

You forget step one of installation: https://github.com/anthonyraymond/joal?tab=readme-ov-file#1-setting-up-configuration

As you mentioned you need to put it in the /joal folder, not /joal/data

Eseltwift commented 3 months ago

Yep, that's a step I'd forgotten 😅 Thanks for your help!

Perhaps this could lead to an improvement: why not integrate the creation of these directories as part of the Docker image?