I'm using automation (ansible) to deploy a dockerised app (gitea). The app runs s6 in its docker entrypoint.
I want to run my own script:
- after the container's first load (so the files and db are ready)
- at most once
OPTION 1:
I thought to add a script /etc/s6/custom/run
and place my stuff in there. But it would be restarted continuously, and there's no guarantee of order.
OPTION 2:
I read the docs for s6-svc
which show an -O
switch to run the service at most once. But I can't use that in an automated fashion, and also it may run before the other s6 services have run.
So I thought of this instead:
- add a
/etc/s6/custom/run
script - it checks whether the app is "ready"
- if no: it does nothing, and exits
- if yes: it does it's job, then creates a
/etc/s6/custom/down
file to signal that it should not be restarted
PROBLEM:
The problem is for the "no" case: until the container is running that custom script will be restarted many times.
Is it possible to delay restarting it, or, a better way entirely?