zipkin-dependencies icon indicating copy to clipboard operation
zipkin-dependencies copied to clipboard

It seems like crond doesn't work

Open SlavaUtesinov opened this issue 3 years ago • 9 comments

When I start following command there is effect - zipkin-dependency-yyyy-mm-dd index at elasticsearch appears for a current day:

docker run -d --env STORAGE_TYPE=elasticsearch --env ES_HOSTS=elastichost --env ES_NODES_WAN_ONLY=true openzipkin/zipkin-dependencies

but when I start this command (based on your example) there is no any effect at all even if I waiting for a long time:

docker run -d --env STORAGE_TYPE=elasticsearch --env ES_HOSTS=elastichost --env ES_NODES_WAN_ONLY=true --entrypoint /usr/sbin/crond openzipkin/zipkin-dependencies -f

SlavaUtesinov avatar Feb 19 '21 05:02 SlavaUtesinov

Looks like this is probably because the hourly/daily scripts are owned by root. Here's the output from a local run I just did:

$ docker run --rm --env STORAGE_TYPE=elasticsearch --env ES_HOSTS=elastichost -it --entrypoint /usr/sbin/crond openzipkin/zipkin-dependencies -f
crond[1]: crond (busybox 1.31.1) started, log level 8
crond[1]: root: Permission denied
crond[1]: root: Permission denied

And checking the scripts in the container:

~ $ whoami
zipkin-dependencies
~ $ ls -l /etc/periodic/hourly/
total 4
-rw-r--r-- 1 root root 666 Dec 25 23:57 zipkin-dependencies-today
~ $ ls -l /etc/periodic/daily/
total 4
-rw-r--r-- 1 root root 691 Dec 25 23:57 zipkin-dependencies-yesterday

shakuzen avatar Feb 19 '21 09:02 shakuzen

I specified --user root, but result is still the same i.e. absence of any result. There were logs:

crond[1]: crond (busybox 1.31.1) started, log level 8
crond[1]: USER root pid   6 cmd run-parts /etc/periodic/15min
crond[1]: USER root pid   7 cmd run-parts /etc/periodic/15min

SlavaUtesinov avatar Feb 19 '21 11:02 SlavaUtesinov

Hi, it seems like this issue is still open with 2.6.4: Zipkin-Dependencies Container startet with entrypoint "crontab -f -d 8"

gives me:

docker logs zipkin-dependencies-itu1

crond: crond (busybox 1.31.1) started, log level 8
crond: root: Permission denied

martin960 avatar Oct 22 '21 08:10 martin960

+1

nkvaratskhelia avatar Oct 22 '21 08:10 nkvaratskhelia

Ping @jeqo

jcchavezs avatar Oct 22 '21 09:10 jcchavezs

I think there are several issues. What i had to do, to make cron tasks work:

Run docker container with user = root

Make Scripts in /etc/periodic/ executable. - Execute permissions where missing.

Add cd /zipkin-dependencies before start-zipkin-dependencies ... in the cron scripts

martin960 avatar Oct 22 '21 10:10 martin960

@martin960 thanks for the comments and research!

I gave a try fixing some of these here: https://github.com/openzipkin/zipkin-dependencies/pull/198

About running as root, would it be ok just to document it and leave users to change the user on their side?

jeqo avatar Oct 22 '21 14:10 jeqo

Hi, thanks for the fix. I think running as root is not ideal solution from a security perspective, but would be okay in my scenario.

martin960 avatar Nov 08 '21 10:11 martin960

Hi @jeqo, like @martin960 mentioned, running containers as root should be avoided in general. Also, I had a look at your PR and I think this point from @martin960's previous comment is still missing: "Make Scripts in /etc/periodic/ executable. - Execute permissions where missing.".

nkvaratskhelia avatar Nov 09 '21 04:11 nkvaratskhelia