New to, after heroku having free dynos removed i'm moving to, 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, 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:
  builder = "heroku/buildpacks:latest"
  buildpacks = ["", "", "heroku/python", "", ""]

but I got error when I deployed:

Error failed to fetch an image or build from source: downloading buildpack: extracting from 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
web: python
  1. Does support ffmpeg?

Also if u know some tips migrating from heroku to 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 way is to add a [processes] block to your fly.toml:

worker = "python"
web = "python"
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 - | apt-key add - && \
    echo "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

# Download and install Chromedriver

# Put Chromedriver into the 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 . .


# make sure all messages always reach console

# 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", "", "-w", "4", "-k", "gevent", "--worker-tmp-dir", "/dev/shm", "app:app", "python", "python"]

You can use a “dockerized” python image (a docker image that has python installed by default). Have a look at this line for example…

FROM joyzoursky/python-chromedriver:3.9-selenium

This Docker image has both Python and Chrome (and Chromedriver) installed.

for further reference and for more build tags.

1 Like