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

Automated ARM builds #418

Closed
coolaj86 opened this issue Feb 22, 2015 · 29 comments
Closed

Automated ARM builds #418

coolaj86 opened this issue Feb 22, 2015 · 29 comments

Comments

@coolaj86
Copy link
Contributor

I would be happy to build arm6 and arm7 bins for both sqlite3 and sqlcipher.

v0.10 and v1.2 work

v0.11 and <= v1.1 fail

v0.12 I haven't tested.

I have internet-accessible PIs connected to a few routers that I can offer for such a task.

@springmeyer
Copy link
Contributor

We build all binaries on travis (for linux and mac) and appveyor (for windows). What would be very useful is a travis job that used qemu or something like it to build rpi binaries. @bander9289 has been experimenting with this (and I've been meaning to learn but not had time yet): mapnik/mapnik-packaging@master...bander9289:master#diff-7142a27433410bb3f7e3ae34a1674807R16

@coolaj86 - interested in providing a pull request adding rpi build support to travis.yml?

/cc @mojodna who may also be interested in this effort.

@mojodna
Copy link

mojodna commented May 5, 2015

Hmm. Interested I am, yet not yet needing it. Thanks.

@coolaj86
Copy link
Contributor Author

coolaj86 commented May 5, 2015

My work on embedded systems has lead me to believe that emulation is no substitution for compiling on the real deal, so I wait the 15+ minutes out when I need it.

I'm open to trying something like Qemu, but it would probably be easier for me to set up a Pi as a build server than to learn Qemu and what special compile options I'd need to pass and such.

What are the advantages of Qemu that make you prefer that solution?

@alexellis
Copy link

@coolaj86 does it not come down to automation, automation, automation and repeatability? If I were to take a binary for sqlite3 instead of source, then I'd definitely want it to have been built through the 'trusted' channels - not a third party. Having said that something really needs to be done #597

@marvinroger
Copy link

Scaleway baremetals ARMv7 servers, might help here. Each build, assuming it would last less than 59 minutes, would cost €0.006.

Moreover, with their CLI, create, start and SSH into a server is as easy as:

$ scw exec $(scw start --wait $(scw create ubuntu-trusty)) /bin/bash
[root@noname ~]#

Note I am not affiliated to them in any way, that's just how I handle my personal Docker builds. 😉

@kkaefer
Copy link
Contributor

kkaefer commented Dec 21, 2016

Note that we don't have build on ARMv7; instead we could also cross-compile.

@alexellis
Copy link

The build takes a ridiculous amount of time to complete especially on the Pi Zero - that I'd give up on sqllite or use python. Please provide a binary through npm to support continued use.

@skl
Copy link

skl commented Feb 14, 2017

I've automated an ARM build with Vagrant, Docker (as opposed to chroot in @bander9289's approach) and QEMU which is one option for an overall npm install use case for ARM targets - whilst being able to build on a more powerful machine. I haven't open sourced it yet but this is the general idea that I use for sqlite3 and bcrypt:

  1. Spin up a single-core vagrant box with "debian/jessie64"
  2. Install docker-engine and qemu-user-static in the vm
  3. Spin up a docker container with docker run -it --volume /usr/bin/qemu-arm-static:/usr/bin/qemu-arm-static philipz/rpi-raspbian bash
  4. Install build-essential and nodejs in the container
  5. npm install inside the container

I was not able to get a full QEMU ARM VM running but I did have success with the QEMU User Mode emulation as above. So it runs only the docker process under ARM emulation rather than providing a full virtual machine.

One major drawback of either QEMU approach is that is only supports a single thread, so for example I could not install Git LFS within the ARM docker container as Go binaries cannot be run through QEMU due to the concurrency aspects of the language. So my advice is do as much as you can within the "host VM" then delegate the ARM portions to the container.

Maybe some of the above could help for the Travis build? Cross-compilation would be ideal but it didn't seem straight forward to me, that's why I went the QEMU route instead as it also covers other npm modules at the same time.

@StefanScherer
Copy link

@skl What about using Travis or at least using the steps described here: https://blog.hypriot.com/post/setup-simple-ci-pipeline-for-arm-images/

@skl
Copy link

skl commented Feb 14, 2017

Thanks for the article, uses the same principal and applies it to Travis. Just in my case I need private builds for work.

@springmeyer
Copy link
Contributor

Anyone want to try getting qemu running on travis (within docker as a bonus) so we can start building and publishing binaries for ARM/rasp?

@thom-nic
Copy link

Cross-post from #996: this comment looks like it has a workable path for an ARM environment on Travis: travis-ci/travis-ci#3376 (comment) similar to @skl's solution, except it looks like a "docker in docker." Have not tested myself.

@rzr
Copy link
Contributor

rzr commented Jul 23, 2018

An other option would be to submit a deb package of node-sqlite3 to debian then use if on raspbian...

Well I can try to hack to Docker file to build package.

Edit:

https://tracker.debian.org/pkg/node-sqlite3

while not in Raspbian yet ?

http://archive.raspberrypi.org/debian/pool/main/n/

rzr added a commit to CrossStream/node-sqlite3 that referenced this issue Jul 24, 2018
Change-Id: I79000463955d16eec8809c870f7d02c60da53432
Bug: TryGhost#418
Origin: https://github.com/tizenteam/node-sqlite3
Signed-off-by: Philippe Coval <p.coval@samsung.com>
rzr added a commit to CrossStream/node-sqlite3 that referenced this issue Jul 24, 2018
Change-Id: I79000463955d16eec8809c870f7d02c60da53432
Bug: TryGhost#418
Origin: https://github.com/tizenteam/node-sqlite3
Signed-off-by: Philippe Coval <p.coval@samsung.com>
rzr added a commit to CrossStream/node-sqlite3 that referenced this issue Jul 24, 2018
It was build on Raspbian using docker and binfmt+qemu

Usage:
    curl -sL https://rawgit.com/$org/$project/$branch/run.sh | bash -x -
    ls tmp/out/node-sqlite3/sqlite3-*.tgz

Or run.sh can be run insources

Change-Id: I79000463955d16eec8809c870f7d02c60da53432
Bug: TryGhost#418
Origin: https://github.com/tizenteam/node-sqlite3
Signed-off-by: Philippe Coval <p.coval@samsung.com>
rzr added a commit to CrossStream/node-sqlite3 that referenced this issue Jul 24, 2018
It was build on Raspbian using docker and binfmt+qemu

Usage:

    curl -sL https://rawgit.com/$org/$project/$branch/run.sh | bash -x -
    ls tmp/out/node-sqlite3/sqlite3-*.tgz

Or run.sh can be run insources

Change-Id: I79000463955d16eec8809c870f7d02c60da53432
Bug: TryGhost#418
Forwarded: TryGhost#1028
Origin: https://github.com/tizenteam/node-sqlite3
Signed-off-by: Philippe Coval <p.coval@samsung.com>
rzr added a commit to CrossStream/node-sqlite3 that referenced this issue Jul 24, 2018
It was built on Raspbian using docker and binfmt+qemu

Usage:

    curl -sL https://rawgit.com/$org/$project/$branch/run.sh | bash -x -
    ls tmp/out/node-sqlite3/sqlite3-*.tgz

Or run.sh can be run insources

Change-Id: I79000463955d16eec8809c870f7d02c60da53432
Bug: TryGhost#418
Forwarded: TryGhost#1028
Origin: https://github.com/tizenteam/node-sqlite3
Signed-off-by: Philippe Coval <p.coval@samsung.com>
@rzr
Copy link
Contributor

rzr commented Jul 24, 2018

@springmeyer would that help ? then we can tune travis for it mentoring welcome

@rzr
Copy link
Contributor

rzr commented Aug 5, 2018

Do you then want to do continuous delivery ? if yes can you recommend a service to host built packages ?

rzr added a commit to CrossStream/node-sqlite3 that referenced this issue Aug 9, 2018
It was built on Raspbian using docker and binfmt+qemu

Usage:

    curl -sL https://rawgit.com/$org/$project/$branch/run.sh | bash -x -
    ls tmp/out/node-sqlite3/sqlite3-*.tgz

Or run.sh can be run insources

Change-Id: I79000463955d16eec8809c870f7d02c60da53432
Bug: TryGhost#418
Forwarded: TryGhost#1028
Origin: https://github.com/tizenteam/node-sqlite3
Signed-off-by: Philippe Coval <p.coval@samsung.com>
@kewde
Copy link
Collaborator

kewde commented Jan 27, 2019

recommend a service to host built packages

There are build scripts that will automatically detect the architecture, version and upload to the S3 bucket.
You do however need to pass the environment variables from Travis to the container.

rzr added a commit to CrossStream/node-sqlite3 that referenced this issue Jan 28, 2019
This can be then declined for several arch

Change-Id: I79000463955d16eec8809c870f7d02c60da53432
Bug: TryGhost#418
Forwarded: TryGhost#1112
TryGhost#1028
Origin: https://github.com/tizenteam/node-sqlite3
Signed-off-by: Philippe Coval <p.coval@samsung.com>
rzr added a commit to CrossStream/node-sqlite3 that referenced this issue Jan 28, 2019
Just shared as demo May be changed

Change-Id: I79000463955d16eec8809c870f7d02c60da53432
Bug: TryGhost#418
Forwarded: TryGhost#1112
TryGhost#1028
Origin: https://github.com/tizenteam/node-sqlite3
Signed-off-by: Philippe Coval <p.coval@samsung.com>
rzr added a commit to CrossStream/node-sqlite3 that referenced this issue Jan 28, 2019
Usage:

    curl -sL https://rawgit.com/$org/$project/$branch/run.sh | bash -x -
    ls tmp/out/node-sqlite3/stage/sqlite3/*/node-*-*-*

Or run.sh can be run in sources

Change-Id: I79000463955d16eec8809c870f7d02c60da53432
Bug: TryGhost#418
Forwarded: TryGhost#1028
Origin: https://github.com/tizenteam/node-sqlite3
Signed-off-by: Philippe Coval <p.coval@samsung.com>
rzr added a commit to CrossStream/node-sqlite3 that referenced this issue Jan 29, 2019
Usage:
```
docker build .
```
This can be then declined for several arch, elsewhere.

Change-Id: I79000463955d16eec8809c870f7d02c60da53432
Bug: TryGhost#418
Forwarded: TryGhost#1112
TryGhost#1028
Origin: https://github.com/tizenteam/node-sqlite3
Signed-off-by: Philippe Coval <p.coval@samsung.com>
kewde pushed a commit that referenced this issue Feb 4, 2019
Usage:
```
docker build .
```
This can be then declined for several arch, elsewhere.

Change-Id: I79000463955d16eec8809c870f7d02c60da53432
Bug: #418
Forwarded: #1112
#1028
Origin: https://github.com/tizenteam/node-sqlite3
Signed-off-by: Philippe Coval <p.coval@samsung.com>
@rzr
Copy link
Contributor

rzr commented Feb 28, 2019

Today, I had a look at this but I am currently blocked by:

nodejs/node#26353

@tkurki
Copy link

tkurki commented Apr 17, 2019

Hmm. Isn't this actually a lot simpler?

You don't have to build a Docker container, if you have a prebuilt Node container for the target architecture.

For example on a Docker host that has bin_fmt support for ARM (like my Macbook) you can build & publish node-sqlite3 with a single command:

docker run -it --rm -v "$(pwd)":/build arm32v7/node:8 bash -c  'cd /build && npm install --unsafe-perm --build-from-source && node_modules/.bin/node-pre-gyp package testpackage publish info'

I don't have the credentials for the s3 upload, so naturally publish fails for me, so this is not tested end to end.

So: if we add something like

#!/usr/bin/env bash

docker run --rm --privileged multiarch/qemu-user-static:register --reset
mkdir tmp && pushd tmp && curl -L -o qemu-arm-static.tar.gz https://github.com/multiarch/qemu-user-static/releases/download/v2.11.0/qemu-arm-static.tar.gz && tar xzf qemu-arm-static.tar.gz && popd
docker run -it --rm -v "$(pwd)":/build arm32v7/node:8 bash -c  'cd /build && npm install --unsafe-perm --build-from-source && node_modules/.bin/node-pre-gyp package testpackage publish info'

as scripts/build_arm_with_docker.sh, add Docker support to .travis.yml and trigger the script from Travis build I believe we have a pretty elegant way to produce prebuilt ARM binaries!

Look, ma', no Dockerfile needed.

@tkurki
Copy link

tkurki commented Apr 18, 2019

See #1149 for a working example of the idea in the previous message.

rzr added a commit to CrossStream/node-sqlite3 that referenced this issue May 25, 2019
Raspbian is used as base

It took less than 20 min to build on Ubuntu 18.04 x86_64

If merged other arch will come next, and then automated by CI.

Relate-to: TryGhost#418
Change-Id: Ic92baf3e019e28862a24d84728835a641a6838c1
Signed-off-by: Philippe Coval <p.coval@samsung.com>
rzr added a commit to CrossStream/node-sqlite3 that referenced this issue May 25, 2019
Raspbian is used as base

It took less than 20 min to build on Ubuntu 18.04 x86_64

If merged other arch will come next, and then automated by CI.

Relate-to: TryGhost#418
Change-Id: Ic92baf3e019e28862a24d84728835a641a6838c1
Forwarded: TryGhost#1169
Signed-off-by: Philippe Coval <p.coval@samsung.com>
kewde pushed a commit that referenced this issue Jul 8, 2019
Raspbian is used as base

It took less than 20 min to build on Ubuntu 18.04 x86_64

If merged other arch will come next, and then automated by CI.

Relate-to: #418
Change-Id: Ic92baf3e019e28862a24d84728835a641a6838c1
Forwarded: #1169
Signed-off-by: Philippe Coval <p.coval@samsung.com>
rzr added a commit to CrossStream/node-sqlite3 that referenced this issue Sep 30, 2019
Just shared as demo May be changed

Change-Id: I79000463955d16eec8809c870f7d02c60da53432
Bug: TryGhost#418
Forwarded: TryGhost#1112
TryGhost#1028
Origin: https://github.com/tizenteam/node-sqlite3
Signed-off-by: Philippe Coval <p.coval@samsung.com>
rzr added a commit to CrossStream/node-sqlite3 that referenced this issue Sep 30, 2019
Usage:

    curl -sL https://rawgit.com/$org/$project/$branch/run.sh | bash -x -
    ls tmp/out/node-sqlite3/stage/sqlite3/*/node-*-*-*

Or run.sh can be run in sources

Change-Id: I79000463955d16eec8809c870f7d02c60da53432
Bug: TryGhost#418
Forwarded: TryGhost#1028
Origin: https://github.com/tizenteam/node-sqlite3
Signed-off-by: Philippe Coval <p.coval@samsung.com>
@xPaw
Copy link
Contributor

xPaw commented Jul 1, 2020

#1147 was merged, is there any blocker on hooking that up to the CI?

rzr added a commit to CrossStream/node-sqlite3 that referenced this issue Jul 1, 2020
Change-Id: I79000463955d16eec8809c870f7d02c60da53432
Bug: TryGhost#418
Relate-to: TryGhost#1028
Origin: https://github.com/tizenteam/node-sqlite3
Signed-off-by: Philippe Coval <rzr@users.sf.net>
rzr added a commit to CrossStream/node-sqlite3 that referenced this issue Jul 1, 2020
Just shared as demo May be changed

Change-Id: I79000463955d16eec8809c870f7d02c60da53432
Bug: TryGhost#418
Forwarded: TryGhost#1112
TryGhost#1028
Origin: https://github.com/tizenteam/node-sqlite3
Signed-off-by: Philippe Coval <p.coval@samsung.com>
rzr added a commit to CrossStream/node-sqlite3 that referenced this issue Jul 1, 2020
Usage:

    curl -sL https://rawgit.com/$org/$project/$branch/run.sh | bash -x -
    ls tmp/out/node-sqlite3/stage/sqlite3/*/node-*-*-*

Or run.sh can be run in sources

Change-Id: I79000463955d16eec8809c870f7d02c60da53432
Bug: TryGhost#418
Forwarded: TryGhost#1028
Origin: https://github.com/tizenteam/node-sqlite3
Signed-off-by: Philippe Coval <p.coval@samsung.com>
rzr added a commit to CrossStream/node-sqlite3 that referenced this issue Jul 1, 2020
Usage:

    curl -sL https://rawgit.com/$org/$project/$branch/run.sh | bash -x -
    ls tmp/out/node-sqlite3/stage/sqlite3/*/node-*-*-*

Or run.sh can be run in sources

Change-Id: I79000463955d16eec8809c870f7d02c60da53432
Bug: TryGhost#418
Forwarded: TryGhost#1028
Origin: https://github.com/tizenteam/node-sqlite3
Signed-off-by: Philippe Coval <p.coval@samsung.com>
rzr added a commit to CrossStream/node-sqlite3 that referenced this issue Jul 1, 2020
Just shared as demo May be changed

Change-Id: I79000463955d16eec8809c870f7d02c60da53432
Bug: TryGhost#418
Forwarded: TryGhost#1112
TryGhost#1028
Origin: https://github.com/tizenteam/node-sqlite3
Signed-off-by: Philippe Coval <p.coval@samsung.com>
rzr added a commit to CrossStream/node-sqlite3 that referenced this issue Jul 1, 2020
Usage:

    curl -sL https://rawgit.com/$org/$project/$branch/run.sh | bash -x -
    ls tmp/out/node-sqlite3/stage/sqlite3/*/node-*-*-*

Or run.sh can be run in sources

Change-Id: I79000463955d16eec8809c870f7d02c60da53432
Bug: TryGhost#418
Forwarded: TryGhost#1028
Origin: https://github.com/tizenteam/node-sqlite3
Signed-off-by: Philippe Coval <p.coval@samsung.com>
kewde pushed a commit that referenced this issue Jul 2, 2020
Change-Id: I79000463955d16eec8809c870f7d02c60da53432
Bug: #418
Relate-to: #1028
Origin: https://github.com/tizenteam/node-sqlite3
Signed-off-by: Philippe Coval <rzr@users.sf.net>
@n1ru4l
Copy link

n1ru4l commented Jul 22, 2020

I created #1362 which seems a bit less complicated and also provides alpine binaries. The only thing missing is anyone reviewing it and a repo maintainer setting S3 bucket credentials.

@daniellockyer
Copy link
Member

This is done, pending release - please see my comment here: #1362 (comment) 🙂

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

Successfully merging a pull request may close this issue.