Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

>=1.2.0 is broken #234

Closed
francoism90 opened this issue Jan 20, 2025 · 6 comments · Fixed by #235 or #236
Closed

>=1.2.0 is broken #234

francoism90 opened this issue Jan 20, 2025 · 6 comments · Fixed by #235 or #236

Comments

@francoism90
Copy link

francoism90 commented Jan 20, 2025

PR #228

(shaka-streamer) www-data@ab82dae57423:/usr/local/src/shaka-streamer/bin$ python3 shaka-streamer 
Traceback (most recent call last):
  File "/usr/local/src/shaka-streamer/bin/shaka-streamer", line 34, in <module>
    import streamer
  File "/usr/local/src/shaka-streamer/lib/python3.11/site-packages/streamer/__init__.py", line 3, in <module>
    from . import controller_node
  File "/usr/local/src/shaka-streamer/lib/python3.11/site-packages/streamer/controller_node.py", line 44, in <module>
    from streamer.proxy_node import ProxyNode
  File "/usr/local/src/shaka-streamer/lib/python3.11/site-packages/streamer/proxy_node.py", line 26, in <module>
    from streamer.cloud.pool import Pool
ModuleNotFoundError: No module named 'streamer.cloud'

It doesn't look that the PR is well tested. It is importing a module which may not exists.

Installing 1.1.1 as a workaround for now.

@francoism90 francoism90 changed the title How can you build this on Alpine (Docker)? >=1.2.0 is broken Jan 20, 2025
@joeyparrish
Copy link
Member

joeyparrish commented Jan 21, 2025

joeyparrish@penguin:~/shaka-project/shaka-streamer$ python3 ./shaka-streamer 
usage: shaka-streamer [-h] -i INPUT_CONFIG -p PIPELINE_CONFIG [-b BITRATE_CONFIG] [-c CLOUD_URL] [-o OUTPUT] [--skip-deps-check] [--use-system-binaries] [--log-configs]
shaka-streamer: error: the following arguments are required: -i/--input-config, -p/--pipeline-config

joeyparrish@penguin:~/shaka-project/shaka-streamer$ git describe --all
tags/v1.2.1

joeyparrish@penguin:~/shaka-project/shaka-streamer$ python3 --version
Python 3.11.2

joeyparrish@penguin:~/shaka-project/shaka-streamer$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 12 (bookworm)
Release:        12
Codename:       bookworm

It works for me. I'm on a debian-based container on ChromeOS.

In what way is your environment different?

@francoism90
Copy link
Author

@joeyparrish This is my Dockerfile:

FROM docker.io/dunglas/frankenphp:latest

ARG UID=1000
ARG GID=$UID

ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=UTC
ENV SERVER_NAME="localhost:8080"
ENV PHP_INI_SCAN_DIR="${PHP_INI_DIR}/conf.d"
ENV SUPERVISOR_PHP_COMMAND="php -d variables_order=EGPCS /app/artisan octane:frankenphp --caddyfile=/etc/caddy/Caddyfile --host=localhost --port=8080 --admin-port=2019 --workers=1 --max-requests=1 --watch"
ENV SUPERVISOR_PHP_USER="user"

WORKDIR /app

RUN ln -snf /usr/share/zoneinfo/${TZ} /etc/localtime \
    && echo ${TZ} > /etc/timezone

RUN apt-get update && apt-get upgrade -y

RUN apt-get install -y \
    gnupg \
    curl \
    ca-certificates \
    zip \
    unzip \
    python3 \
    python3-venv \
    python3-pip \
    git \
    supervisor \
    sqlite3 \
    libcap2-bin \
    libpng-dev \
    dnsutils \
    librsvg2-bin \
    fswatch \
    nano \
    postgresql-client \
    nodejs \
    npm \
    jpegoptim \
    optipng \
    pngquant \
    libva-drm2 \
    va-driver-all

RUN apt-get -y autoremove \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

RUN npm install -g bun svgo

RUN mkdir -p /usr/local/src && cd /usr/local/src \
    && python3 -m venv shaka-streamer \
    && . shaka-streamer/bin/activate \
    && python3 -m pip install --upgrade pip \
    && python3 -m pip install --upgrade boto3 \
    && python3 -m pip install --upgrade shaka-streamer==1.1.1 shaka-streamer-binaries \
    && deactivate

RUN ln -sf /usr/local/src/shaka-streamer/bin/shaka-streamer /usr/local/bin/shaka-streamer \
    && ln -sf /usr/local/src/shaka-streamer/lib/python3.11/site-packages/streamer_binaries/ffmpeg-linux-x64-ubuntu-22.04 /usr/local/bin/ffmpeg \
    && ln -sf /usr/local/src/shaka-streamer/lib/python3.11/site-packages/streamer_binaries/ffprobe-linux-x64 /usr/local/bin/ffprobe

RUN setcap -r /usr/local/bin/frankenphp

RUN cp ${PHP_INI_DIR}/php.ini-development ${PHP_INI_DIR}/php.ini

RUN install-php-extensions \
    @composer \
    apcu \
    bcmath \
    bz2 \
    event \
    exif \
    ffi \
    intl \
    mbstring \
    msgpack \
    opcache \
    pcntl \
    pcov \
    pdo_pgsql \
    pgsql \
    redis \
    sockets \
    uv \
    zip \
    igbinary \
    gd

RUN groupadd --force -g ${GID} user
RUN useradd -ms /bin/bash --no-user-group -g ${GID} -u ${UID} user

COPY runtimes/start-container /usr/local/bin/start-container
COPY runtimes/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY runtimes/php-development.ini ${PHP_INI_DIR}/conf.d/99-user.ini
COPY runtimes/Caddyfile /etc/caddy/Caddyfile

RUN chown -R ${UID}:${GID} /data/caddy && chown -R ${UID}:${GID} /config/caddy
RUN chmod +x /usr/local/bin/start-container

USER ${UID}

EXPOSE 8080
EXPOSE 8443
EXPOSE 2019
EXPOSE 5173
EXPOSE 6001

ENTRYPOINT ["start-container"]

This works fine on 1.1.1, but not on the newest version. I built it in a virtual env. Could this be the issue?

@joeyparrish
Copy link
Member

joeyparrish commented Jan 21, 2025

Indeed, it does not work when installed as a module. It has nothing to do with your virtual environment. The difference is that I was running from the source directory, not an installed module from pip install.

The problem is that setup.py doesn't find the cloud/ subfolder and completely fails to package it. Adding a __init__.py seems to resolve this.

Sorry for the inconvenience! I'll get it fixed soon and yank the broken releases (1.2.0 and 1.2.1).

joeyparrish added a commit to joeyparrish/shaka-streamer that referenced this issue Jan 21, 2025
The cloud/ folder was added in 1.2.0, but was not being packaged correctly due to a missing __init__.py file.  This bug affected the 1.2.0 and 1.2.1 releases, making both unusable.

Fixes shaka-project#234
@joeyparrish
Copy link
Member

Version 1.2.2 is out now with the fix, and the unusable 1.2.1 and 1.2.0 releases have been removed from PyPI. Thanks so much for the report!

@francoism90
Copy link
Author

@joeyparrish Thanks for the quick fix! 👍

@francoism90
Copy link
Author

@joeyparrish Would you be able to share your Dockerfile or give a good example? :)

I didn't found a real example here. Would you recommend to use the shaka packager one?

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants