docker-php icon indicating copy to clipboard operation
docker-php copied to clipboard

Custom s6 services dependencies no longer works

Open LorenzoRogai opened this issue 1 year ago • 10 comments

Steps To Reproduce

Image: 8.3-fpm-nginx-alpine

In the latest version i can no longer define custom s6 services depending on like 50-laravel-automations - it was working fine with the 2 months ago image

This is the copy definition inside the Dockerfile

# Copy s6 additional services
COPY --chmod=755 ./s6-overlay/s6-rc.d/ /etc/s6-overlay/s6-rc.d/

It seems that the folder "/etc/s6-overlay/s6-rc.d" no longer contains 50-laravel-automations etc files so when the container starts S6 gives a "50-laravel-automations dependency not found" error

How can i achieve the same flow on the latest build?

Outcome

What did you expect?

What happened instead?

Affected Docker Images

serversideup/php:8.3-fpm-nginx-alpine

Anything else?

No response

LorenzoRogai avatar Oct 22 '24 08:10 LorenzoRogai

I'm having similar issues this is the error I get on startuo

image

opheus2 avatar Oct 28 '24 16:10 opheus2

Crap. I never thought of people relying on the S6 dependency for their own scripts.

What changed

In this PR, we removed the complexity of the S6 overlay process and went complete with a "entrypoint.d" process. This means we did not need the s6-init script that we had before: https://github.com/serversideup/docker-php/pull/437/files#diff-504915b54cc60b1169bd08592a14a22dc540b50dae0f6c75ac9902a37cc2bcca

To update your scripts

Everything should work if you put it in entrypoint.d without the S6 hacks that we had to place in before: https://serversideup.net/open-source/docker-php/docs/customizing-the-image/adding-your-own-start-up-scripts

My question

Does this satisfy both of your needs? Or is your use case highly specific where it needs to be managed by S6?

jaydrogers avatar Oct 28 '24 17:10 jaydrogers

@jaydrogers I don’t think that it will work. I tried it initially, but since I need to start a long-running application (like amqproxy or pgbouncer), it doesn’t function properly with entrypoint.d scripts. It needs to be set up as an s6 service, similar to how nginx is configured

LorenzoRogai avatar Oct 28 '24 17:10 LorenzoRogai

Same issues after upgrading to the latest release.

[NOTICE]: S6 is not initialized. Skipping web server configuration and running custom command.

Is there an easy way to load S6 even when a command is specified?

dragonfly4 avatar Nov 07 '24 19:11 dragonfly4

Can you share your use case?

Right now, if you pass the CMD of composer install to the container, it will just run composer install.

Before it would run composer install and start NGINX with S6 Overlay (which is inefficient and lead to a weird UX).

jaydrogers avatar Nov 07 '24 19:11 jaydrogers

@jaydrogers I don’t think that it will work. I tried it initially, but since I need to start a long-running application (like amqproxy or pgbouncer), it doesn’t function properly with entrypoint.d scripts. It needs to be set up as an s6 service, similar to how nginx is configured

@LorenzoRogai: Have you attempted to write your own S6 service and add that to your image? https://github.com/just-containers/s6-overlay?tab=readme-ov-file#writing-a-service-script

Then we don't need to rely on this old script which was kind of a hack to take entrypoint.d files and put them in the S6 format https://github.com/serversideup/docker-php/blob/20ecec1d9668088200d3ef1cc9b80186935ccde2/src/s6/usr/local/bin/docker-php-serversideup-s6-init

jaydrogers avatar Nov 07 '24 19:11 jaydrogers

I added documentation on why you don't want to use entrypoint services to run long-running services: https://serversideup.net/open-source/docker-php/docs/customizing-the-image/adding-your-own-start-up-scripts#long-running-services

I am closing this for now, but please comment below if you have any further questions 👍

jaydrogers avatar Nov 07 '24 20:11 jaydrogers

@jaydrogers If I understand correctly, you were previously using s6 to launch "oneshot" commands, but you've since removed this, which is fine. As I mentioned in the original issue, I've already created a custom s6 service. However, it seems that the custom service can no longer find the 50-laravel-automation dependency because 50-laravel-automation is no longer an s6 "oneshot" command.

How can I maintain the same startup order now that 50-laravel-automation is no longer part of s6?

LorenzoRogai avatar Nov 07 '24 23:11 LorenzoRogai

Just letting you know that I am circling back to this. I think I am going to bring this script back.

Will keep you posted once I have more time to look at this 😃

jaydrogers avatar Nov 13 '24 21:11 jaydrogers

This will be fixed in v3.6 🥳 https://release-v3-6.serversideup-php.pages.dev/docs/customizing-the-image/adding-your-own-start-up-scripts#advanced-scenarios-s6-overlay-dependencies

Check this PR for latest status: https://github.com/serversideup/docker-php/pull/523

jaydrogers avatar Mar 06 '25 17:03 jaydrogers

Just adding an update this will be for sure fixed in v4.0 😃

You can test it below:

  • https://github.com/serversideup/docker-php/pull/283

jaydrogers avatar Oct 02 '25 16:10 jaydrogers

@jaydrogers we are starting to adopt the latest v3 for PHP 8.4 images. S6 scripts are working fine as before, thanks!

LorenzoRogai avatar Oct 22 '25 21:10 LorenzoRogai