Static Image Export - Heroku, Orca and slug sizes

Hi everyone,

I’m trying to get static image exporting to work on Heroku. Static image exporting requires orca to be installed, which I have achieved by:

  1. conda buildpack (https://github.com/pl31/heroku-buildpack-conda.git)
  2. Set environment.yml to
name: myproject 
channels:
- plotly
dependencies:
- python=3.6
- plotly-orca

Then to install the orca dependencies libgtk2.0-0, libgconf-2-4 and google-chrome-stable I use:

  1. apt buildpack (https://github.com/heroku/heroku-buildpack-apt)
  2. Set Aptfile to
libgtk2.0-0
libgconf-2-4
chromium-browser

Problem

This creates a compressed slug of size 538.1M, which is above the max size of 500MB.

Is there a way around this?

For example a smaller version of chromium, with only the minimum required dependencies.

@sjtrny I’m having the same issue. Did you discover a workaround?

No sorry I gave up on this idea.

Incidentally I had to revisit this idea. The solution I found was just to use chart studio to generate the image files inspired by Static image generation only possible with `orca`?. However I am limited to using PNGs as I only have a free account. You will need to get a paid chart studio account for greater control over image formats.

Alternatively you can setup your own external Orca server and then configure your app to use a different server URL. You can find details on this page https://plotly.com/python/orca-management/#other-configuration-settings

@sjtrny I was able to get Orca working on Heroku using Docker. Here is the code I used in my Dockerfile:

RUN apt-get update && \
    apt-get install -y --no-install-recommends \
        wget \
        xvfb \
        xauth \
        libgtk2.0-0 \
        libxtst6 \
        libxss1 \
        libgconf-2-4 \
        libnss3 \
        libasound2 && \
    mkdir -p /opt/orca && \
    cd /opt/orca && \
    wget https://github.com/plotly/orca/releases/download/v1.2.1/orca-1.2.1-x86_64.AppImage && \
    chmod +x orca-1.2.1-x86_64.AppImage && \
    ./orca-1.2.1-x86_64.AppImage --appimage-extract && \
    rm orca-1.2.1-x86_64.AppImage && \
    printf '#!/bin/bash \nxvfb-run --auto-servernum --server-args "-screen 0 640x480x24" /opt/orca/squashfs-root/app/orca "$@"' > /usr/bin/orca && \
    chmod +x /usr/bin/orca
1 Like

@camdenb Wow thank you! I didn’t know that Docker was supported on Heroku.