shlinkio / shlink

The definitive self-hosted URL shortener
https://shlink.io
MIT License
3.29k stars 262 forks source link

Permission Denied ERROR when ENABLE_PERIODIC_VISIT_LOCATE=true #1132

Closed saikarthikp9 closed 3 years ago

saikarthikp9 commented 3 years ago

How Shlink is set-up

Summary

Getting following error with the latest docker image when ENABLE_PERIODIC_VISIT_LOCATE is set to true.

Current behavior

Logs show this: ./docker-entrypoint.sh: line 39: can't create /etc/crontabs/root: Permission denied

Expected behavior

No error

How to reproduce

Use latest Docker image

acelaya commented 3 years ago

You are not using version 2.7, but latest, basically because that feature is not yet officially released 😅. It will be part of v2.8

The error you are getting is happening because of this https://github.com/shlinkio/shlink/pull/1108, that was merged recently.

I'll check if I can make the cron to be added to the new user, or otherwise roll that change back.

onedr0p commented 1 year ago

@acelaya you could use https://github.com/aptible/supercronic instead. It's even in the alpine pkg registry and can run as a user instead of root.

apk add --no-cache supercronic

then in your entrypoint

echo "$CRON_SCHEDULE /whatever.sh" > /tmp/crontab
supercronic -passthrough-logs /tmp/crontab &
acelaya commented 1 year ago

Cool. Do you want to contribute the change?