From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id SMxeFIVLEGDGEwAA0tVLHw (envelope-from ) for ; Tue, 26 Jan 2021 17:04:05 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id UCkNEIVLEGCJZAAAB5/wlQ (envelope-from ) for ; Tue, 26 Jan 2021 17:04:05 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 00D6594053B for ; Tue, 26 Jan 2021 17:04:02 +0000 (UTC) Received: from localhost ([::1]:42970 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l4Rl3-0005yZ-Bi for larch@yhetil.org; Tue, 26 Jan 2021 12:04:01 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33064) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l4RkT-0005vb-Mt for help-guix@gnu.org; Tue, 26 Jan 2021 12:03:25 -0500 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]:39209) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l4RkR-0004b5-Cd for help-guix@gnu.org; Tue, 26 Jan 2021 12:03:25 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 20FB8A21 for ; Tue, 26 Jan 2021 12:03:20 -0500 (EST) Received: from imap36 ([10.202.2.86]) by compute4.internal (MEProxy); Tue, 26 Jan 2021 12:03:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tindall.space; h=mime-version:message-id:date:from:to:subject:content-type; s= fm1; bh=DUF57VUo2p1qXJz6QiAgi9j7Qz+9DBrUKRdOkwQ7aBQ=; b=FkrqaVNG YnRcG812p869+j7sK2Y3iAqTdT8ZfTcLIlh1wl5zlW0BcR2W5nTBAm4Qa1sefota 64+/vGY+dZBM7gA3nV/wf4ZlWcXC5Z2cuSLZ+S9HZ5FeJ7B5vNgNLLHa4sZhddjc VtAYG7IgFkyKunROmwAMeiBZs5X0DQYdFwOW2Plg9QXSkUyQ2H096jQHW+3Wsy8G thd7/qzil2sGL1mlUDgwq8K6UIm28oQYp1G85UVovmzUKbijU/OAInKXGcGzLApO +MN2mxUnEBhUSc2SC9C4Patb+xCSU17n4xVZmWfzqOG+YxpBc182zVk5GCHHU+hT VU5790P+xQJNIQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:message-id :mime-version:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=DUF57VUo2p1qXJz6QiAgi9j7Qz+9D BrUKRdOkwQ7aBQ=; b=aZ8SADbE9XJVxCiaJdUzkDWkBAKfyQUckYRnHKytHfZ6X QSwWvz77U65Rl8rzRw/Ch3Tteyw9uPd7fDa5jaob7GFAHFgx4nx+/SBOsk3a1z5s +VCneIa3c39jeVVlKYONp5guPeOllZcIxZ8cudUIQJWEZbA4mJ25db0ILkcRAzUP y0+M86ciiF7rDPwwDv8BcmBCkuRj6NawHFymELZmRISg79E4qAZnVxS2CNv/YVfM Is69CHVPw184cuBhff7ShoKqo5FBPdNnu4X09db9AUBB8aoDvTNWulgDJfiCE6vh gSnXpqFRLh6wBIjCyKi39MXNB8aT/5p3ohZMmfyBQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdeigdefgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepofgfggfkfffhvffutgesthdtredtre ertdenucfhrhhomhepvegrmhgvrhhonhcuoegtrghmsehtihhnuggrlhhlrdhsphgrtggv qeenucggtffrrghtthgvrhhnpedtgeehgfduiefftdeutdetheefvdfguefggeekkedtvd ejhedtvedutddtvdetieenucffohhmrghinhepghhithhhuhgsrdgtohhmpdgtrgguugih shgvrhhvvghrrdgtohhmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrg hilhhfrhhomheptggrmhesthhinhgurghllhdrshhprggtvg X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 1F23E18800AB; Tue, 26 Jan 2021 12:03:19 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-78-g36b56e8-fm-20210120.001-g36b56e88 Mime-Version: 1.0 Message-Id: Date: Tue, 26 Jan 2021 11:02:58 -0600 From: Cameron To: help-guix@gnu.org Subject: Custom Service Definition for Caddy Content-Type: text/plain Received-SPF: pass client-ip=64.147.123.19; envelope-from=cam@tindall.space; helo=wout3-smtp.messagingengine.com X-Spam_score_int: 13 X-Spam_score: 1.3 X-Spam_bar: + X-Spam_report: (1.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FROM_SUSPICIOUS_NTLD=0.499, FROM_SUSPICIOUS_NTLD_FP=1.6, PDS_OTHER_BAD_TLD=1.999, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: help-guix@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-guix-bounces+larch=yhetil.org@gnu.org Sender: "Help-Guix" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -1.54 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=tindall.space header.s=fm1 header.b=FkrqaVNG; dkim=pass header.d=messagingengine.com header.s=fm1 header.b=aZ8SADbE; dmarc=none; spf=pass (aspmx1.migadu.com: domain of help-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=help-guix-bounces@gnu.org X-Migadu-Queue-Id: 00D6594053B X-Spam-Score: -1.54 X-Migadu-Scanner: scn0.migadu.com X-TUID: /acUoxHSEaeq Hello again everyone! I'm having a great time learning about Guix, but am struggling with defining a custom service for Caddy. The 'caddy' package below works as expected -- installing it puts the "caddy" binary in $PATH and it works fine when I run it from a shell. #+begin_src (define caddy (package (name "caddy") (version "2.2.1") (source (origin (method url-fetch/tarbomb) (uri (string-append "https://github.com/caddyserver/caddy/releases/download/v" version "/caddy_" version "_linux_amd64.tar.gz")) (sha256 (base32 "1va2h8hpxcby9rny7px1y2xks79rxb4svnf9mrdrlc5xn0s04dsx")))) (build-system copy-build-system) (arguments '(#:install-plan '(("caddy" "bin/caddy")))) (synopsis "This is a *BAD* Caddy package. It just pulls the already-built binary from Github, rather than building from source.") (description "See https://caddyserver.com/") (home-page "https://caddyserver.com/") (license licenses:asl2.0))) #+end_src What doesn't work as expected is this service definition: #+begin_src (define-record-type* caddy-configuration make-caddy-configuration caddy-configuration? (config-file caddy-configuration-config-file (default "/etc/Caddyfile"))) (define caddy-service-type (shepherd-service-type 'caddy (lambda (config) (shepherd-service (documentation "Run the caddy daemon (caddy).") (provision '(caddy)) (requirement '(user-processes)) (start #~(make-forkexec-constructor (list "caddy" "run" "-config" "/etc/Caddyfile") #:log-file "/var/log/caddy.log")) (stop #~(make-kill-destructor)))))) #+end_src ...which I then add to my services list in config.scm like this: #+begin_src (service caddy-service-type (caddy-configuration (config-file "/etc/Caddyfile"))) #+end_src With this setup, 'herd start caddy' hangs for 30 seconds, during which time the server is active and taking traffic according to the config in /etc/Caddyfile but then something (presumably Shepherd) sends it a SIGTERM and it dutifully shuts down. The 'herd start caddy' then exits with an error: #+begin_src root@tindall ~# START=$(date +%s); herd start caddy; END=$(date +%s); echo $(($END - START)) Service caddy could not be started. herd: failed to start service caddy 30 root@tindall ~# tail -n 1 /var/log/caddy.log {"level":"info","ts":1611680035.1811087,"msg":"shutdown done","signal":"SIGTERM"} root@tindall ~# #+end_src 'caddy run' will keep caddy in the foreground, but I see the same behavior when I use 'caddy start' (which forks another process for the daemon and exits immediately) in the service definition instead. I suspect something is wrong with the 'start' procedure I've defined, but I'm struggling to figure out what it is. What am I missing? -Cameron