acouvreur / sablier

Start your containers on demand, shut them down automatically when there's no activity. Docker, Docker Swarm Mode and Kubernetes compatible.
https://acouvreur.github.io/sablier/
GNU Affero General Public License v3.0
1.17k stars 44 forks source link

Blocking strategy does not fully start container while Dynamic is #240

Open BHMath opened 6 months ago

BHMath commented 6 months ago

Describe the bug When I configure the blocking strategy, my prowlarr container starts and then stop immediately while when dynamic strategy is configured, the container starts well and the login page appears.

Context

Expected behavior When blocking strategy is set I want my container to starts fully and reach login page when possible

Additional context Here the logs

Prowlarr logs when Blocking Strategy (it fails to start)

[migrations] started
[migrations] no migrations found
───────────────────────────────────────

      ██╗     ███████╗██╗ ██████╗ 
      ██║     ██╔════╝██║██╔═══██╗
      ██║     ███████╗██║██║   ██║
      ██║     ╚════██║██║██║   ██║
      ███████╗███████║██║╚██████╔╝
      ╚══════╝╚══════╝╚═╝ ╚═════╝ 

   Brought to you by linuxserver.io
───────────────────────────────────────

To support the app dev(s) visit:
Prowlarr: https://opencollective.com/prowlarr

To support LSIO projects visit:
https://www.linuxserver.io/donate/

───────────────────────────────────────
GID/UID
───────────────────────────────────────

User UID:    1001
User GID:    1001
───────────────────────────────────────

[custom-init] No custom files found, skipping...
[Info] Bootstrap: Starting Prowlarr - /app/prowlarr/bin/Prowlarr - Version 1.10.5.4116 
[Info] AppFolderInfo: Data directory is being overridden to [/config] 
[Debug] Bootstrap: Console selected 
[Info] AppFolderInfo: Data directory is being overridden to [/config] 
[Info] AppFolderInfo: Data directory is being overridden to [/config] 
[Info] MigrationController: *** Migrating data source=/config/prowlarr.db;cache size=-20000;datetimekind=Utc;journal mode=Wal;pooling=True;version=3;busytimeout=100 *** 
[Info] MigrationController: *** Migrating data source=/config/logs.db;cache size=-20000;datetimekind=Utc;journal mode=Wal;pooling=True;version=3;busytimeout=100 *** 
[Info] Microsoft.Hosting.Lifetime: Now listening on: http://[::]:9696 
[Info] CommandExecutor: Starting 3 threads for tasks. 
[ls.io-init] done.
[Info] Microsoft.Hosting.Lifetime: Application is shutting down... 
[Info] Microsoft.Hosting.Lifetime: Application started. Press Ctrl+C to shut down. 
[Info] Microsoft.Hosting.Lifetime: Hosting environment: Production 
[Info] Microsoft.Hosting.Lifetime: Content root path: /app/prowlarr/bin 
[Info] ConsoleApp: Exiting main. 

Sablier logs:

time="2023-12-20T14:50:11Z" level=error msg="Error #01: session was not ready after 1m0s\n" clientIP=172.18.0.1 dataLength=0 hostname=755b5a8871cb latency=61318 method=GET path=/api/strategies/blocking referer= statusCode=500 userAgent=Go-http-client/1.1

Router configuration

Router
[http.routers]
  [http.routers.prowlarr]
    rule = "Host(`prowlarr.domain.me`)"
    service = "prowlarr"
    entrypoints = ["websecure"] 
    middlewares = ["blocking-sablier@docker"]

Traefik plugin blocking configuration per label

- 'traefik.http.middlewares.blocking-sablier.plugin.sablier.names=prowlarr'
- 'traefik.http.middlewares.blocking-sablier.plugin.sablier.sablierUrl=http://172.17.0.1:10000' 
- 'traefik.http.middlewares.blocking-sablier.plugin.sablier.blocking.timeout=60s'
- 'traefik.http.middlewares.blocking-sablier.plugin.sablier.sessionDuration=10m'

Prowlarr logs when Dynamic Strategy (it works to start)

[migrations] started
[migrations] no migrations found
───────────────────────────────────────

      ██╗     ███████╗██╗ ██████╗ 
      ██║     ██╔════╝██║██╔═══██╗
      ██║     ███████╗██║██║   ██║
      ██║     ╚════██║██║██║   ██║
      ███████╗███████║██║╚██████╔╝
      ╚══════╝╚══════╝╚═╝ ╚═════╝ 

   Brought to you by linuxserver.io
───────────────────────────────────────

To support the app dev(s) visit:
Prowlarr: https://opencollective.com/prowlarr

To support LSIO projects visit:
https://www.linuxserver.io/donate/

───────────────────────────────────────
GID/UID
───────────────────────────────────────

User UID:    1001
User GID:    1001
───────────────────────────────────────

