gboudreau / Greyhole

Greyhole uses Samba to create a storage pool of all your available hard drives, and allows you to create redundant copies of the files you store.
http://www.greyhole.net
GNU General Public License v3.0
262 stars 34 forks source link

greyhole service won't start with containerd mariadb (greyhole.service) #327

Open kedvsk opened 5 months ago

kedvsk commented 5 months ago

Greyhole service depends on startup on: Requires=mysqld.service smbd.service Removing "mysqld.service" is a workaround but results in errors on startup because mysql is not right up now:

Mai 19 10:47:34 testserver CRON[871]: (root) CMD ( /usr/bin/greyhole --boot-init)
Mai 19 10:47:34 testserver CRON[870]: (root) CMD ( /usr/bin/greyhole --create-mem-spool >/dev/null)
Mai 19 10:47:35 testserver systemd[1]: Starting greyhole.service - Greyhole...
░░ Subject: A start job for unit greyhole.service has begun execution
░░ A start job for unit greyhole.service has begun execution.
Mai 19 10:47:35 testserver greyhole[1104]: ERROR: Can't connect to database: SQLSTATE[HY000] [2002] Connection refused
Mai 19 10:47:35 testserver greyhole[1104]: May 19 08:47:35 CRITICAL test-config: Can't connect to database: SQLSTATE[HY000] [2002] Connection refused
Mai 19 10:47:35 testserver systemd[1]: greyhole.service: Control process exited, code=exited, status=1/FAILURE
░░ An ExecStartPre= process belonging to unit greyhole.service has exited.
Mai 19 10:47:35 testserver greyhole[1250]: ERROR: Can't connect to database: SQLSTATE[HY000] [2002] Connection refused
Mai 19 10:47:35 testserver systemd[1]: greyhole.service: Control process exited, code=exited, status=1/FAILURE
░░ An ExecStopPost= process belonging to unit greyhole.service has exited.
Mai 19 10:47:35 testserver systemd[1]: greyhole.service: Failed with result 'exit-code'.
░░ The unit greyhole.service has entered the 'failed' state with result 'exit-code'.
Mai 19 10:47:35 testserver systemd[1]: Failed to start greyhole.service - Greyhole.
░░ Subject: A start job for unit greyhole.service has failed
░░ A start job for unit greyhole.service has finished with a failure.
Mai 19 10:47:41 testserver systemd[1]: greyhole.service: Scheduled restart job, restart counter is at 1.
░░ Automatic restarting of the unit greyhole.service has been scheduled, as the result for
Mai 19 10:47:41 testserver systemd[1]: Starting greyhole.service - Greyhole...
░░ Subject: A start job for unit greyhole.service has begun execution
░░ A start job for unit greyhole.service has begun execution.
Mai 19 10:47:41 testserver greyhole[2350]: Config is OK
Mai 19 10:47:41 testserver systemd[1]: Started greyhole.service - Greyhole.
░░ Subject: A start job for unit greyhole.service has finished successfully
░░ A start job for unit greyhole.service has finished successfully.

My question (maybe the wrong place here): how to tell greyhole.service to wait for mariadb container?

gboudreau commented 5 months ago

Hi,

You could run Greyhole (and Samba) as a Docker container, using https://hub.docker.com/r/gboudreau/samba-greyhole And declare a dependency on a mariadb container using docker-compose depends_on, or docker link.
(The documented way to run the contained, using a sample samba-greyhole.service, will result in the same problem you're having).

Also: why do you care that the Greyhole service fails to start if mariadb is down? systemd will simply retry until it works, no? (But yeah, you'll need to remove the mysqld.service from the .service file.)