[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: orthanc-postgresql



On Thu, Mar 05, 2015 at 09:07:14PM +0100, Sébastien Jodogne wrote:

> Well... I have just discovered the "Should-Start:" syntax in LSB init scripts: "It defines the facilities that if present should start before the service provided by the script. Nevertheless, the script can still start if the listed facilities are missing. This allows for weak dependencies which do not cause the service to fail if a facility is not available." [1]
> 
> Therefore, I feel that the following header is sufficient to prevent the Orthanc service from starting before PostgreSQL (which was my initial fear that led to the discussion about orthanc-sqlite):
> 
> ### BEGIN INIT INFO
> # Provides:          orthanc
> # Required-Start:    $local_fs $remote_fs $network $syslog
> # Required-Stop:     $local_fs $remote_fs $network $syslog
> # Should-Start:      postgresql
> # Should-Stop:       postgresql
> # Default-Start:     2 3 4 5
> # Default-Stop:      0 1 6
> # Short-Description: Orthanc init script
> # Description:       Orthanc, a lightweight, RESTful DICOM server
> ### END INIT INFO
> 
> As a consequence, I now think that there is no reason anymore to introduce the "orthanc-sqlite" package... this of course greatly simplifies the packaging.
> 
> Andreas, Karsten, please could you confirm that this approach is sound?

It would likely work for making orthanc only weakly depend on
PG running. However, it would not guarantuee that PG is
running when orthanc is configured to use PG.

Would Orthanc still fail when configured for PG but PG not
running or would it (silently ?!) fall back to use sqlite ?

I think we may have to go back rethinking to properly solve
this:

1) orthanc can use sqlite or postgresql as backend
2) the sqlite backend is built-in (?) and is intended
   to always just work
3) to use PG orthanc must be configured to do so
4) you want orthanc at startup to make sure PG is
   running if and only if it is configured to use PG

- (2) requires orthanc to Depends: on sqlite
- (4) requires either
		a) different init scripts, one with and one without postgresql
	  or
		b) some sort of dependency on PostgreSQL when PostgreSQL is
		   needed such that Should-Start: PostgreSQL _will_ succeed

Both of a) and b) require a package orthanc-postgresql which
can Depends: on PostgreSQL. If there is another
orthanc-sqlite package (which depends on sqlite and
Conflicts: with orthanc-PG) you can provide strict startup
dependancies. If not (and the main orthanc package Depends:
on sqlite) you can make the orthanc-PG package Depends: on PG
just as well but you cannot provide a strict Required-Start
on PostgreSQL (you'd _have_ to use Should-Start). However,
since when the user installs orthanc-PG that will Depends: on
PG and thusly also install PG which makes sure that
Should-Start: PG _will_ succeed.

The only drawback I see is that it is then not at all easy to
provide further backends because one cannot distinguish
between several Should-Start requirements. IOW, when - for
other reasons - both PG and MySQL are installed starting up
Orthanc will start both databases despite only needing one of
them.

However, one might argue: either the unneeded-by-orthanc
database is already running (exactly because it was installed
for other reasons) or else it isn't needed, in which case one
might uninstall it which will make the unneeded start go away.

However, sometimes (due to other packages not being so nice)
one has to install infrastructure software due to Depends:
but then disable actually running said infrastructure because
that package can be configured to use something else (but
still Depends: on something).

Just my 2¢.

Karsten
-- 
GPG key ID E4071346 @ eu.pool.sks-keyservers.net
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346


Reply to: