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

Enhancement: make run.sh customizable

Open grhangelone opened this issue 4 years ago • 3 comments

Hi there, I really like this project, thanks for everything :) I have 3 containers running as service in my docker cluster and they work perfectly. You just have to have a nfs volume on all nodes to store the bind mounts on.

like: docker service create --name lamp_nextcloud -p "84:80"
--mount type=bind,source=/mnt/nfs/lamp_nextcloud/app,destination=/app
--mount type=bind,source=/mnt/nfs/lamp_nextcloud/mysql,destination=/var/lib/mysql
mattrayner/lamp:latest

the /mnt/nfs directoy is a mounted nfs share from my fileserver

Now to my request: I do have 1 web container, where I would like to have cron running and a crontab for root in place. Currently I do have to set this up manually on every container restart.

/edit better way

At the end of the supplied run.sh as it currently is do a

[ -x /run/execute.sh ] && /run/execute.sh

This way we can bindmount our /run "startup folder" and add commands for the container start

In my case this would be an echo into the crontab file and a cron service start

grhangelone avatar Nov 22 '20 08:11 grhangelone

This is a really good idea, I would want to keep run.sh stand-alone with a check and run for a /run/customisation.sh script or something like that

That way as we update the image and run file the user wouldn’t have to keep changing their script

Do you fancy make a PR for this? If not I can try and take a look at some point 😂

On Sun, 22 Nov 2020 at 08:44, grhangelone [email protected] wrote:

Hi there, I really like this project, thanks for everything :) I have 3 containers running as service in my docker cluster and they work perfectly. You just have to have a nfs volume on all nodes to store the bind mounts on.

like: docker service create --name lamp_nextcloud -p "84:80" --mount type=bind,source=/mnt/nfs/lamp_nextcloud/app,destination=/app --mount type=bind,source=/mnt/nfs/lamp_nextcloud/mysql,destination=/var/lib/mysql mattrayner/lamp:latest

the /mnt/nfs directoy is a mounted nfs share from my fileserver

Now to my request: I do have 1 web container, where I would like to have cron running and a crontab for root in place. Currently I do have to set this up manually on every container restart.

I would be perfect, if we could edit the run.sh and make it persistent. I'm thinking of:

  • create a folder /run
  • rename the current /run.sh to /run.supplied
  • check if there is a run.sh in the /run folder
  • if not, copy the /run.supplied to /run/run.sh
  • execute /run/run.sh

This way, we can bindmount the /run folder in our containers and have our own run.sh in place. In my case this would be the same as the supplied but with an echo into the crontab file and a cron service start

Or: At the end of the supplied run.sh as it currently is do a

[ -x /run/execute.sh ] && /run/execute.sh

This way we can still bindmount our "startup folder" and add commands for the container start

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mattrayner/docker-lamp/issues/112, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA2XGNQQSD6AHNPY3QJAKHTSRDFN7ANCNFSM4T6KZVOA .

-- Matt Rayner http://www.mattrayner.co.uk/

mattrayner avatar Nov 22 '20 09:11 mattrayner

I would love to, but I'm not sure how to do this :) I first have to read up how pull requests and all that Github stuff works

grhangelone avatar Nov 22 '20 14:11 grhangelone

Hi Matt, did you have time to look into this?

grhangelone avatar Jan 14 '21 10:01 grhangelone