macbre / docker-sphinxsearch

Docker image for Sphinx search engine
https://hub.docker.com/r/macbre/sphinxsearch/
MIT License
55 stars 24 forks source link

Unable to start crond #11

Closed jseverinson closed 3 years ago

jseverinson commented 4 years ago

Hi, let me first say thanks for this docker image and apologise in advance if this is a noob question, I'm learning as I go. ๐Ÿ˜Š

I've set up this image and got Sphinx to a point where I'm very happy with it, but I'm struggling to get a cronjob set up to periodically re-index. crond seems not to be running and as I try to launch it I get this:

node86411-webb30-search1:~# /etc/init.d/crond start
 * Starting busybox syslog ...
/sbin/syslogd: unrecognized option: Z
BusyBox v1.31.1 () multi-call binary.

Usage: syslogd [OPTIONS]

System logging utility

-nRun in foreground
-R HOST[:PORT]Log to HOST:PORT (default PORT:514)
-LLog locally and via network (default is network only if -R)
-C[size_kb]Log to shared mem buffer (use logread to read it)
-KLog to kernel printk buffer (use dmesg to read it)
-O FILELog to FILE (default: /var/log/messages, stdout if -)
-s SIZEMax size (KB) before rotation (default 200KB, 0=off)
-b NN rotated logs to keep (default 1, max 99, 0=purge)
-l NLog only messages more urgent than prio N (1-8)
-SSmaller output
-tStrip client-generated timestamps
-DDrop duplicates
-f FILEUse FILE as config (default:/etc/syslog.conf)
 * start-stop-daemon: failed to start `/sbin/syslogd'
 * Failed to start busybox syslog [ !! ]
 * ERROR: syslog failed to start
 * ERROR: cannot start crond as syslog would not start

Making it a bit more verbose with the -d option I see this:

+ ebegin 'Starting busybox syslog'
 * Starting busybox syslog ...
+ yesno 
+ '[' -z  ]
+ return 1
+ yesno 
+ '[' -z  ]
+ return 1
+ '[' -n  ]
+ '[' -n  ]
+ eval start-stop-daemon --start --exec /sbin/syslogd --pidfile /var/run/syslogd.pid -g wheel -k 027 -- -Z
+ start-stop-daemon --start --exec /sbin/syslogd --pidfile /var/run/syslogd.pid -g wheel -k 027 -- -Z
/sbin/syslogd: unrecognized option: Z
BusyBox v1.31.1 () multi-call binary.

Usage: syslogd [OPTIONS]

System logging utility

-nRun in foreground
-R HOST[:PORT]Log to HOST:PORT (default PORT:514)
-LLog locally and via network (default is network only if -R)
-C[size_kb]Log to shared mem buffer (use logread to read it)
-KLog to kernel printk buffer (use dmesg to read it)
-O FILELog to FILE (default: /var/log/messages, stdout if -)
-s SIZEMax size (KB) before rotation (default 200KB, 0=off)
-b NN rotated logs to keep (default 1, max 99, 0=purge)
-l NLog only messages more urgent than prio N (1-8)
-SSmaller output
-tStrip client-generated timestamps
-DDrop duplicates
-f FILEUse FILE as config (default:/etc/syslog.conf)
 * start-stop-daemon: failed to start `/sbin/syslogd'
+ eend 1 'Failed to start busybox syslog'
 * Failed to start busybox syslog [ !! ]
+ yesno 
+ '[' -z  ]
+ return 1
+ return 1
+ exit 1
 * ERROR: syslog failed to start
 * ERROR: cannot start crond as syslog would not start

The start-stop-daemon --start --exec /bin/syslogd seems to have a redundant option with it, and if I remove that I can start syslogd, but then crond will say syslogd is already running and still complain it cannot be started.

Any advice on what to do here? Thanks!

jseverinson commented 4 years ago

I believe I found the issue. This was a bug in Alpine Linux. It can be fixed by replicating this commit, by editing /etc/conf.d/syslog and change the "-Z" to "-t".

Leaving this open as it might make sense to patch the image or upgrade the Alpine Linux version. I imagine more people will want to have crond running for their Sphinx container. Thanks!

macbre commented 4 years ago

@jseverinson - do you want to run syslog daemon inside Sphinx Docker container? Or am I getting this wrong?

jseverinson commented 4 years ago

Hi Maciej! Not really, I want to run crond inside it to reindex the Sphinx index, but crond wonโ€™t start because of this error in how syslogd is called. ๐Ÿ˜Š

lรถr 31 okt. 2020 kl. 19:55 skrev Maciej Brencz notifications@github.com:

@jseverinson https://github.com/jseverinson - do you want to run syslog daemon inside Sphinx Docker container? Or am I getting this wrong?

โ€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/macbre/docker-sphinxsearch/issues/11#issuecomment-719973541, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA7EVLC53JQTRYTIKZYIB7TSNRMT5ANCNFSM4SS6DSNQ .

macbre commented 4 years ago

You should rather use cron running on the host machine (not inside the Docker container) and run docker exec sphinx <reindex command>:

docker exec -i sphinx_container indexer --rotate --print-queries --all
docker kill --signal=HUP sphinx_container  # this one will make the Sphinx daemon reload the index files

Best :slightly_smiling_face:

jseverinson commented 4 years ago

Hi again Maciej. This might be me being entirely incompetent, but I'm using the Jelastic virtualisation platform which means a virtual machine is built from a Docker container. As such I don't have access to any host machine. ๐Ÿ˜Š In any case, I solved this for my own sake, just figured this change might be something you'd want to introduce in future versions.

All the best, John

On Sat, 31 Oct 2020 at 20:06, Maciej Brencz notifications@github.com wrote:

You should rather use cron running on the host machine (not inside the Docker container) and run docker exec sphinx .

โ€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/macbre/docker-sphinxsearch/issues/11#issuecomment-719974790, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA7EVLE2IJXOICMK3OKU5HLSNRN4XANCNFSM4SS6DSNQ .

macbre commented 4 years ago

@jseverinson - sure :slightly_smiling_face: Are you using macbre/sphinxsearch image "directly" or did you create your own Dockerfile that uses it?

I'm asking because alpine:3.12 base image does not seem to have syslog.conf file...