I can start my web app with a make run
just fine. When I start it with Systemd I can see the initialization steps succeed, I see the lisp *
prompt but instantly after I get this error:
* ;
; compilation unit aborted
; caught 1 fatal ERROR condition
What's going on, what am I missing?
My .service file:
[Unit]
Description=my app
[Service]
WorkingDirectory=/home/vince/projets/myapp/
ExecStart=/usr/bin/make run
Type=simple
Restart=on-failure
My run script does the following:
;; (eval-when (:compile-toplevel :load-toplevel :execute))
(load "myapp.asd")
(unless (ql:quickload "myapp")
(uiop:quit 1))
(handler-case
(progn
(uiop:format! t "-------- start app…") ;; so far so good
(myapp:startapp :port (ignore-errors (parse-integer (uiop:getenv "PORT")))))
(error (c)
(format *error-output* "~&An error occured: ~a~&" c)
;; edit:
(trivial-backtrace:print-backtrace c)))
This starts the Hunchentoot web server.
and I start SBCL with the following switches (not that in makes a difference, with or without the switches it works fine):
LISP ?= /usr/bin/sbcl --core /home/vince/projets/ciel/ciel --disable-debugger --userinit /home/vince/.sbclrc
status:
$ sudo systemctl status myapp.service *[master]
● cmdcollectivites.service - myapp.
Loaded: loaded (/etc/systemd/system/myapp.service; static; vendor preset: enabled)
Active: inactive (dead)
Jun 09 11:22:48 pommier make[31598]: Loading config file...
Jun 09 11:22:48 pommier make[31598]: Starting the web server on port 9999
Jun 09 11:22:48 pommier make[31598]: ✔ Ready. You can access the application!
Jun 09 11:22:48 pommier make[31598]: * ;
Jun 09 11:22:48 pommier make[31598]: ; compilation unit aborted
Jun 09 11:22:48 pommier make[31598]: ; caught 1 fatal ERROR condition
lines 1-14/14 (END)
There's something that Systemd expects but that CL is not giving. What about the Lisp prompt?
SBCL 1.4.5-debian (some issues with the 2.0…)
Using handler-bind
doesn't change the output.
(handler-bind ((error (lambda (c)
(format *error-output* "~&An error occured: ~a~&" c)
(format *error-output* "~&Backtrace: ~&")
(trivial-backtrace:print-backtrace c))))
(progn
(uiop:format! t "-------- start app… --------------")
(cmdcollectivites:startapp :port (ignore-errors (parse-integer (uiop:getenv "PORT"))))))