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

fix subprocess remaining #327

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ jobs:
- name: Install dependencies
run: |
sudo apt-get update -q
sudo apt-get -q -y install nodejs npm ca-certificates
sudo apt-get -q -y install nodejs npm ca-certificates dumb-init
python -m pip install --upgrade pip setuptools wheel
pip install -r requirements.txt -U
pip install -r requirements-dev.txt
Expand Down
4 changes: 1 addition & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ RUN mkdir -p /app/static
RUN chown django:django /app

RUN apt-get -qq update && apt-get install -qq -y \
dumb-init \
gconf-service \
libasound2 \
libatk1.0-0 \
Expand Down Expand Up @@ -103,8 +104,6 @@ COPY --from=build /app/node_modules /app/node_modules
COPY src /app/src

RUN mkdir -p /app/static && chown django:django /app/static
ADD https://github.com/Yelp/dumb-init/releases/download/v1.2.2/dumb-init_1.2.2_x86_64 /usr/local/bin/dumb-init
RUN chmod +x /usr/local/bin/dumb-init

RUN apt-get -qq update && apt-get upgrade -qq -y && \
apt-get clean all && rm -rf /var/apt/lists/* && rm -rf /var/cache/apt/*
Expand All @@ -113,6 +112,5 @@ VOLUME /app/static

USER django

ENTRYPOINT ["dumb-init", "--", "/usr/local/bin/entrypoint.sh"]
CMD gunicorn screamshotter.wsgi:application -w $WORKERS --max-requests $MAX_REQUESTS --timeout `expr $TIMEOUT + 10` --bind 0.0.0.0:8000 --worker-tmp-dir /dev/shm

1 change: 1 addition & 0 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Depends:
${misc:Depends},
${shlibs:Depends},
gettext,
dumb-init,
python3 (>= 3.6),
libappindicator3-1,
libasound2,
Expand Down
2 changes: 2 additions & 0 deletions src/screenshotter/puppeteer.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ def take_screenshot(url, width=1920, height=1080, waitfor='body', wait_selectors
# We send sentry informations and version : when we use screamshotter as a package, informations are in settings only
with NamedTemporaryFile(suffix='.png') as screenshot_file:
command = subprocess.run([
"/usr/bin/dumb-init",
"--",
os.getenv('NODE_BIN_PATH', 'node'),
app_settings.PUPPETEER_JAVASCRIPT_FILEPATH,
'--version',
Expand Down