Open jd710313 opened 2 years ago
You must run this first anvil-app-server --app my_app --origin http://my_ip.com
then
sudo nano /etc/systemd/system/anvil_Jack.service
[Unit] Description=ROT13 demo service After=network.target StartLimitIntervalSec=0
[Service] Type=simple Restart=always RestartSec=1 User=[you_ubuntu_non_root_user] ExecStart=anvil-app-server --app my_app --origin http://my_ip.com [Install] WantedBy=multi-user.target
sudo chmod 644 /etc/systemd/system/anvil_Jack.service sudo systemctl enable anvil_Jack.service
sudo systemctl start anvil_Jack.service
Done
sudo systemctl stop anvil_Jack.service sudo systemctl status anvil_Jack.service
Hi @jd710313,
Are you still having this problem? My guess is that you've got something squiffly in how you're specifying your app's config, so the App Server is refusing to start and that tiny fragment of log you're seeing is the last line of the usage message (summarising the available command-line arguments). If you try printing the whole log (with journalctl
), you might see the actual error message from the App Server.
Hi @jd710313,
Are you still having this problem? My guess is that you've got something squiffly in how you're specifying your app's config, so the App Server is refusing to start and that tiny fragment of log you're seeing is the last line of the usage message (summarising the available command-line arguments). If you try printing the whole log (with
journalctl
), you might see the actual error message from the App Server.
Hi Meredyd,
Thanks I eventually got it working. I can't remember the exact solution, but looking at my notes I believe there was an unprivileged port issue for the service that I had to enable with: sudo echo 'net.ipv4.ip_unprivileged_port_start=0' > /etc/sysctl.d/50-unprivileged-ports.conf and then also enabling the service with: sudo systemctl --force --full edit Material_Design_1.service
It was running on a Raspberry Pi with their OS, so this could have been issues specific to the Pi. Anyway I got it running and it is really impressive to see this full-stack app running on a Pi!
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:
[Unit]
Description=Anvil Material_Design_1
After=multi-user.target
[Service]
Type=idle
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
WorkingDirectory=/home/anvil
User=anvil
[Install]
WantedBy=multi-user.target
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?
Thanks