adr1anM to Linux@programming.dev • 5 days ago[Weekly thread] GNU+Linux help: ask anything!pinmessage-square3fedilinkarrow-up112arrow-down10
arrow-up112arrow-down1message-square[Weekly thread] GNU+Linux help: ask anything!pinadr1anM to Linux@programming.dev • 5 days agomessage-square3fedilink
minus-square@SidewaysHighways@lemmy.worldlinkfedilink2•5 days agoWhat is the best way to have caddy run at boot with env file, without running as root?
minus-squareadr1anOPMlinkfedilink2•4 days agoCreate a user, and then a systemd unit for it, under ~/.config/systemd/user/ with contents like these: [Unit] Description=Caddy web server After=network.target [Service] ExecStart=/usr/local/bin/caddy run --config /path/to/Caddyfile --envfile /path/to/Envfile ExecReload=/usr/local/bin/caddy reload --config /path/to/Caddyfile --envfile /path/to/Envfile Restart=on-failure User=caddy Group=caddy [Install] WantedBy=default.target Adjust the paths in the arguments. It will require systemctl daemon-reload for such unit to be available for enabling and starting it…
minus-squarezitrone 🍋link2•4 days agothe default systemd service will run caddy as the caddy user i think otherwise you can choose any user to run a systemd system service
What is the best way to have caddy run at boot with env file, without running as root?
Create a user, and then a systemd unit for it, under ~/.config/systemd/user/ with contents like these:
[Unit] Description=Caddy web server After=network.target [Service] ExecStart=/usr/local/bin/caddy run --config /path/to/Caddyfile --envfile /path/to/Envfile ExecReload=/usr/local/bin/caddy reload --config /path/to/Caddyfile --envfile /path/to/Envfile Restart=on-failure User=caddy Group=caddy [Install] WantedBy=default.target
Adjust the paths in the arguments. It will require systemctl daemon-reload for such unit to be available for enabling and starting it…
the default systemd service will run caddy as the caddy user i think
otherwise you can choose any user to run a systemd system service