Default cache directory of cat-avatar-generator-service

  • Open
  • quality assurance status badge
Details
2 participants
  • Evgeny Pisemsky
  • Evgeny Pisemsky
Owner
unassigned
Submitted by
Evgeny Pisemsky
Severity
normal
E
E
Evgeny Pisemsky wrote on 14 Feb 2023 04:10
(address . bug-guix@gnu.org)
87wn4llz62.fsf@pisemsky.com
Hello!

The cache directory must:

1. End with a slash (due to implementation of the php script).
2. Exist or be created manually.
3. Be writeable by php-fpm.

The current default value doesn't meet these requirements and leads to
broken caching and errors in php-fpm log.

The simplest solution is to change it to /tmp/, but for obvious
reasons it is not suitable for production use.

However, since this service is described as demonstration, I would
prefer unsafe default over broken (for now).

Also the requirements above should probably be mentioned in the
documentation of the service.
E
E
Evgeny Pisemsky wrote on 30 Nov 2023 17:38
[PATCH] services: cat-http-server: Fix cat-avatar-generator-service.
(address . 61500@debbugs.gnu.org)
8734wnqjqd.fsf@pisemsky.com
Here is the simplest patch that changes cache directory to /tmp/ and
makes this service work with the recently added monsterid package.
From d6778a511cd5c41755a8ba9853d0e9db8dd47997 Mon Sep 17 00:00:00 2001
Message-ID: <d6778a511cd5c41755a8ba9853d0e9db8dd47997.1701362094.git.evgeny@pisemsky.com>
From: Evgeny Pisemsky <evgeny@pisemsky.com>
Date: Thu, 30 Nov 2023 19:30:50 +0300
Subject: [PATCH] services: cat-http-server: Fix cat-avatar-generator-service.

* gnu/services/web.scm (cat-avatar-generator-service): Change default cache
directory of the service and make it compatible with the monsterid package.

Change-Id: I94b4b2d8b01e8502222e4fd2a6aea247d6480312
---
doc/guix.texi | 3 ++-
gnu/services/web.scm | 5 +++--
2 files changed, 5 insertions(+), 3 deletions(-)

Toggle diff (48 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index 1fd2e21608..95a2f05633 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -31752,7 +31752,7 @@ Web Services
the hash of a user's email address.
@deffn {Procedure} cat-avatar-generator-service @
- [#:cache-dir "/var/cache/cat-avatar-generator"] @
+ [#:cache-dir "/tmp/"] @
[#:package cat-avatar-generator] @
[#:configuration (nginx-server-configuration)]
Returns an nginx-server-configuration that inherits @code{configuration}. It
@@ -31764,6 +31764,7 @@ Web Services
A simple setup for cat-avatar-generator can look like this:
@lisp
(services (cons* (cat-avatar-generator-service
+ #:package monsterid
#:configuration
(nginx-server-configuration
(server-name '("example.com"))))
diff --git a/gnu/services/web.scm b/gnu/services/web.scm
index 818226a4f7..47ca1e6968 100644
--- a/gnu/services/web.scm
+++ b/gnu/services/web.scm
@@ -1158,7 +1158,7 @@ (define* (nginx-php-location
(define* (cat-avatar-generator-service
#:key
- (cache-dir "/var/cache/cat-avatar-generator")
+ (cache-dir "/tmp/")
(package cat-avatar-generator)
(configuration (nginx-server-configuration)))
(simple-service
@@ -1175,7 +1175,8 @@ (define* (cat-avatar-generator-service
(nginx-location-configuration-body base)))))
(nginx-server-configuration-locations configuration)))
(root #~(string-append #$package
- "/share/web/cat-avatar-generator"))))))
+ "/share/web/"
+ #$(package-name package)))))))
(define-record-type* <hpcguix-web-configuration>

base-commit: c12cf2fb63bc2a5b0c5419a372ff6fff76a28a3b
--
2.41.0
E
E
Evgeny Pisemsky wrote on 14 Dec 19:28 +0100
Re: Default cache directory of cat-avatar-generator-service
(address . 61500@debbugs.gnu.org)
87y10ijezk.fsf@pisemsky.site
Toggle quote (2 lines)
> However, since this service is described as demonstration, I would prefer unsafe default over broken (for now).

I realized that this may look like an attempt to introduce vulnerabity, while in fact I was just silly. Shame on me.

The right thing to do here is to write a normal service instead of simple and create cache directory using activation service.

Or at least to update documentation of the existing service.

If someone at guix reads and wants this, please let me know.
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 61500@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 61500
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch