Failed to start built-in Postgres database: java.io.FileNotFoundException: /anvil-data/postgres-embedding.log (Permission denied)
More logs are available in /anvil-data/postgres.log.
Some common causes of this problem:
- Are you launching this server as 'root' on a UNIX system?
Postgres will not run as root; try launching the server as an ordinary user.
- Are you running this server on an unusual architecture or OS? (Linux/amd64)
Found Anvil App Server JAR in package directory
But using the docker stock image is working: docker run -v $PWD/vegalite:/apps/MainApp -p 3030:3030 anvilworks/anvil-app-server
I know it was probably with the best intentions, but it’s best you don’t direct questions to specific people.
It often has the opposite effect to the one intended, because most people like Owen are just regular users and it puts pressure on to help when they may not be able to, and other (possibly more suitable) people might not respond thinking the matter is in hand.
I’d like to echo what @david.wylie said - we’re lucky to have such brilliant community members, but we shouldn’t take them for granted!
With regards to your errors - have you checked whether any of the error messages you’re seeing contain the answer? For example, are you running it as root, or is there anything relevant in the /anvil-data/postgres.log file?
To help you understand, my first message (about HTML field required) was read but I didn’t get any reply for days (and I’m still waiting for a reply), so I thought I should ask for help to helpful experts in their domains. I didn’t intend to offend others
the log echoes the container error: initdb: cannot be run as root. Please log in (using, e.g., "su") as the (unprivileged) user that will own the server process.
but since it’s USER anvil in the dockerfile, I don’t get what’s missing.
I finally understood a little bit more about my issue:
When I git clone, there’s no .anvil-data/
Therefore, in docker-compose.yml, the volumes section points to a non-existing local folder: - ./CRUDnewsappwalkthrough/.anvil-data:/anvil-data
And at first run, for an unknown reason, the local folder is created by root (while dockerfile and docker-compose states that only the anvil user should be used).
I guess only command uses the user setting, not internal docker actions.
Since anvil user in the container is UID 1000, same as my local user, I manually created .anvil-data/, it did the trick. I now have the data folder populated, no postgres error, migration is done creating tables.
And now docker-compose runs … except that it results in a weird page:
Found Anvil App Server JAR in package directory
Found 2 migration(s) for (base runtime) DB.
Executing Anvil migrations...
Database currently at "2021-06-19-runtime-sessions"
0 migration(s) to perform.
Database now at "2021-06-19-runtime-sessions"
Migration complete.
[TRACE anvil.app-server.run] Invalidating; new version 1
[INFO anvil.core.server] HTTP Server running on port 3030
[INFO anvil.app-server.run] App URL: http://localhost:3030
[INFO anvil.app-server.dispatch] Launching built-in downlink...
[INFO anvil.app-server.run] SMTP Server running on port 25
Connecting to ws://localhost:3030/_/downlink
Anvil websocket open
[INFO anvil.executors.downlink] Downlink client connected with spec {:runtime "python3-full", :session_id "IBy8yul9FKInRkoOBdzh"}
Downlink authenticated OK
[INFO anvil.app-server.run] [LOG :new-session] {:type browser}