Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Transition Docker to use s6 overlay #8886

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

stumpylog
Copy link
Member

Proposed change

This PR transitions to Docker image away from supervisord to use s6, as provided by s6-overlay.

What

s6 is a process supervision suite of tools, and s6-overlay is a nice implementation wrapping them up into useful settings for Docker use. It's the same set of tools used by the LinuxServer.io team for their base images.

The previous 2 bash scripts have been broken apart into distinct oneshot services handling a single thing, with dependencies as required. For the most part, start up ordering is identical, with some gains for doing a few init actions in parallel. I've included a flowchart in the folder of how the startup dependencies are setup.

Why

In the second paragraph of the supervisord documentation, it is noted to not be a proper replacement for PID 1. s6 is a proper PID 1 process supervision suite with some nice utilities for process control as well. It's good to have a proper PID 1 for signal handling, clean shutdowns and reaping zombies properly.

All the s6 services, oneshot or longrun can have dependencies defined between them, ensuring and enforcing a valid ordering of startup. This includes more correct handling of optional services like flower, which previously was kind of hacky and just allowed to exit, even if it should have started.

I'm sure this will break someone's workflow, but hopefully not too badly.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Other (please explain)

Checklist:

  • I have read & agree with the contributing guidelines.
  • If applicable, I have tested my code for new features & regressions on both mobile & desktop devices, using the latest version of major browsers.
  • If applicable, I have checked that all tests pass, see documentation.
  • I have run all pre-commit hooks, see documentation.
  • I have made corresponding changes to the documentation as needed.
  • I have checked my modifications for any breaking changes.

@github-actions github-actions bot added the enhancement New feature or enhancement label Jan 23, 2025
Copy link

codecov bot commented Jan 23, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.69%. Comparing base (fce7b03) to head (52bd92f).
Report is 1 commits behind head on dev.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev    #8886   +/-   ##
=======================================
  Coverage   97.69%   97.69%           
=======================================
  Files         494      494           
  Lines       21059    21059           
  Branches     1716     1716           
=======================================
  Hits        20574    20574           
+ Misses        485      482    -3     
- Partials        0        3    +3     
Flag Coverage Δ
backend 96.57% <ø> (ø)
frontend 98.93% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@shamoon
Copy link
Member

shamoon commented Jan 23, 2025

Cool stumpy, I've been looking at this branch of yours for a while, reading a little about it. I dont pretend to understand all of the benefits but certainly seems it could be helpful given the complexity of the project. Thanks for taking it on, dont know that I'll have much to add (huge diff!) when its ready but will of course test etc.

@stumpylog
Copy link
Member Author

Besides the technical stuff, it does feel like things start faster. Perhaps due to some parallel actions.

Ideally, everything in the original 2 scripts is mostly replicated into the smaller units. I think I captured every recent update to the startup, but that's good to double check me on.

@stumpylog
Copy link
Member Author

Some things to help guide testing I can think of:

  • Waiting for Redis/broker still working
  • Waiting for database working
    • Postgres
    • MariaDB
  • Language installation working
  • Custom initialization
  • Setting environment via files

There's probably more, but that's the main bulk of the startup sequence.

@stumpylog stumpylog added this to the Next Release milestone Jan 30, 2025
@stumpylog stumpylog marked this pull request as ready for review January 30, 2025 15:24
@stumpylog stumpylog requested review from a team as code owners January 30, 2025 15:24
@shamoon shamoon modified the milestones: v2.14.7, Next Feature Release Jan 31, 2025
@shamoon shamoon changed the title Feature s6 overlay Feature: s6 overlay Jan 31, 2025
@shamoon

This comment was marked as duplicate.

Copy link
Member

@shamoon shamoon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Managed to test all of these (and in general) and certainly seems all good to me!

  • ✅ Waiting for Redis/broker still working
    * 2025-02-01 23:09:41 Connected to Redis broker.
  • ✅ Waiting for database working
    • ✅ Postgres
      •  2025-02-01 22:51:32 Waiting for PostgreSQL to start...
         2025-02-01 22:51:45 Connected to PostgreSQL
        
    • ✅ MariaDB
      •  [init-db-wait] Waiting for MariaDB to report ready
         Connected to MariaDB
        
  • ✅ Language installation working
    * 2025-02-01 23:09:43 [init-tesseract-langs] Installed tesseract-ocr-tur
  • ✅ Custom initialization
    * 2025-02-01 23:37:35 [custom-init] custom-cont-init.d: executing... 2025-02-01 23:37:35 hello world
  • ✅ Setting environment via files
    * [env-init] PAPERLESS_APP_TITLE set from PAPERLESS_APP_TITLE_FILE

@stumpylog stumpylog changed the title Feature: s6 overlay Feature: Transition Docker to use s6 overlay Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or enhancement
Projects
Status: Reviewed
Development

Successfully merging this pull request may close these issues.

2 participants