Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARM support? #272

Closed
Chaphasilor opened this issue Oct 5, 2020 · 27 comments
Closed

ARM support? #272

Chaphasilor opened this issue Oct 5, 2020 · 27 comments

Comments

@Chaphasilor
Copy link

I'm trying to run umami on a Raspberry Pi 4 (arm64, running in 32-bit mode).

The problem is that prisma doesn't provide precompiled arm binaries, which causes a fatal 404 error when prisma tries to download the binaries during umami build.

I've now compiled the needed binaries myself, however I can't get prisma to use them. I'm thinking that the necessary fix for that (prisma/prisma#1329) is not yet included in the prisma version used in umami.

I've tried manually upgrading prisma to the latest version, but now I get errors about a missing prismal.yml file.

So my question is, could the prisma dependency be updated to a more recent version, i.e. one that will detect the environment variables and skip the binary download?

@mikecao
Copy link
Collaborator

mikecao commented Oct 5, 2020

It's already using the latest released version. You can always upgrade to whatever pre-release version yourself by updating the package.json.

@Chaphasilor
Copy link
Author

Alright.

Any advice on properly passing the envvars to prisma?

@mikecao
Copy link
Collaborator

mikecao commented Oct 5, 2020

You'll have to ask the prisma devs. I don't know enough about it.

@Chaphasilor
Copy link
Author

Chaphasilor commented Oct 5, 2020

Got it. Already in contact with them :)

Thanks anyway!

@Chaphasilor
Copy link
Author

I figured it out. Yay :D

@hugomd
Copy link
Contributor

hugomd commented Oct 7, 2020

I figured it out. Yay :D

@Chaphasilor Would you be able to explain how you did it in this issue? It would be nice to have as a reference if anyone else is looking to do the same. If there's enough demand, we could also look at shipping ARM docker images.

@Chaphasilor
Copy link
Author

@hugomd sure thing!
I already thought about doing this yesterday, but I simply was too exhausted.
Give me a few minutes to write down everything!

@Chaphasilor
Copy link
Author

Okay for anyone who wants to try this as well:

  1. Clone umami to your Pi. Install all dependencies and try to run npm run build.
    You should get an error where Prisma tries to download precompiled ARM binaries, which aren't available yet.
  2. Get the binaries for ARM. You can either download them from here or build them yourself. Keep in mind that building them yourself will take around 45 minutes on a Raspberry Pi 4 (4GB)
  3. Set up the correct environment variables to tell Prisma about your custom binaries.
    Insinde your umami folder, in ./prisma/.env, paste the following:
    PRISMA_QUERY_ENGINE_BINARY=<path to custom query engine binary>
    PRISMA_INTROSPECTION_ENGINE_BINARY=<path to custom introspection engine binary>
    PRISMA_MIGRATION_ENGINE_BINARY=<path to custom migration engine binary>
    PRISMA_FMT_BINARY=<path to custom prisma fmt binary>
    
  4. Now try running npm run build inside your umami folder again. You should receive a new error, about the platform arm-openssl-1.1.x being unknown. (If not, Prisma might have fixed this on their end)
  5. Clone @fabianmoronzirfas's fork (outside of the umami folder).
    cd into the folder and run git checkout origin/feature-raspberry-pi. I tried to do it without the origin part, but it didn't work for some reason.
  6. Now check if the following is true:
    • src/packages/get-platform/src/platforms.ts contains arm-openssl-1.1.x in the first two exports
    • src/packages/engine-core/src/NodeEngine.ts contains arm-openssl-1.1.x inside the knownPlatforms array
      If this is not the case, modify the two files accordingly.
  7. Execute the first 4 commands in https://github.com/fabianmoronzirfas/prisma/blob/feature-raspberry-pi/CONTRIBUTING.md
  8. If all commands executed without errors (warings about missing precompiled ARM binaries are fine), check if the two file from 6. are still modified. If for whatever reason they are not, modify them once again and run pnpm run setup again.
  9. Now go back into the umami folder, and into package.json.
    In the scripts section, replace prisma with the following: <absolute path to your clone prisma fork>/src/packages/cli/build/index.js.
    The following scripts should be affected: build-db-schema, build-db-client, build-mysql-schema, build-mysql-client, build-postgresql-schema, build-postgresql-client.
  10. Now try running npm run build again. It should hopefully work now!

I hope this helps anyone in my position :)

@Write
Copy link

Write commented Oct 25, 2020

@Chaphasilor Hi, thanks for your writeup, however i can' tfind the builds for ARM64 on your gitlab link. I also tried to build with cargo build --release but it throw an error after a while. Would you know where to find builds ? Thanks a lot.

@Chaphasilor
Copy link
Author

@Write hey, so I didn't actually use the prebuilt's I linked (found them only afterwards) but built the source myself.

Maybe you could share the error you're getting and we'll fix it that way?

@Write
Copy link

Write commented Oct 26, 2020

@Chaphasilor

Here is the error after cargo build --release. Please note that i correctly installed all prerequistes including direnv and typing direnv allow

image

Thanks for the help

@Chaphasilor
Copy link
Author

@Write I haven't encoundered that error, and it seems to be a recent change. Try reverting to an older version of the repo, should work just fine!

@Write
Copy link

Write commented Oct 26, 2020

@Chaphasilor I didn't realised AARCH64 actually meant ARM64, I successfully downloaded introspection-engine, migration-engine and query-engine builds from gitlab, but it still miss fmt binary ?

@Chaphasilor
Copy link
Author

@Write I'm not even sure you need that one...

But as I ssid, revert to an older commit (from around the time I posted my guide) and try again.
If this doesn't work I could try uploading you my binary :)

@Write
Copy link

Write commented Oct 26, 2020

Yeah i'll try multiple things and report back here, thanks for the help should be enough now ;)

@Write
Copy link

Write commented Oct 26, 2020

@Chaphasilor So the first 3 steps where enough, i didn't have issue with open-ssl.

I effectively took prisma source from ~20 days ago git checkout -b older 3012365f2e4e603dd75e4003ef67b77ade44b8ef
And then I successfully built prisma with cargo build --release . Then i built umami and it all worked !
Thanks a lot.

@Chaphasilor
Copy link
Author

i didn't have issue with open-ssl.

nice, seems like they finally fixed this

I effectively took prisma source from ~20 days ago git checkout -b older 3012365f2e4e603dd75e4003ef67b77ade44b8ef

I'm guessing you mean the prisma-engine source, not the prisma source? The prisma source is already included with umami and was causing the problems with open-ssl :)

Anyway, glad that it worked out for you! :D

@Write
Copy link

Write commented Oct 27, 2020

i didn't have issue with open-ssl.

nice, seems like they finally fixed this

I effectively took prisma source from ~20 days ago git checkout -b older 3012365f2e4e603dd75e4003ef67b77ade44b8ef

I'm guessing you mean the prisma-engine source, not the prisma source? The prisma source is already included with umami and was causing the problems with open-ssl :)

Anyway, glad that it worked out for you! :D

Yes prisma engine from your link sorry ! 😬

@Iqwertz
Copy link

Iqwertz commented Mar 9, 2021

Hi!
I am currently also trying to run umami on my rpi, but I dont have the capacity/know how to compile the binaries! So it would be great if someone could provide working binaries for prisma! Maybe a copy of the prisma folder from a working rpi installation?
Thanks!

@Chaphasilor
Copy link
Author

hey @Iqwertz,

I'm sorry but I haven't updated umami on my Pi in a while, so I can't give you a recent/supported version...

However, afaik Prisma has made improvements when it comes to ARM support (especially due to the release of the M1 Macs), so maybe you don't even have to compile anything?

Have you tried installing umami on your Pi?
If yes, what errors are you getting? :)

@Iqwertz
Copy link

Iqwertz commented Mar 11, 2021

Thanks for your reply! I was able to compile the binaries! However I now have other errors;

When I try to run npm run build I get an error about open ssl (as you predicted) But now when I follow your steps and try to run prisma with "pnpm run build" the build fails with

 ERROR  Command failed with exit code 2. Error: Error running pnpm run build in packages/debug:Error: Command failed with exit code 1: pnpm run build at makeError (/home/pi/prisma/src/node_modules/.pnpm/execa@4.0.1/node_modules/execa/lib/error.js:59:11) at handlePromise (/home/pi/prisma/src/node_modules/.pnpm/execa@4.0.1/node_modules/execa/index.js:114:26) at processTicksAndRejections (internal/process/task_queues.js:93:5) at run (/home/pi/prisma/src/scripts/setup.ts:92:5) at /home/pi/prisma/src/scripts/setup.ts:41:7 at /home/pi/prisma/src/node_modules/.pnpm/p-map@4.0.0/node_modules/p-map/index.js:57:22 at run (/home/pi/prisma/src/scripts/setup.ts:97:11) at processTicksAndRejections (internal/process/task_queues.js:93:5) at /home/pi/prisma/src/scripts/setup.ts:41:7 at /home/pi/prisma/src/node_modules/.pnpm/p-map@4.0.0/node_modules/p-map/index.js:57:22
Here are some of the errors
image

Any Idea what the problem is?

@Chaphasilor
Copy link
Author

To be honest I have no idea what the problem is. I believe the errors in the screenshot you shared are not a problem, they seem to be warnings and no break anything.

Have you followed the guide completely? And which version of the prisma-engine source code are you using?

From the previous replies it looks like newer versions might already support open-ssl, so it could be that your sources are not correct...

@Iqwertz
Copy link

Iqwertz commented Mar 11, 2021

Okay I fixed the error apparently you have to uninstall mocha with the command " sudo npm uninstall @types/mocha.
"! But now I have this error (when running sudo npm run build) which seams more umami / prisma related:

`Database type detected: postgresql
Copied /home/pi/umami/prisma/schema.postgresql.prisma to /home/pi/umami/prisma/schema.prisma

umami@1.14.0 build-db-client /home/pi/umami
dotenv /home/pi/prisma/src/packages/cli/build/index.js generate

Environment variables loaded from ./prisma/.env
Warning Precompiled binaries are not available for arm.
Warning Precompiled binaries are not available for arm.
Error: Schema parsing
error: Found argument '--enable-raw-queries' which wasn't expected, or isn't valid in this context

USAGE:
prisma-fmt

For more information try --help
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! umami@1.14.0 build-db-client: dotenv /home/pi/prisma/src/packages/cli/build/index.js generate
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the umami@1.14.0 build-db-client script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2021-03-11T18_07_49_852Z-debug.log
ERROR: "build-db-client" exited with 1.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! umami@1.14.0 build-db: npm-run-all copy-db-schema build-db-client
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the umami@1.14.0 build-db script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2021-03-11T18_07_49_913Z-debug.log
ERROR: "build-db" exited with 1.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! umami@1.14.0 build: npm-run-all build-tracker build-lang build-geo build-db build-app
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the umami@1.14.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2021-03-11T18_07_49_977Z-debug.log`

@Chaphasilor
Copy link
Author

Hmm, iirc prisma-fmt wasn't required for umami back then, or didn't have to be built by me. Not sure though...

I really have no idea how to fix this, sorry ://

@Iqwertz
Copy link

Iqwertz commented Mar 12, 2021

Okay! Thanks for youre help anyways! I will continue to dig threw the errors....

@floviolleau
Copy link

Hi,

I'm trying to achieve the same thing on a Rpi 3 b+.

I found a guy trying to make prisma builds here: https://github.com/ImBIOS/prisma-armv7-builds

He raised an issue here: prisma/prisma-engines#3881

I hope we will achieve to find a solution.
Otherwise, somebody know another alternative to umami that work on a pi easily without docker?

Thanks

@BennyDeeDev
Copy link
Contributor

Hello, I thought there would be no Umami Support for Linux ARM (Raspberry Pi), but surprisingly I found an image

ghcr.io/umami-software/umami:postgresql-v2.10.2@sha256:fd5136fda6644903b9fc7a388776ea1f3f8c77f36fdf6abc9dbec155348a37c4

By default it would not pull the arm image but the amd one, maybe we can fix that.

Anyways here is the Link where I found it: https://github.com/umami-software/umami/pkgs/container/umami

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants