[App Server] Compatibility with M1 chip Mac

I’m trying to deploy an app I’ve created in the anvil IDE locally for testing. I used to do this on my intel machine, however lately I’ve switched to Mac, with the M1 chip. The architecture of the chip is different, ARM x64.

Here is the error:

Failed to start built-in Postgres database: java.lang.IllegalStateException: Missing postgres binaries
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? (Mac OS X/aarch64)

The error is accompanied by the following log:

[INFO io.zonky.test.db.postgres.embedded.EmbeddedPostgres] Detected a Darwin aarch64 system
[INFO io.zonky.test.db.postgres.embedded.DefaultPostgresBinaryResolver] Detected distribution: ‘Unknown’
[TRACE io.zonky.test.db.postgres.embedded.DefaultPostgresBinaryResolver] Searching for postgres binaries - location: ‘postgres-darwin-arm_64.txz’
[ERROR io.zonky.test.db.postgres.embedded.DefaultPostgresBinaryResolver] No postgres binaries were found, you must add an appropriate maven dependency that meets the following parameters - system: Darwin, architecture: arm_64

I suspect that the version of io.zonky.test.db.postgres.embedded is the issue, as it was only recently updated to be compatible with the internal macosx emulating software.

I’ve tried downloading and changing the anvil-app-server source code to call the newer version of the dependency, however re-deploying using pip has proved tricky.

Any advice would be appreciated, as I am considering returning my mac :cry:

1 Like

Hi @geraldine.teradabell,

If you’ve got it building, you should be able to make an installable package! If you follow the instructions here, you should get a folder you can install with pip. If you make a tarball from that folder (tar -zcf app-server-custom-release.tgz python-package-build/), you should be able to copy it around and pip install app-server-custom-release.tgz anywhere!

Does one of those stages not work for you?

Hi Meredydd,

After a few days of trouble shooting with the build, I am happy to report I’ve now got a custom instance which I can pip install. This installs the version with the newer io.zonky.test.db.postgres.embedded library. The app works well :slight_smile:

Please note, for people reading this in the future, I also had to reinstall psycog2 to use psql-anvil-app-server, using this method:

and if that doesn’t work straight away, I also had to run:
pip install psycopg2-binary

Thanks again!
(also I don’t have to return my new mac)

2 Likes

Hi @geraldine.teradabell – that’s great to hear!

Would you be up for submitting a pull request back to the App Server repository, so we can save more M1 Macs from the scrap-heap? :wink:

1 Like

Yes absolutely, I’ll give it a try :slight_smile:

I have the same problem and command git clone git@github.com:anvil-works/embedded-traefik.git results in

Permission denied (publickey)

How can I overcome this issue?

Hi,
I’m attempting to follow the readme at Anvil Runtime to run my own local Anvil Server on an M1 mac. When I run anvil-app-server --app MyTodoList I get this same message from this discussion thread. Are you running this server on an unusual architecture or OS? (Mac OS X/aarch64) etc.)

The only reason I’m doing this is because in this particular project I’m working with data that I don’t want stored in the cloud. I may find another solution, but I was hoping to practice making anvil apps because I have several other (cloud based) projects in mind for the future.

I ran into a few issues following @meredydd 's suggested “make an installable package” approach with the Runtime build instructions, I resolved some of those, changing node versions, etc., but I’m stuck at the ./build-all step. During the core build stage, I get

Tried to use insecure HTTP repository without TLS:
 sonatype: http://oss.sonatype.org/content/repositories/releases
 com/github/kenglxn/qrgen/javase/2.3.0/javase-2.3.0.pom

This is almost certainly a mistake; for details see
https://codeberg.org/leiningen/leiningen/src/main/doc/FAQ.md

That FAQ seems to suggest proceeding through an insecure connection as the only option, but I don’t like that.

Any suggestions? This is an old thread, so are there any others successfully running a local anvil server on a Mac with M1 chip since then?

You could try using amoni. It uses docker containers and I know of at least one person here who has it working on an M1 mac.

1 Like

Ah, of course! This is exactly the kind of thing that Docker is for. It works! Now I just have to actually build the app :slight_smile:

1 Like