[App Server] Deploy on Azure App Service

I’m attempting to publish an Anvil app as an Azure App Service. Currently I get a mangled authentication page or a generic “This app has experienced an error - Exception: Connection to server failed (error)” (depending on browser). Try for yourself. Logs from the container are below and don’t show any problems.

2021-04-15T16:37:01.351330179Z Database is uninitialised. Setting up Anvil database from scratch…
2021-04-15T16:37:01.678403770Z Setup complete.
2021-04-15T16:37:01.679308260Z Database now at “2020-08-20-A-app-environments”
2021-04-15T16:37:05.054166035Z [TRACE anvil.app-server.run] Invalidating; new version 1
2021-04-15T16:37:05.667011675Z [INFO anvil.core.server] HTTP Server running on port 3030
2021-04-15T16:37:05.673808498Z [INFO anvil.app-server.run] App URL: http://localhost:3030
2021-04-15T16:37:05.683097593Z [INFO anvil.app-server.dispatch] Launching built-in downlink…
2021-04-15T16:37:05.720194571Z [ERROR anvil.app-server.run] Failed to start mail server on port 25 - this application will not be able to receive email: java.net.BindException: Permission denied (Bind failed)
2021-04-15T16:37:07.448506345Z [DEBUG anvil.runtime.server] Couldn’t load app nil
2021-04-15T16:37:07.946709287Z [INFO anvil.executors.downlink] Downlink client connected with spec {:runtime “python3-full”, :session_id “zUm6lSBmtYuduwij5GEm”}
2021-04-15T16:37:09.184021736Z [TRACE anvil.runtime.server] Serve app:YAML loaded completed in 498 ms
2021-04-15T16:37:09.191853247Z [TRACE anvil.runtime.server] Serve app:Google configured completed in 506 ms
2021-04-15T16:37:09.195476706Z [DEBUG anvil.runtime.server] Serving app Template2050Calculator
2021-04-15T16:37:09.196197998Z [INFO anvil.app-server.run] [LOG :new-session] {:type browser}
2021-04-15T16:37:09.276529186Z [TRACE anvil.runtime.server] Serve app completed in 591 ms

2021-04-15T16:39:12.210735376Z [TRACE anvil.runtime.server] Serve app:YAML loaded completed in 336 ms
2021-04-15T16:39:12.211474167Z [TRACE anvil.runtime.server] Serve app:Google configured completed in 345 ms
2021-04-15T16:39:12.212109359Z [DEBUG anvil.runtime.server] Serving app Template2050Calculator
2021-04-15T16:39:12.212788651Z [INFO anvil.app-server.run] [LOG :new-session] {:type browser}
2021-04-15T16:39:12.284996996Z [TRACE anvil.runtime.server] Serve app completed in 419 ms

My fiddling around so far makes me think this is something to do with running behind a reverse proxy as I can pull the Docker image and run the app locally without any problem. The service is currently being launched with the command anvil-app-server --data-dir /anvil-data --app /apps/MyApp --disable-tls --port 3030. The later options prevent Anvil from trying to run its own reverse proxy.

I can also recreate the problem locally by trying to run with a reverse proxy (Caddy).

And of course I figure it out straight after posting… Needed to add --origin https://... to the launch command, now working nicely.

2 Likes

Hi.
I got the same idea of deploying as an azure app service.
I am wondering, how you are operating the database: i fail to use a mounted azure storage as a persisted storage, because it looks like i can not set the mounted folders ownership (chmod).
How did you set up the database?