I’m using my own thing, Arch, SQLite3, which is my own problem.
I’m able to get Ghost up and running, but not as a service. I want to know what the .service file looks like at /lib/systemd/system/ghost_${domain}.service, but I can’t find it anywhhere in the docs or searches. The best I could find anywhere was this.
I don’t mind writing my own .service file, but I want to be as close to canon as possible.
Please give me some normal contents of the Systemd file at /lib/systemd/system/ghost_${domain}.service.
I don’t use the canonical file myself. Instead a I use a Podman and a .container file, which gets converted to a .service file during boot that runs Ghost within a container via Podman.
So it’s not exactly what you asked for, but here’s what my file looks like at /etc/containers/systemd/ghost_some-domain-com.container:
# MANAGED BY ANSIBLE
[Unit]
Description=Ghost Blog for some-domain.com
After=mysql.service network-online.target
# Keys are sorted in alpha-order
[Container]
# The name structure is exactly like what Ghost would create
ContainerName=ghost_some-domain-com
Image=docker.io/ghost:5.94
Network=mysql.network
# Pick a value within 10.10.*.*.
IP=10.10.23.71
# Map the "node" user in the container with UID 1000 inside the container to custom host user.
#UIDMap=1000:1000
Volume=/data/some.domain.com/content:/var/lib/ghost/content:z
Volume=/data/hopi.domain.com/config.production.json:/var/lib/ghost/config.production.json:z
ExecStart=/usr/bin/ghost run --no-prompt -d /srv/www/ghost/domain.tld
It needs the run directive, and the -d directory flag to indicate where to start.
The start directive can be used instead of run if using the command line, but this created problems inside the .service file for ExecStart=. And, run was used in the stock file example.
Okay, I can omit the -d flag and it works because of the WorkingDirectory= parameter.
I’m a SysAdmin, I’ll tell Systemd to start the service myself. That’s why I wanted to know the ExecStart= parameter for the file.
If I understand correctly then, using start in the ExecStart= line would basically tell Systemd to start Systemd, which is probably why start broke when I used that in the line.
you can use ExecStop=/usr/bin/node /usr/bin/ghost stop
… if you wish, but as far as I know it is not necessary since the ghost server will stop when receiving the SIGINT sent by systemd whenever the server is shutdown/restarted