[App Server] Starting at boot

Admin note: Moved from the Announcements thread. If you have a question, please make a new thread in the Q&A section!

Thanks a lot and the open source app server was a great idea and works very well and there’s nothing else like it!

I got the app server to work on Linux and it is a really elegant solution with everything packaged in one installation and for the full stack!
It does however require manual user startup through the:
anvil-app-server --app
command and I would like to get it to start up with the Linux OS. I tried using a systemd service:
Description=Anvil Material_Design_1
ExecStart=/home/anvil/env/bin/python /home/anvil/env/bin/anvil-app-server --app Material_Design_1 > /home/anvil/Material_Design_1.log 2>&1

but it does not start successfully as a service and I get the following error:
Material_Design_1.service - Anvil Material_Design_1
Loaded: loaded (/etc/systemd/system/Material_Design_1.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2021-09-21 17:13:29 SAST; 22min ago
Sep 21 17:13:29 raspberrypi python[12481]: --microsoft-app-id APP_ID App ID to use for Microsoft authentSep 21 17:13:29 raspberrypi systemd[1]: Material_Design_1.service: Main process exited, code=exited, status=1/FAILURE
Sep 21 17:13:29 raspberrypi systemd[1]: Material_Design_1.service: Failed with result ‘exit-code’.

The manual startup from the terminal does work.

Is there perhaps a solution or guide on how to get the app server to start automatically with startup of the OS?




ExecStart does not execute in a shell environment so redirection of stdout and stderr will not work like that. You can use StandardOutput and StandardError options in your service file (see the systemd documentation for details).

1 Like

Thanks for the help and advice. I removed the stdout part of ExecStart and then it started up and works! So now I have the app server starting with the OS boot and I can view the status by using systemctl status.

1 Like

you can avoid this problem by using:
ExecStart=/bin/bash -c “/home/anvil/env/bin/python /home/anvil/env/bin/anvil-app-server --app Material_Design_1 > /home/anvil/Material_Design_1.log 2>&1”

1 Like