Isn't there a way to get 1 dedicated CPU with less RAM?

I can’t use Alpine on my app since I need other packages that AFAIK are not available for Alpine.

I will try to deploy this repro with Ubuntu now and see how it goes…

I’ve tried to deploy with Ubuntu but it failed every time. It ran fine when I build the Docker image and ran it locally, but when deploying to Fly the health checks didn’t pass.

To make it work I had to delete the Fly app I was trying to deploy to and the builder. I also changed the region from AMS to DFW.

It’s running in Ubuntu now in DFW and performing as expected.

{
  "startTime":"2022-06-29T17:50:53.105Z",
  "endTime":"2022-06-29T17:50:53.232Z",
  "totalTimeSeconds":0.127
}

Could this be an AMS issue?

I’ve pushed the changes to the repo.

So after a lot of hair pulling and tears I found the culprit of the issue.

It’s a package called mediainfo that I’m using to get information about the audio (length, codec, etc).

It works as expected on macOS but when deploying to Fly it just hangs and seems to consume all CPU which is why I assumed the issue was with ffmpeg. I tried it on a VPS with Ubuntu and I get the same behavior… so there’s that.

Sorry to have wasted your time @jerome

You haven’t wasted my time. Always enjoy a troubleshooting session!

So how do you fix it?

Instead of using mediainfo I switched to using ffprobe.

The transition was easy, except for the fact that when I did brew install ffprobe (to be able to use it locally outside of Docker) not only it failed but somehow it broke another package called audiowaveform.

I ended up installing the ffprobe binary manually but I’ve spent the last 2 hours trying to fix audiowaveform :sweat:

One of those days…

1 Like

Hey @pier came across this thread on a semi-related note to check on ffmpeg on fly since I have concerns about OOM errors with larger files, but kept on reading and saw that you are having problems with audiowaveform

FWIW, I’m built audiowaveform from source in my Dockerfile to use within my Fly application since I need to generate waveforms, if you haven’t figured out the audiowaveform issue and would like to reference my Dockerfile on how to build successfully, please let me know :slight_smile: i spent…a long time figuring that out as well. For me, my issues were from missing shared libraries that audiowaveform needed.

Anyways hope you figured out your problem, if not, lmk!

1 Like

Thanks @uncvrd

The problems with audiowaveform were not on Docker but rather on macOS (to run the app locally during dev). Installation and building rely on Brew which honestly is a bit of a nightmare when things don’t work as expected. On Docker Ubuntu it installs fine via apt:

RUN add-apt-repository ppa:chris-needham/ppa
RUN apt -y install audiowaveform

But in the end I got rid of audiowaveform because I figured out I could just use ffmpeg to also extract the waveform data for an audio player. In fact, I think it’s a much better solution since you can also transform the audio (compress dynamics, etc) to get a better waveform.

I wrote a quick tutorial here. I will probably expand this into a blog post at some point.

2 Likes

Just curious, where is your Dockerfile? Did I miss it somewhere?

I didn’t add it unless he needed it since I didn’t want to derail to conversation too much, but here you go. It’s a two stage build which includes the process for working with the audiowaveform package and audiowmark from source.

FROM node:17 as binaryBuilder

# shared and watermark deps
RUN apt-get update && \
    apt-get install -y \
        autoconf \
        autoconf-archive \
        automake \
        build-essential \
        g++ \
        gcc \
        git \
        libfftw3-dev \
        libgcrypt20-dev \
        libmpg123-dev \
        libsndfile1-dev \
        libtool \
        libzita-resampler-dev \
        make

# waveform deps
RUN apt-get install -y \
    cmake \ 
    libboost-filesystem-dev \
    libboost-program-options-dev \
    libboost-regex-dev \
    libgd-dev \
    libmad0-dev \
    libid3tag0-dev

RUN git clone https://github.com/bbc/audiowaveform.git && \
    cd audiowaveform && \
    wget https://github.com/google/googletest/archive/release-1.11.0.tar.gz && \
    tar xzf release-1.11.0.tar.gz && \
    ln -s googletest-release-1.11.0 googletest && \
    mkdir build && \
    cd build && \
    cmake -D ENABLE_TESTS=0 .. && \
    make install

RUN git clone https://github.com/swesterfeld/audiowmark.git && \
    cd audiowmark && \
    ./autogen.sh && \
    make && \
    make install

FROM node:17 AS base

# shared and watermark deps
RUN apt-get update && \
    apt-get install -y \
    libfftw3-dev \
    libmpg123-dev \
    libsox-fmt-all \
    libsndfile1-dev \
    libzita-resampler-dev \
    sox

# waveform deps
RUN apt-get install -y \
    libboost-filesystem-dev \
    libboost-program-options-dev \
    libboost-regex-dev \
    libgd-dev

COPY --from=binaryBuilder /usr/local/bin/audiowmark /usr/local/bin/audiowmark
COPY --from=binaryBuilder /usr/local/bin/audiowaveform /usr/local/bin/audiowaveform

# Include your other Dockerfile steps here...
3 Likes