Skip to content

Provide arm64 builds for shiny-server #532

Open

Description

@andresrcs

Can you consider providing arm64 builds for shiny-server the same way the RStudio IDE is providing experimental builds for arm64? If they already have the workflow in place I guess it would be simple to borrow from them?

Activity

  1. lvalnegri commented on Aug 22, 2022

    @lvalnegri
  2. andresrcs commented on Aug 22, 2022

    @andresrcs
    Author

    @lvalnegri Thanks but I know how to compile shiny-server for arm, I even have blog posts about it, the idea behind this request is to make the installation process easier and less time-consuming. I thought since other RStudio development team already has a workflow for compiling for arm, they could implement it as well.

  3. jcheng5 commented on Aug 22, 2022

    @jcheng5
    Member

    It's a good idea, thank you for the suggestion.

  4. mmuurr commented on Jan 10, 2024

    @mmuurr

    I'm curious if there's been any further discussion about, or planning for, pre-built ARM64 Shiny Server binaries.
    Apple silicon is popular (to say the least!) at this point and running via x86 emulation isn't the best.
    Specifically, pre-built ARM64 binaries would unblock this.

  5. James-G-Hill commented on Apr 6, 2024

    @James-G-Hill

    @mmuurr can you please explain / point me in the direction of the emulation you mentioned?

  6. tw0flower commented on Sep 16, 2024

    @tw0flower

    @James-G-Hill AFAIK, only UTM allows to emulate x86_64 on macOS, though you're probably going to have very poor performance.

    In my case, I'm running aarch64 Linux virtual machines on macOS to automate the deployment of Shiny Server in a production environment. The lack of packages makes it very difficult to mirror our x86_64 production environment.

    A lot of cloud providers offer aarch64 VMs and it could be first step towards supporting them as well.

    It's great to have aaarch64 builds for RStudio-Server - even if they're experimental - and I would love to see the same thing for Shiny-Server.

  7. mmuurr commented on Nov 10, 2024

    @mmuurr

    @James-G-Hill sorry for the super-late reply. If you haven't already figured it out, one solution is to use containers. And with containers there are effectively two steps required (assuming you want to build upon an image ... if you just want to run Shiny Server you may be able to skip to the second step, depending your needs).

    Step 1: Cross-platform builds

    Use the docker buildx build command with the --platform switch to build for an architecture that's (possibly) different than your builder host (e.g. your ARM64 Mac). So, for example, a possible build command might look like so:

    docker buildx build --platform linux/amd64 -f Dockerfile .
    

    The image produced will then run on a linux/amd64-based host, but will not run (without emulation) on, e.g., your ARM64 Mac. If your Dockerfile's base image is only available with linux/amd64, this is probably the best way to move forward (at the expense of emulation, described below). This is how I've dealt with Rocker's rocker/shiny-verse not supporting arm64 archs.

    You can also create images that are multi-arch, e.g. with docker buildx build --platform linux/arm64,linux/amd64 .... Then, when you want to run that image as a container, the container runtime will typically select whichever arch matches your host's native arch. (You can override this again with something like docker run --platform linux/amd64 to run a specific arch on-demand.)

    Step 2: Runtime emulation

    I don't know how this is managed on other hosts and other container runtimes (e.g. containerd or podman), but they'll all be similar to how it's done with Docker and the Apple-silicon ARM64 machines: emulation. If you go into Docker settings, you'll need to enable Rosetta emulation. Via the UI it'll look like so:
    image
    With that enabled, you'll be able to run containers targeting the amd64 (or x86_64, which is an alias) platforms. Just a standard docker run ... command should work (you won't need to specify the arch, unless, as mentioned above, you really want to run a specific arch, e.g. to test emulation, which I assume is not what you're seeking to do here :-)).


    All of this feels pretty clunky, though, and I still have some hope 🤞 that there'll eventually (pretty please, with sugar on top?) be official ARM64 Shiny Server binaries, since the Apple's M-series silicon is now well-established (and very performant) and AWS's Graviton silicon is increasingly forming the backbone of AWS's own internal infrastructure. In short, ARM64 isn't niche.

  8. philibe commented on Jan 2, 2025

    @philibe

    Post with similar direction with the @mmuurr post but on Orbstack and with standard amd64 binaries deb package from https://download3.rstudio.org/ubuntu-18.04/x86_64/shiny-server-1.5.22.1017-amd64.deb

    I've tried shiny-server on Apple M3 Pro MacOs 15.2 Orbstack 1.9.2.

    In Orbstack Linux Machine Ubuntu:

    # Enable multi-arch
    sudo dpkg --add-architecture amd64
    # Fix repos
    echo 'deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports oracular main restricted universe multiverse
    deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports oracular-updates main restricted universe multiverse
    deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports oracular-security main restricted universe multiverse
    deb [arch=amd64] http://archive.ubuntu.com/ubuntu oracular main restricted universe multiverse
    deb [arch=amd64] http://archive.ubuntu.com/ubuntu oracular-updates main restricted universe multiverse
    deb [arch=amd64] http://archive.ubuntu.com/ubuntu oracular-security main restricted universe multiverse' | sudo tee /etc/apt/sources.list.d/oracular.list
    
    # Install libraries
    sudo apt update
    sudo apt install libc6:amd64
    
    

    But I get error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory

    • Maybe not mandatory (In Orbstack Linux Machine Ubuntu)
    sudo apt-get install lib32stdc++6
    
    sudo apt-get install g++-multilib 
    

    And shiny-server.service starts without crashes :)
    (In Orbstack Linux Machine Ubuntu)

    sudo systemctl status shiny-server.service
    ● shiny-server.service - ShinyServer
         Loaded: loaded (/etc/systemd/system/shiny-server.service; enabled; preset: enabled)
         Active: active (running) since Thu 2025-01-02 22:41:39 CET; 29min ago
     Invocation: a50e81aef06f4f1381c31ea7aff2942d
       Main PID: 8052 (shiny-server)
          Tasks: 11 (limit: 10787)
         Memory: 87.4M (peak: 111.9M)
            CPU: 1.739s
         CGroup: /system.slice/shiny-server.service
                 └─8052 "[rosetta]" /opt/shiny-server/ext/node/bin/shiny-server /opt/shiny-server/ext/node/bin/shiny-server /opt/shiny-server/lib/main.js
    

    It works from a MacOs browser via Orbstack Linux Machine Ubuntu without port forwarding, because "Allow access to container domain & IPs" is checked (by default) in Orbstack / Settings / Network

    (I don't know if it works on native Ubuntu arm64.)

    Note also, not tried yet, the NEWS of release v1.5.23.1030 Sep 30, 2024

    Now works with macOS and with Linux ARM64, when built from source.

    from https://github.com/rstudio/shiny-server/blob/v1.5.23.1030/NEWS

  9. philibe commented on Jan 31, 2025

    @philibe

    Ubuntu amd64 on arm 64 is emulated since Jan 14th 2025 on the Docker of Orbstack 1.9.4:

    Install Rosetta on MacOs.

    Dockerfile:

    FROM --platform=${BUILDPLATFORM}  ubuntu:oracular AS base
    WORKDIR /
    RUN apt update -y && apt-get install -y r-base r-cran-shiny gdebi-core wget 
    RUN wget https://download3.rstudio.org/ubuntu-18.04/x86_64/shiny-server-1.5.22.1017-amd64.deb
    RUN gdebi -n shiny-server-1.5.22.1017-amd64.deb
    RUN chown -R shiny.shiny /var/lib/shiny-server
    EXPOSE 3838
    ENTRYPOINT ["/opt/shiny-server/bin/shiny-server"]
    

    Docker Build:

    • docker build --build-arg BUILDPLATFORM=linux/amd64 -t shiny-server:latest -f Dockerfile .

    Docker Run. (with 3839 on my example):

    • docker run -p 3839:3838 --platform linux/amd64 --user shiny shiny-server

    And here we are on a browser (with 3839):

    Édit:

    install.packages("shiny") works also inside this x86 docker in the same arm64 MacBook.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions