All Projects → hvalev → shiny-server-arm-docker

hvalev / shiny-server-arm-docker

Licence: other
Shiny-Server in docker for ARM(armv7/arm64) and amd64. Most suitable to run on SBCs such as Raspberry Pi. Enables installing R-libraries on top of the bare image.

Programming Languages

Dockerfile
14818 projects
shell
77523 projects
r
7636 projects
python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to shiny-server-arm-docker

shinyCircos
an R/shiny application for creation of Circos plot interactively
Stars: ✭ 127 (+388.46%)
Mutual labels:  shiny, shiny-server
analytics-platform-shiny-server
Analytics Platform Shiny Server
Stars: ✭ 21 (-19.23%)
Mutual labels:  shiny, shiny-server
shinyFilters
Cascading filter modules for Shiny
Stars: ✭ 13 (-50%)
Mutual labels:  shiny, shiny-server
daattali.github.io
Dean Attali's website - R/Shiny Consultant
Stars: ✭ 51 (+96.15%)
Mutual labels:  shiny, shiny-server
workshops-setup cloud analytics machine
Tips and Tricks to setup a cloud machine for Analytics and Data Science with R, RStudio and Shiny Servers, Python and JupyterLab
Stars: ✭ 12 (-53.85%)
Mutual labels:  shiny, shiny-server
wcde-shiny
Wittgenstein Centre Data Explorer
Stars: ✭ 13 (-50%)
Mutual labels:  shiny, shiny-r
pbp-packages
Package build scripts for using Arch Linux ARM with the Pinebook Pro laptop.
Stars: ✭ 3 (-88.46%)
Mutual labels:  arm
Boost-for-Android-Prebuilt
boost for android
Stars: ✭ 58 (+123.08%)
Mutual labels:  arm
openHCAN
Hausautomatisierungsloesung auf CAN-Bus Basis.
Stars: ✭ 16 (-38.46%)
Mutual labels:  arm
IDBacApp
A MALDI Mass Spectrometry Bioinformatics Platform
Stars: ✭ 20 (-23.08%)
Mutual labels:  shiny
organisation
Organisation du soutien entre agents : moyens engagés, idées, etc.
Stars: ✭ 15 (-42.31%)
Mutual labels:  shiny
flipdownr
📆📆📆 Implement a Countdown in RMarkdown Documents and Shiny Applications
Stars: ✭ 30 (+15.38%)
Mutual labels:  shiny
embedded-in-rust
A blog about Rust and embedded stuff
Stars: ✭ 49 (+88.46%)
Mutual labels:  arm
tensorflow-aarch64
Compiled tensorflow for aarch64 architecture
Stars: ✭ 20 (-23.08%)
Mutual labels:  arm
arch-pi
A simple script automatically installing Arch Linux for the Raspberry Pi.
Stars: ✭ 38 (+46.15%)
Mutual labels:  arm
zscilib
An open-source scientific computing library for embedded systems running Zephyr OS or standalone.
Stars: ✭ 85 (+226.92%)
Mutual labels:  arm
kernel
An embedded 'Smartwatch' written in Rust
Stars: ✭ 40 (+53.85%)
Mutual labels:  arm
openmetrics
An opinionated Prometheus client for R conforming to the OpenMetrics standard
Stars: ✭ 30 (+15.38%)
Mutual labels:  shiny
vueR
vue.js for R
Stars: ✭ 131 (+403.85%)
Mutual labels:  shiny
epoxy
Extra-strength glue engines for R Markdown and Quarto
Stars: ✭ 141 (+442.31%)
Mutual labels:  shiny

Shiny Server on Docker for ARM

build R%20version Shiny%20version Docker Pulls Docker Image Size (latest by date)

Docker image hosting Shiny-Server for ARM (armv7/arm64) and AMD (amd64) architectures. The build features some fixes targeting ARM and is primarily intended to be deployed on SBCs (Single Board Computers) such as Raspberry Pi.

How to run it with docker

First we need to create the folder structure on the host, which will be used to host the shiny-server config, logs and applications.

mkdir ~/shiny-server
mkdir ~/shiny-server/logs
mkdir ~/shiny-server/conf
mkdir ~/shiny-server/apps

Then we need to copy over the server configuration from this repository as well as the hello world app to test if everything works.

git clone https://github.com/hvalev/shiny-server-arm-docker.git ~/shiny-server-arm-docker
cp ~/shiny-server-arm-docker/shiny-server.conf ~/shiny-server/conf/shiny-server.conf
cp ~/shiny-server-arm-docker/init.sh ~/shiny-server/conf/init.sh
cp -r ~/shiny-server-arm-docker/hello/ ~/shiny-server/apps/
rm -rf ~/shiny-server-arm-docker/

Run the container: docker run -d -p 3838:3838 -v ~/shiny-server/apps:/srv/shiny-server/ -v ~/shiny-server/logs:/var/log/shiny-server/ -v ~/shiny-server/conf:/etc/shiny-server/ --name shiny-server hvalev/shiny-server-arm:latest and navigate to: http://host-ip:3838/hello

How to run it with docker-compose

You need to create the folders and copy the configurations from the previous section and use the following docker-compose service:

version: "3.8"
services:
  shiny-server:
    image: hvalev/shiny-server-arm:latest
    container_name: shiny-server-arm
    ports:
      - 3838:3838
    volumes:
       - ~/shiny-server/apps:/srv/shiny-server/
       - ~/shiny-server/logs:/var/log/shiny-server/
       - ~/shiny-server/conf:/etc/shiny-server/
    restart: always

Run: docker-compose up -d and navigate to: http://host-ip:3838/hello

How to use it

The following sections will explain how you can install libraries, import apps, and configure your shiny-server image.

Installing libraries

Libraries can be installed by modifying the init.sh file under ~/shiny-server/conf. It contains and will execute the R -e "install.packages(c('lib1','lib2',...)) command the first time the container is started. Simply add the libraries you wish installed there. In order to avoid installing the same libraries on each restart, the script generates an init_done file and will not run if the file is present on the system. To add additional libraries in subsequent runs, delete the init_done file and add the new libraries to init.sh as before. Please note that installed libraries will persist between restarts as long as the container image is not removed or recreated.

Adding and configuring apps

Apps can be added to the ~/shiny-server/apps folder and will be loaded into shiny-server. If you followed the steps in so far, the hello-world app will be accessible under http://host-ip:3838/hello. You can add your own app by copying it over to the folder shiny-server/apps, where it will be available under http://host-ip:3838/yourappfolder. Be aware that each app will need to have its own configuration file under ~/shiny-server/yourappfolder/.shiny_app.conf. You can use the hello-world app as staging ground for building your new app.

Configuring shiny-server

Shiny servers' configuration file can be found under ~/shiny-server/conf/shiny-server.conf. The default settings should be sufficient, however you can also modify it according to your needs. The documentation of shiny-server is always a good place to start, when you want to tune your installation.

Troubleshooting

If you run into any trouble along the way, it might be due to permission problems. You can try running the following command: chmod -R 777 ~/shiny-server/.

Build it yourself

The Dockerfile implements a multi-stage build and will produce a functional 1GB shiny-server image equipped with all necessary libraries to build and install most R-packages. Additionally, it will leave a 4.5GB builder image behind post-build, which you can remove. Be aware that this will take at least 2 hours to build even on an SSD.

Build the container with the following command:

docker build https://github.com/hvalev/shiny-server-arm-docker.git --tag shiny-server-arm

RAM usage

To speed-up building, I have used -j4 flags when applicable to utilize multiple cores. As a result RAM consumption goes slightly over 1GB at times. Should you compile the image on devices with less RAM, make sure you allocate some swap memory beforehand.

Blas and Lapack support

Since this is an automated build, Blas and Lapack support have been included by default. If you wish to compile R without them, remove the --with-blas --with-lapack from the following statement in the Dockerfile: ./configure --enable-R-shlib --with-blas --with-lapack

Default R libraries

Although you can install R libraries post-install, you could also bake those in the image by adding them to the following run statement in the Dockerfile: RUN R -e "install.packages(c('shiny', 'Cairo'), repos='http://cran.rstudio.com/')". Cairo is needed for the hello-world preloaded app. If it's missing the histogram won't be loaded.

Node.js

I have written the determine_arch.sh script, which automagically determines the architecture it's running on, fetches the appropriate node.js checksum and replaces it in the install-node.sh file. It should be future-proof as the reference node.js version is taken from the cloned shiny-server repository itself.

Acknowledgements

The following resources were very helpful in putting this together:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].