From ba5c49ee5f42cf2ca608806bff588c4d471ffdf0 Mon Sep 17 00:00:00 2001 From: Eskild Hustvedt Date: Thu, 25 Apr 2024 15:04:33 +0200 Subject: [PATCH] Fixed the Cookbook systemd unit to use Environment= for NODE_ENV ExecStart is not run with /bin/sh, so setting NODE_ENV there doesn't work and results in: Failed at step EXEC spawning NODE_ENV=production: No such file or directory. Setting NODE_ENV in an Environment="" fixes this. --- docs/Cookbook.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/Cookbook.md b/docs/Cookbook.md index 5a178c1a..074646f5 100644 --- a/docs/Cookbook.md +++ b/docs/Cookbook.md @@ -110,7 +110,8 @@ After=network.target [Service] Type=simple User=sri -ExecStart=NODE_ENV=production node /home/sri/myapp/myapp.js server -l http://*:8080 +Environment="NODE_ENV=production" +ExecStart=node /home/sri/myapp/myapp.js server -l http://*:8080 [Install] WantedBy=multi-user.target @@ -136,7 +137,7 @@ You can even use systemd for your server as file descriptor `3`, so all you have to do is to use a slightly different listen option. ``` -ExecStart=NODE_ENV=production node /home/sri/myapp/myapp.js server -l http://*?fd=3 +ExecStart=node /home/sri/myapp/myapp.js server -l http://*?fd=3 ``` ### Reloading