[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
PMB integrated Library System
From: |
yarl baudig |
Subject: |
PMB integrated Library System |
Date: |
Fri, 2 Dec 2022 10:39:30 +0100 (CET) |
Hello guix,
I would like to ask for comments on this, please.
A relative asked me to install pmb (www.sigb.net) on his linux computer.
I thought that trying to package this for guix would be a good way to make it
easier for me to maintain it, to contribute to guix, and to learn more about
guix.
I won't comment the software or the lack of documentation.
Anyway, this was not as easy as I thought.
I prefer sending this on this list first to have some comments. I am still
learning.
Does this fit in guix? What mistakes did I do? Is my english good enough? I
take all comments. Thank you!
I am also planning to package koha (koha-community.org) after pmb, for
comparison.
>From 43e08c4d5fc903411c7609a1e7d899ec43a85e56 Mon Sep 17 00:00:00 2001
From: Yarl Baudig <yarl-baudig@mailoo.org>
Date: Fri, 25 Nov 2022 13:22:17 +0100
Subject: [PATCH 1/4] gnu: php: Add '--enable-soap' configure option.
* gnu/packages/php.scm: Add '--enable-soap' configure option.
---
gnu/packages/php.scm | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/gnu/packages/php.scm b/gnu/packages/php.scm
index 645a8edee1..9bc4af5092 100644
--- a/gnu/packages/php.scm
+++ b/gnu/packages/php.scm
@@ -134,7 +134,8 @@ (define-public php
"--enable-intl"
"--enable-mbstring"
"--enable-pcntl"
- "--enable-sockets"))
+ "--enable-sockets"
+ "--enable-soap"))
#:phases
(modify-phases %standard-phases
(add-after 'unpack 'do-not-record-build-flags
--
2.38.1
>From b9e7abdf982cadebec3f0899ef36deeb6f5e24b4 Mon Sep 17 00:00:00 2001
From: Yarl Baudig <yarl-baudig@mailoo.org>
Date: Fri, 25 Nov 2022 23:28:44 +0100
Subject: [PATCH 2/4] gnu: Add PMB.
* gnu/packages/ils.scm: New file.
* gnu/local.mk: Add it.
---
gnu/local.mk | 1 +
gnu/packages/ils.scm | 73 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 74 insertions(+)
create mode 100644 gnu/packages/ils.scm
diff --git a/gnu/local.mk b/gnu/local.mk
index f543a9350d..e6ad51ae78 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -323,6 +323,7 @@ GNU_SYSTEM_MODULES = \
%D%/packages/icu4c.scm \
%D%/packages/idris.scm \
%D%/packages/idutils.scm \
+ %D%/packages/ils.scm \
%D%/packages/image.scm \
%D%/packages/image-processing.scm \
%D%/packages/image-viewers.scm \
diff --git a/gnu/packages/ils.scm b/gnu/packages/ils.scm
new file mode 100644
index 0000000000..8bdec05980
--- /dev/null
+++ b/gnu/packages/ils.scm
@@ -0,0 +1,73 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2022 Yarl Baudig <yarl-baudig@mailoo.org>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages ils)
+ #:use-module (guix packages)
+ #:use-module (guix download)
+ #:use-module (guix build-system copy)
+ #:use-module (guix licenses)
+ #:use-module (gnu packages gawk)
+ #:use-module (gnu packages compression)
+ #:use-module (gnu packages php)
+ #:use-module (gnu packages perl))
+
+;;; Commentary
+;;;
+;;; Integrated Library Systems packages.
+;;;
+;;; Code
+
+(define-public pmb
+ (package
+ (name "pmb")
+ (version "7.4.6")
+ (source (origin
+ (method url-fetch)
+ (uri
+ (string-append
+ "https://forge.sigb.net/attachments/download/3968/pmb"
+ version
+ ".zip"))
+ (sha256
+ (base32
+ "0ana1w8d60n2gznhh1zyjdld4xi4p2pm2hc05m8n7fh2bvlmw0cr"))))
+ (build-system copy-build-system)
+ (arguments '(#:install-plan '(("." "share/http/pmb"))))
+ (native-inputs (list unzip))
+ (propagated-inputs (list php perl))
+ (synopsis "Integrated Library System")
+ (description "PMB is an Integrated Library System for librarians,
documentalists and
+information managers.
+
+PMB features include:
+@itemize
+@item Management of physical and digital collections
+@item Standardization of the document collection
+@item Native integration of RFID solutions
+@item Enhancement of the collection with a personalized document portal
+@item Management of acquisitions
+@item Monitoring of activities with statistical tools
+@item Communication with users (ISD, monitoring, documentary products, etc.)
+@item Internal management of users or synchronization with an LDAP/AD
directory.
+@end itemize
+
+This contains only the PMB archive (html, php and css files), you will need a
web
+server, php and a SQL database server. See the guix pmb service.")
+ (home-page "https://www.sigb.net")
+ (license cecill)))
+
--
2.38.1
>From 59dcc3dccc2ab37b67a80b70165dd5edc4d99de3 Mon Sep 17 00:00:00 2001
From: Yarl Baudig <yarl-baudig@mailoo.org>
Date: Fri, 2 Dec 2022 10:19:17 +0100
Subject: [PATCH 3/4] gnu: Add PMB service.
* gnu/services/ils.scm: New file.
* gnu/local.mk: Add it.
---
gnu/local.mk | 1 +
gnu/services/ils.scm | 128 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 129 insertions(+)
create mode 100644 gnu/services/ils.scm
diff --git a/gnu/local.mk b/gnu/local.mk
index e6ad51ae78..97bc8f829b 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -670,6 +670,7 @@ GNU_SYSTEM_MODULES = \
%D%/services/getmail.scm \
%D%/services/guix.scm \
%D%/services/hurd.scm \
+ %D%/services/ils.scm \
%D%/services/kerberos.scm \
%D%/services/lightdm.scm \
%D%/services/linux.scm \
diff --git a/gnu/services/ils.scm b/gnu/services/ils.scm
new file mode 100644
index 0000000000..16c0dbab22
--- /dev/null
+++ b/gnu/services/ils.scm
@@ -0,0 +1,128 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2022 Yarl Baudig <yarl-baudig@mailoo.org>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu services ils)
+ #:use-module (gnu services)
+ #:use-module (gnu services web)
+ #:use-module (gnu packages ils)
+ #:use-module (guix records)
+ #:use-module (guix utils)
+ #:use-module (guix gexp)
+ #:use-module (ice-9 match)
+ #:use-module (ice-9 format)
+ #:export (pmb-configuration
+ pmb-service-type
+ %default-nginx-pmb-location
+ %default-pmb-php-fpm-configuration
+ %default-pmb-mysql-configuration-extra-content))
+
+;;; Commentary
+;;;
+;;; Integrated Library Systems services.
+;;;
+;;; Code
+
+(define %default-nginx-pmb-location
+ (let ((base (nginx-php-location)))
+ (nginx-location-configuration
+ (inherit base)
+ (body (cons
+ "fastcgi_read_timeout 300;"
+ (nginx-location-configuration-body base))))))
+
+(define %default-pmb-php-fpm-configuration
+ "expose_php=off
+max_execution_time=300
+max_input_vars=50000
+memory_limit=256M
+post_max_size=64M
+upload_max_filesize=64M
+date.timezone=Europe/Paris")
+
+(define %default-pmb-mysql-configuration-extra-content
+ "[server]
+sql_mode=NO_AUTO_CREATE_USER
+collation_server=utf8_unicode_ci
+key_buffer_size=1000001536
+join_buffer_size=4000000")
+
+(define-record-type* <pmb-configuration>
+ pmb-configuration make-pmb-configuration
+ pmb-configuration?
+ (pmb pmb-configuration-pmb (default pmb))
+ (http-directory pmb-configuration-http-directory
+ (default "/srv/http/pmb"))
+ (php-fpm-user pmb-configuration-php-fpm-user
+ (default "php-fpm"))
+ (php-fpm-group pmb-configuration-php-fpm-group
+ (default "php-fpm")))
+
+(define (pmb-activation config)
+ (match-record
+ config
+ <pmb-configuration>
+ (pmb http-directory php-fpm-user php-fpm-group)
+ #~(begin
+ (use-modules (guix build utils))
+ (use-modules (ice-9 ftw))
+ (format #t "Copying pmb '~a' to http directory '~a'~%"
+ (string-append #$pmb "/share/http/pmb")
+ #$http-directory)
+ (mkdir-p #$http-directory)
+ ;; Please be quiet
+ (call-with-output-file "/dev/null"
+ (lambda (port)
+ (with-output-to-port port
+ (lambda ()
+ (copy-recursively (string-append #$pmb "/share/http/pmb")
+ #$http-directory)))))
+ (define (enter? name stat result)
+ #t)
+ (define (lchown obj)
+ (let ((user (getpwnam #$php-fpm-user))
+ (group (getgrnam #$php-fpm-group)))
+ (chown obj (passwd:uid user) (group:gid group))))
+ (define (leaf name stat result)
+ (lchown name)
+ result)
+ (define (down name stat result)
+ (lchown name)
+ result)
+ (define (up name stat result) result)
+ (define (skip name stat result) result)
+ (define (error name stat errno result)
+ (warning (G_ "~a: ~a~%")
+ name (strerror errno))
+ result)
+ (file-system-fold enter? leaf down up skip error '() #$http-directory)
+ ;; Those are to hide installation files on a re-activation
+ (if
+ (file-exists? (string-append #$http-directory "/tables/noinstall.php"))
+ (delete-file (string-append #$http-directory "/tables/install.php")))
+ (if
+ (file-exists? (string-append #$http-directory
"/tables/noinstall_rep.php"))
+ (delete-file (string-append #$http-directory
"/tables/install_rep.php"))))))
+
+(define pmb-service-type
+ (service-type
+ (name 'guix)
+ (extensions
+ (list (service-extension activation-service-type
+ pmb-activation)))
+ (default-value (pmb-configuration))
+ (description "Install the pmb Integrated Library System")))
--
2.38.1
>From e952effbf4638a590c6741b0ad378f50d322f8e7 Mon Sep 17 00:00:00 2001
From: Yarl Baudig <yarl-baudig@mailoo.org>
Date: Fri, 2 Dec 2022 10:19:56 +0100
Subject: [PATCH 4/4] doc: Add Integrated Library System section.
doc/guix.texi (System Configuration, Services): Add Integrated Library System
Services section.
doc/guix.texi (System Configuration, Services, Integrated Library System
Services): Add PMB.
---
doc/guix.texi | 131 +++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 130 insertions(+), 1 deletion(-)
diff --git a/doc/guix.texi b/doc/guix.texi
index eaecfd0daa..311ee0f475 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -109,6 +109,7 @@ Copyright @copyright{} 2022 Reily Siegel@*
Copyright @copyright{} 2022 Simon Streit@*
Copyright @copyright{} 2022 (@*
Copyright @copyright{} 2022 John Kehayias@*
+Copyright @copyright{} 2022 Yarl Baudig
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
@@ -402,6 +403,7 @@ Services
* Guix Services:: Services relating specifically to Guix.
* Linux Services:: Services tied to the Linux kernel.
* Hurd Services:: Services specific for a Hurd System.
+* Integrated Library System Services:: ILS services.
* Miscellaneous Services:: Other services.
Defining Services
@@ -17705,6 +17707,7 @@ declaration.
* Guix Services:: Services relating specifically to Guix.
* Linux Services:: Services tied to the Linux kernel.
* Hurd Services:: Services specific for a Hurd System.
+* Integrated Library System Services:: ILS services.
* Miscellaneous Services:: Other services.
@end menu
@@ -36705,6 +36708,132 @@ An integer specifying the baud rate of the tty.
@end table
@end deftp
+@node Integrated Library System Services
+@subsection Integrated Library System Services
+
+@cindex PMB Service
+@subsubheading PMB Service
+
+@defvr {Scheme Variable} pmb-service-type
+Service type for the @uref{https://www.sigb.net/,PMB} Integrated Library
System.
+The value for this service type is a @code{<pmb-configuration>} record.
+
+The PMB service needs a web server, @code{mariadb}/@code{mysql}, @code{php} and
+is only responsible for copying and changing ownership of files from the
+@code{pmb} package.
+@end defvr
+
+Let's start with a demonstration. Here is a sample system configuration
(@file{pmb.scm}):
+
+@lisp
+(use-modules (gnu))
+(use-service-modules ils web networking databases)
+(use-package-modules databases)
+
+(operating-system
+ (host-name "pmb")
+ (timezone "Europe/Paris")
+ (file-systems (cons (file-system
+ (device (file-system-label "does-not-matter"))
+ (mount-point "/")
+ (type "ext4"))
+ %base-file-systems))
+ (bootloader (bootloader-configuration
+ (bootloader grub-bootloader)
+ (targets '("/dev/sdX"))))
+ (packages (cons* mariadb %base-packages))
+ (services
+ (cons* (service dhcp-client-service-type)
+ (service php-fpm-service-type
+ (php-fpm-configuration
+ (php-ini-file
+ (plain-file "php.ini"
+ %default-pmb-php-fpm-configuration))))
+ (service nginx-service-type
+ (nginx-configuration
+ (server-blocks
+ (list (nginx-server-configuration
+ (locations
+ (list
+ %default-nginx-pmb-location))
+ (listen '("8080"))
+ (root "/srv/http/pmb")
+ (index '("index.php")))))))
+ (service mysql-service-type
+ (mysql-configuration
+ (extra-content
+ %default-pmb-mysql-configuration-extra-content)))
+ (service pmb-service-type)
+ %base-services)))
+@end lisp
+
+Be warned that with this example, @code{https} is not enabled and the
application will
+be accessible from your network.
+
+The interesting points are as follows.
+We import the @code{mariadb} package so that we will have access to the program
+@command{mysql}. This will be useful to set the password of the database's
+administrator. We declare a @code{php-fpm} service whose @file{php.ini} file
+is set to @code{%default-pmb-php-fpm-configuration}.
+The @code{NGinx} service is declared, with a location set to
+@code{%default-nginx-pmb-location} and a root set to @file{/srv/http/pmb},
which
+is the default for the @code{http-directory} field of
@code{<pmb-configuration>}.
+The @code{mysql} service is declared with an @code{extra-content} to its
configuration:
+@code{default-pmb-mysql-configuration-extra-content}. Finally the pmb service.
+
+Now let's run @command{guix system container -N pmb.scm} (@pxref{Invoking guix
system}).
+Run the resulting @file{/gnu/store/...run-container}.
+Note that we want to keep the state of the database and the php files (because
during
+the application setup (see below), the php files will be slightly modified.
That is also why
+the PMB files need to be copied (and chowned) outside the store), we need to
create
+two folders, say @file{/mnt/data/pmb} and @file{/mnt/data/mysql} and pass
@option{--share}
+two times. @command{nsenter} into it to set the database's administrator
password.
+
+@example
+# mkdir /mnt/data/mysql /mnt/data/pmb
+# /gnu/store/...run-container --share=/mnt/data/pmb=/srv/http/pmb \
+--share=/mnt/data/mysql=/var/lib/mysql
+# nsenter -a -t <replace-with-pid>
+# mysql
+> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('guixisgreat');
+@end example
+
+Go to @uref{localhost:8080}. Follow the steps. Note that for the database
server parameters,
+``localhost'' won't work, its ``127.0.0.1'' and the user is ``root''.
+Once the installation is complete, you are redirected to the login page. The
name is ``admin'',
+the password is ``admin''.
+
+Now lets detail fields.
+
+@defvr {Scheme Variable} %default-pmb-php-fpm-configuration
+This is meant to represent the content of @file{php.ini} for the
+@code{php-fpm} service for a recommended configuration.
+@end defvr
+
+@defvr {Scheme Variable} %default-pmb-mysql-configuration-extra-content
+Extra content to be added to @code{mariadb}/@code{mysql} configuration for
recommended configuration.
+@end defvr
+
+@defvr {Scheme Variable} %default-nginx-pmb-location
+Location for nginx based on @code{nginx-php-location}.
+@end defvr
+
+@deftp {Data Type} pmb-configuration
+This data type represents the configuration for PMB.
+
+@table @asis
+@item @code{pmb} (default: @code{pmb})
+
+@item @code{http-directory} (default: @file{/srv/http/pmb})
+Must match a webserver's root.
+
+@item @code{php-fpm-user} (default: @code{php-fpm})
+
+@item @code{php-fpm-group} (default: @code{php-fpm})
+
+@end table
+@end deftp
+
@node Miscellaneous Services
@subsection Miscellaneous Services
@@ -38323,7 +38452,7 @@ description: Install the given fonts on the specified
ttys (fonts are per
+ tty/font pairs. The font can be the name of a font provided by the `kbd'
+ package or any valid argument to `setfont', as in this example:
+
-+ '(("tty1" . "LatGrkCyr-8x16")
++ 6 '(("tty1" . "LatGrkCyr-8x16")
+ ("tty2" . (file-append
+ font-tamzen
+ "/share/kbd/consolefonts/TamzenForPowerline10x20.psf"))
--
2.38.1
Thanks.
- PMB integrated Library System,
yarl baudig <=