Deploying node sveltekit with systemd web socket? [closed]

I’m trying to push out my first svelte project to better understand how it all works, but I’m struggling to get my systemd socket path working.

When I start my project including the sveltekit node adapter environment variable: SOCKET_PATH=/run/app-store-frontend.sock

I get this error from systemd:
Error: listen EADDRINUSE: address already in use /run/app-store-frontend.sock

https://kit.svelte.dev/docs/adapter-node
Based on the docs I saw that there is a variable for SOCKET_PATH which I used, but it seems to conflict with systemd’s socket. I’m a bit unclear how I should proceed to connect my node to systemd’s websocket?

Here are the files I’m using:

app-store-frontend.socket

[Unit]
Description=Node for App Store Frontend socket

[Socket]
ListenStream=/run/app-store-frontend.sock
User=www-data

[Install]
WantedBy=sockets.target

app-store-frontend.service

[Unit]
Description=Using node to serve frontend for App Store Dash
StartLimitBurst=3
StartLimitIntervalSec=30
After=network.target

[Service]
Type=simple
User=ubuntu
Group=ubuntu
WorkingDirectory=/home/ubuntu/app-store-dash/frontend
Environment=NODE_ENV=production SOCKET_PATH=/run/app-store-frontend.sock
ExecStart=/usr/local/bin/node /home/ubuntu/app-store-dash/frontend/build
ExecReload=/bin/kill -s HUP $MAINPID
Restart=on-failure
KillMode=mixed
PrivateTmp=true

[Install]
WantedBy=multi-user.target

  • 2

    I’m voting to close this question because as the systemd tag states: systemd questions should be for programming questions using systemd or its libraries. Questions about configuring the daemon (including writing unit files) are better directed to (Unix & Linux Stack Exchange)[unix.stackexchange.com]. Please delete this.

    – 

  • @Rob is it ok if I just remove the systemd tag and leave it as a Svelte / node question?

    – 

  • @Rob I added a statement to further clarify that the issue happens for sveltekit’s node adapter when the SOCKET_PATH variable is set. If you still think this does not belong on SO just let me know.

    – 

  • The tag does not make your question off topic. Questions about systemd are off topic unto themselves.

    – 

Leave a Comment