[custom-init] No custom files found, skipping...
[Info] Bootstrap: Starting Prowlarr - /app/prowlarr/bin/Prowlarr - Version 1.10.5.4116 
[Info] AppFolderInfo: Data directory is being overridden to [/config] 
[Debug] Bootstrap: Console selected 
[Info] AppFolderInfo: Data directory is being overridden to [/config] 
[Info] AppFolderInfo: Data directory is being overridden to [/config] 
[Info] MigrationController: *** Migrating data source=/config/prowlarr.db;cache size=-20000;datetimekind=Utc;journal mode=Wal;pooling=True;version=3;busytimeout=100 *** 
[Info] MigrationController: *** Migrating data source=/config/logs.db;cache size=-20000;datetimekind=Utc;journal mode=Wal;pooling=True;version=3;busytimeout=100 *** 
[Info] Microsoft.Hosting.Lifetime: Now listening on: http://[::]:9696 
[Info] CommandExecutor: Starting 3 threads for tasks. 
[ls.io-init] done.
[Info] Microsoft.Hosting.Lifetime: Application started. Press Ctrl+C to shut down. 
[Info] Microsoft.Hosting.Lifetime: Hosting environment: Production 
[Info] Microsoft.Hosting.Lifetime: Content root path: /app/prowlarr/bin 

Sablier logs:

time="2023-12-20T15:12:55Z" level=info msg="172.18.0.1 - c28679db5c6b [20/Dec/2023:15:12:55 +0000] \"GET /api/strategies/dynamic\" 200 4524 \"\" \"Go-http-client/1.1\" (1031ms)" clientIP=172.18.0.1 dataLength=4524 hostname=c28679db5c6b latency=1031 method=GET path=/api/strategies/dynamic referer= statusCode=200 userAgent=Go-http-client/1.1
time="2023-12-20T15:12:56Z" level=info msg="172.18.0.1 - c28679db5c6b [20/Dec/2023:15:12:56 +0000] \"GET /api/strategies/dynamic\" 200 4520 \"\" \"Go-http-client/1.1\" (21ms)" clientIP=172.18.0.1 dataLength=4520 hostname=c28679db5c6b latency=21 method=GET path=/api/strategies/dynamic referer= statusCode=200 userAgent=Go-http-client/1.1
time="2023-12-20T15:13:01Z" level=info msg="172.18.0.1 - c28679db5c6b [20/Dec/2023:15:13:01 +0000] \"GET /api/strategies/dynamic\" 200 4520 \"\" \"Go-http-client/1.1\" (29ms)" clientIP=172.18.0.1 dataLength=4520 hostname=c28679db5c6b latency=29 method=GET path=/api/strategies/dynamic referer= statusCode=200 userAgent=Go-http-client/1.1
time="2023-12-20T15:13:02Z" level=info msg="172.18.0.1 - c28679db5c6b [20/Dec/2023:15:13:02 +0000] \"GET /api/strategies/dynamic\" 200 4520 \"\" \"Go-http-client/1.1\" (1ms)" clientIP=172.18.0.1 dataLength=4520 hostname=c28679db5c6b latency=1 method=GET path=/api/strategies/dynamic referer= statusCode=200 userAgent=Go-http-client/1.1
time="2023-12-20T15:13:02Z" level=info msg="172.18.0.1 - c28679db5c6b [20/Dec/2023:15:13:02 +0000] \"GET /api/strategies/dynamic\" 200 4520 \"\" \"Go-http-client/1.1\" (1ms)" clientIP=172.18.0.1 dataLength=4520 hostname=c28679db5c6b latency=1 method=GET path=/api/strategies/dynamic referer= statusCode=200 userAgent=Go-http-client/1.1

Router configuration

Router
[http.routers]
  [http.routers.prowlarr]
    rule = "Host(`prowlarr.domain.me`)"
    service = "prowlarr"
    entrypoints = ["websecure"] 
    middlewares = ["dynamic-sablier@docker"]

Traefik plugin dynamic configuration per label

- 'traefik.http.middlewares.dynamic-sablier.plugin.sablier.names=prowlarr'
- 'traefik.http.middlewares.dynamic-sablier.plugin.sablier.sablierUrl=http://172.17.0.1:10000'   
- 'traefik.http.middlewares.dynamic-sablier.plugin.sablier.dynamic.displayName=Dynamic Sablier'
- 'traefik.http.middlewares.dynamic-sablier.plugin.sablier.dynamic.refreshFrequency=5s'
- 'traefik.http.middlewares.dynamic-sablier.plugin.sablier.dynamic.showDetails=true'
- 'traefik.http.middlewares.dynamic-sablier.plugin.sablier.dynamic.theme=hacker-terminal'
- 'traefik.http.middlewares.dynamic-sablier.plugin.sablier.sessionDuration=10m'
github-actions[bot] commented 5 months ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

BHMath commented 3 months ago

Actually, with the latest version it seems to be working now.

valankar commented 2 months ago

I'm seeing this issue with Caddy and another lsio container (Kavita). It seems to wait about 10 seconds, then the container is stopped and restarted in a loop.