New to fly.io, after heroku having free dynos removed i'm moving to fly.io, but i don't know how to use it

So i had discord bot and web-scraper bot that were working on Heroku for 2 years, but heroku decided to remove free dyno time, and now I have no option but to move to fly.io, but I ran into some problems:

  1. I installed flyctl, and it made file fly.toml, after doing research I added build packs I used on heroku:
[build]
  builder = "heroku/buildpacks:latest"
  buildpacks = ["https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest.git", "https://github.com/xrisk/heroku-opus.git", "heroku/python", "https://github.com/heroku/heroku-buildpack-google-chrome", "https://github.com/heroku/heroku-buildpack-chromedriver"]

but I got error when I deployed:

Error failed to fetch an image or build from source: downloading buildpack: extracting from https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest: inspecting buildpack blob: failed to get next tar entry: archive/tar: invalid tar header

  1. Also if one of my bots is discord only and second one is web-scrapping only, should i have worker tag for first bot and second scraper bot web tag in procfile? Like this?
worker: python KexoBOT.py
web: python KexoBOTNews.py
  1. Does fly.io support ffmpeg?

Also if u know some tips migrating from heroku to fly.io can you please tell me?

Your best bet is to build a Dockerfile for your app. We have limited support for Heroku provided buildpacks, but the third party buildpacks fail pretty often.

If you need to run two VMs for one app, the Fly.io way is to add a [processes] block to your fly.toml:

[processes]
worker = "python KexoBOT.py"
web = "python KexoBOTNews.py"
1 Like

Ok after 2 hours learning everything about dockerfiles and i finally combined one, i used optimized dockerfile from here and then i installed things my bot needed, i will share mine here if someone has same preferences:
I used this simple starter tutorial: Docker Tutorial | Learn Docker in 40 minutes - YouTube


# using ubuntu LTS version
FROM ubuntu:20.04 AS builder-image

# avoid stuck build due to user prompt
ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get update && apt-get install --no-install-recommends -y python3.9 python3.9-dev python3.9-venv python3-pip python3-wheel build-essential && \
	apt-get clean && rm -rf /var/lib/apt/lists/*

# create and activate virtual environment
# using final folder name to avoid path issues with packages
RUN python3.9 -m venv /home/yourdir/venv
ENV PATH="/home/yourdir/venv/bin:$PATH"

# install requirements
COPY requirements.txt .
RUN pip3 install --no-cache-dir wheel
RUN pip3 install --no-cache-dir -r requirements.txt

FROM ubuntu:20.04 AS runner-image
RUN apt-get update && apt-get install --no-install-recommends -y python3.9 python3-venv && \
    # Install ffmpeg and opus
    apt-get install -y ffmpeg && apt-get install libopus0 && \
    # We need wget to set up the PPA and xvfb and gnupg to have a virtual screen and unzip to install the Chromedriver
    apt-get install -y wget xvfb unzip && apt-get install gnupg -y  && \
    # Set up the Chrome PPA
    wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
    echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list && \
    # Set up the Chrome PPA
    apt-get update && apt-get install -y google-chrome-stable && \
	apt-get clean && rm -rf /var/lib/apt/lists/*


# Set up Chromedriver Environment variables
ENV CHROMEDRIVER_VERSION 2.19
ENV CHROMEDRIVER_DIR /chromedriver
RUN mkdir $CHROMEDRIVER_DIR

# Download and install Chromedriver
RUN wget -q --continue -P $CHROMEDRIVER_DIR "http://chromedriver.storage.googleapis.com/$CHROMEDRIVER_VERSION/chromedriver_linux64.zip"
RUN unzip $CHROMEDRIVER_DIR/chromedriver* -d $CHROMEDRIVER_DIR

# Put Chromedriver into the PATH
ENV PATH $CHROMEDRIVER_DIR:$PATH

RUN useradd --create-home yourdir
COPY --from=builder-image /home/yourdir/venv /home/yourdir/venv

USER yourdir
RUN mkdir /home/yourdir/code
WORKDIR /home/yourdir/code
COPY . .

EXPOSE 5000

# make sure all messages always reach console
ENV PYTHONUNBUFFERED=1

# activate virtual environment
ENV VIRTUAL_ENV=/home/yourdir/venv
ENV PATH="/home/yourdir/venv/bin:$PATH"


# /dev/shm is mapped to shared memory and should be used for gunicorn heartbeat
# this will improve performance and avoid random freezes
CMD ["gunicorn","-b", "0.0.0.0:5000", "-w", "4", "-k", "gevent", "--worker-tmp-dir", "/dev/shm", "app:app", "python KexoBOT.py", "python KexoBOTNews.py"]