Skip to content

Document running as a service #109

@nabeelvalley

Description

@nabeelvalley

Runnning on Raspberry pi can be done like so:

  1. create a folder at /home/<user>/coat-rack
  2. create a file at /home/<user>/coat-rack/start.sh with the following:
echo "Starting Coat Rack Server using start.sh"
/home/<user>/.local/share/pnpm/pnpm dlx @coat-rack/server

The above depends on how pnpm is installed but needs to be an absolute path to the pnpm binary

  1. create a file at /lib/systemd/system/coatrack.service with the following
[Unit]
Description=Start the coat rack server
After=network-online.target

[Service]
ExecStart=/bin/bash /home/<user>/coat-rack/start.sh
WorkingDirectory=/home/<user>/coat-rack/
StandardOutput=inherit
StandardError=inherit
Restart=always
User=<user>

[Install]
WantedBy=multi-user.target

Of course, replace the <user> with your user

Once all of this is done, you can manage everything with the following (systemd) commands:

# start/check service status
systemctl start coatrack.service
systemctl status coatrack.service

# enable service autostart
sudo systemctl enable coatrack.service

# view logs
journalctl -u coatrack.service

This is a really basic setup, would be nice if we could auto-configure this, but I think we can leave that to the raspberry pi image stuff

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions