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

multi architecture support #802

Closed
vielmetti opened this issue Apr 3, 2017 · 26 comments
Closed

multi architecture support #802

vielmetti opened this issue Apr 3, 2017 · 26 comments
Labels
suggestion Feature suggestion

Comments

@vielmetti
Copy link

vielmetti commented Apr 3, 2017

It would be great if Mastodon could run on systems other than Intel, such as Raspberry Pi, ARMv8, etc. This would get it into the hands of people with home single-board computers running their own services, plus some new data center ARM servers.

The fastest path that I can think of to doing this is to build the system with an alternative docker-compose.yml file, and have it pick up the containers appropriate to each of those other systems (e.g. armhf, aarch64).

Some dependencies to track:

Raspberry Pi

ARMv8

An additional dependency is the Dockerfile itself, for that the probably best thing to do is to make a Dockerfile.{armhf,aarch64} with the proper changes.

@vielmetti
Copy link
Author

Making progress, I hope to have a file or two in my fork to look at as WIP. There are an awful lot of dependencies in the gem file and the npm repo but nearly all of them work without incident on ARMv8.

@hyc
Copy link

hyc commented Apr 4, 2017

Haven't decided yet if this is a job for an embedded DB like LMDB, or for a network service like OpenLDAP. postgres is clearly too much of a pig for the workload though, and redis can't do anything significant to improve the situation. Caching is relatively useless when you're under an onslaught of new content. Leaning towards OpenLDAP, which would allow clustering a bunch of servers off a single set of accounts.

@vielmetti
Copy link
Author

vielmetti commented Apr 4, 2017

The referenced issue knu/ruby-unf_ext#15 notes that the unf_ext gem fails to build in its rubygems version on ARM processors, but does build from source on github due to a few extra patches applied since the gem was updated.

Three ways forward:

  • fix upstream by releasing a new version of the gem with the fix included
  • work around in Dockerfile.{armhf,aarch64} by installing from source, not from the gem
  • update the Gemfile with gem 'uef_ext', git: 'https://github.com/knu/ruby-unf_ext.git'

@vielmetti
Copy link
Author

The referenced issue npm/uid-number#3 reflects an issue where the Dockerfile builds as root, which the recent versions of npm object to.

One way forward that I found was adding npm config set unsafe-perm true to the Dockerfile.

@vielmetti
Copy link
Author

Upstream is working on the ruby unf_ext gem.

@vielmetti
Copy link
Author

The version of Ruby easily installable from apk on ARM from Alpine (2.3.3) is different from the Ruby 2.3.1 referenced in the Gemfile.

@ghost
Copy link

ghost commented Apr 6, 2017

Keep up the good work, it might help to run mastodon on an internet cube (Olimex Lime 2).

@vielmetti
Copy link
Author

@DoubleMalt
Copy link
Contributor

I tried building the mastodon Docker image on a RPi3 today.

I first built a ruby:2.4.1 image according to the dockerfile described in the docker library manifest.
The docker fileI used was from https://github.com/docker-library/ruby.git, commit e98bec810e6f1bd88ad0106f2e3b3f3291f5f5bb, directory 2.4/alpine where I just prefixed alpine in the from line with armhf.

Then I used this as the base image for my mastodon build.
As there aren't many prebuilt binaries for ARM in the NPM repository I had to add python to the BUILD_DEPS.

Then it went through the bundling and was tripped up when yarn tried to build node-sass.

The error output was

error /mastodon/node_modules/node-sass: Command failed.
Exit code: 1
Command: sh
Arguments: -c node scripts/build.js
Directory: /mastodon/node_modules/node-sass
Output:
Building: /usr/bin/node /mastodon/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [ '/usr/bin/node',
gyp verb cli   '/mastodon/node_modules/node-gyp/bin/node-gyp.js',
gyp verb cli   'rebuild',
gyp verb cli   '--verbose',
gyp verb cli   '--libsass_ext=',
gyp verb cli   '--libsass_cflags=',
gyp verb cli   '--libsass_ldflags=',
gyp verb cli   '--libsass_library=' ]
gyp info using node-gyp@3.4.0
gyp info using node@6.10.1 | linux | arm
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp ERR! UNCAUGHT EXCEPTION 
gyp ERR! stack TypeError: Cannot read property 'length' of undefined
gyp ERR! stack     at parse (/mastodon/node_modules/semver/semver.js:239:14)
gyp ERR! stack     at Function.valid (/mastodon/node_modules/semver/semver.js:255:11)
gyp ERR! stack     at processRelease (/mastodon/node_modules/node-gyp/lib/process-release.js:16:25)
gyp ERR! stack     at configure (/mastodon/node_modules/node-gyp/lib/configure.js:35:17)
gyp ERR! stack     at Object.self.commands.(anonymous function) [as configure] (/mastodon/node_modules/node-gyp/lib/node-gyp.js:66:37)
gyp ERR! stack     at run (/mastodon/node_modules/node-gyp/bin/node-gyp.js:72:30)
gyp ERR! stack     at _combinedTickCallback (internal/process/next_tick.js:73:7)
gyp ERR! stack     at process._tickCallback (internal/process/next_tick.js:104:9)
gyp ERR! System Linux 4.4.50-v7+
gyp ERR! command "/usr/bin/node" "/mastodon/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /mastodon/node_modules/node-sass
gyp ERR! node -v v6.10.1
gyp ERR! node-gyp -v v3.4.0
gyp ERR! This is a bug in `node-gyp`.
gyp ERR! Try to update node-gyp and file an Issue if it does not help:
gyp ERR!     <https://github.com/nodejs/node-gyp/issues>
Build failed with error code: 7

Tying to work from there.

@vielmetti
Copy link
Author

@DoubleMalt - you are running armhf on your Pi 3? I ask because there are distros that support arm64

@DoubleMalt
Copy link
Contributor

@vielmetti
Sent you an email to take this OT discussion elsewhere :)

@marcust
Copy link

marcust commented Apr 17, 2017

@DoubleMalt I ran into the same thing when building on arm64 and did nodejs/node-gyp#1174

Still not sure what it means, but at least that fixed the build issue.

@DoubleMalt
Copy link
Contributor

Actually if I first do npm install node-gyp (which pulls in 3.6.0), the yarn runs fine. I think the problem is that for some reason node-gyp 3.4 gets installed by yarn itself if it is not present.

@DoubleMalt
Copy link
Contributor

Found a way to minimally invasive build the Docker container on ARM(hf). Will verify if this also works on aarch64.

I had to do yarn upgrade node-sass node-gyp to make yarn upgrade the yarn.lock file. A slight draback of that is that node-gyp shows up in the package.json.

If there are some yarn whisperers here, maybe they could tell me how to only upgrade the node-gyp (which is exclusively used by node-sass).

Will submit a pull request today as a basis for further discussion.

@Gargron Gargron added suggestion Feature suggestion and removed enhancement labels Oct 20, 2018
hannahwhy pushed a commit to hannahwhy/mastodon that referenced this issue Oct 30, 2018
@SuperSandro2000
Copy link
Contributor

I don't build my arm images on real hardware cause I don't have a reasonable arm server. I always use the cross compile feature from balenlib https://github.com/SuperSandro2000/docker-images/blob/master/reddiscord/arm32v7.Dockerfile#L1 .

@J0WI
Copy link
Contributor

J0WI commented Nov 10, 2019

See also #9967

@killua99
Copy link

I'm building for amd64 and arm/v7 (soon arm64 too) I'm using hardware to build then since I got tired of these long compilations libraries. You could check it at:

@PureTryOut
Copy link

Huh, just found this issue, so I guess the Docker image isn't supported on aarch64 yet, even if I build it myself? I did try to build the image myself and although it completes successfully, running it fails and reports standard_init_linux.go:211: exec user process caused "exec format error".

According to the Dockerfile ubuntu:20.04 is used as base image and I can run just that perfectly fine. However even running something simple as bash (docker run --rm -it mastodon bash) fails in the Mastodon container, but runs fine on the standard Ubuntu one. I have no clue at all what can cause this.

The Dockerfile itself suggests that arm64 should work fine, at least for the NodeJS part, and everything else seems to be compiled from source or installed from package managers which I assume do account for different architectures.

@SuperSandro2000
Copy link
Contributor

The tini in the image is x86. This PR should solve this.

@xmflsct
Copy link

xmflsct commented Oct 20, 2020

The tini in the image is x86. This PR should solve this.

When can this be merged? I had the same issue on v3.2.1, and using your suggestion fixed the issue.

@SuperSandro2000
Copy link
Contributor

SuperSandro2000 commented Oct 21, 2020

When can this be merged?

I solved the merge conflict which I somehow missed. So, now from my side.

@killua99
Copy link

Someone has tried to compile Mastodon the last 4 month ? (even to the latest release is just 2 days old)

There is a common issue with bcrypt use on:

https://github.com/tootsuite/mastodon/blame/v3.2.1/Gemfile.lock#L177

connected with:

https://github.com/heartcombo/devise/blob/v4.7.2/Gemfile.lock#L87

bcrypt-ruby/bcrypt-ruby#201

Solution is to use the devise 4.7.3, so make a new tag on mastodon to bump this

@Bobby99as
Copy link

Bobby99as commented Aug 14, 2021

Anything new on this? It would be nice to see this working on arm

@PureTryOut
Copy link

PureTryOut commented Aug 14, 2021

It already works on arm. I'm currently running it on a RockPro64 with postmarketOS installed, that's aarch64 (arm64).

@nightpool
Copy link
Member

I'm going to close this issue since it seems like ARM support is mostly working, in the future please open individual issues for arm compatibility problems!

@xmflsct
Copy link

xmflsct commented Aug 15, 2021

I now run Mastodon on ARM, see guide here https://github.com/xmflsct/oracle-arm-mastodon.

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

No branches or pull requests