Skip to content

Commit

Permalink
Bump puppeteer from 13.7.0 to 21.4.1 (#290)
Browse files Browse the repository at this point in the history
* Bump puppeteer from 13.7.0 to 21.4.1

Bumps [puppeteer](https://github.com/puppeteer/puppeteer) from 13.7.0 to 21.4.1.
- [Release notes](https://github.com/puppeteer/puppeteer/releases)
- [Changelog](https://github.com/puppeteer/puppeteer/blob/main/release-please-config.json)
- [Commits](puppeteer/puppeteer@v13.7.0...puppeteer-v21.4.1)

---
updated-dependencies:
- dependency-name: puppeteer
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* use node 20

* fix new pupetteer usage

* fix js lint

* fix nodeenv

* fix nodeenv

* fix nodeenv

* fix nodeenv

* fix nodeenv

* fix nodeenv

* fix nodeenv

* fix nodeenv

* fix Dockerfile

* use make debian builder

* don'use dumb-init but use specific puppeteer cache dir

* fix PUPPETEER_CACHE_DIR usage

* fix PUPPETEER_CACHE_DIR usage

* regenerate package-lock.json

* fix tests

* set cache dir

* set cache dir

* set cache dir

* set cache dir

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: J-E Castagnede <[email protected]>
  • Loading branch information
dependabot[bot] and submarcos authored Nov 24, 2023
1 parent f5db19e commit 51c0846
Show file tree
Hide file tree
Showing 12 changed files with 2,507 additions and 2,741 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: '3.8' # lint with minimal version supported (3.6 in 18.04)
python-version: '3.8' # lint with minimal version supported (3.8 in 20.04)
- name: Install dependencies
run: |
echo "${{ github.event_name }}! ${{ github.event.action }}"
Expand All @@ -52,7 +52,7 @@ jobs:
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 14
node-version: 20
- name: Install dependencies
run: |
npm ci
Expand Down Expand Up @@ -169,7 +169,7 @@ jobs:
/home/runner/work/screamshotter/*.deb
e2e_docker_image:
name: Tests E2E docker
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
needs: [build_docker_image]
steps:
- name: Download image
Expand All @@ -189,7 +189,7 @@ jobs:
curl -d url=https://google.com http://localhost:8000 > google.png
- uses: actions/setup-python@v4
with:
python-version: 3.6
python-version: 3.8
- name: Check result
run: |
pip install filetype
Expand All @@ -198,6 +198,7 @@ jobs:
exit 0;
else
echo "File is not PNG";
filetype -f google.png;
exit 1;
fi
- name: Archive result artifact
Expand Down Expand Up @@ -232,6 +233,7 @@ jobs:
exit 0;
else
echo "File is not PNG";
filetype -f google.png;
exit 1;
fi
- name: Archive result artifact
Expand Down Expand Up @@ -265,6 +267,7 @@ jobs:
exit 0;
else
echo "File is not PNG";
filetype -f google.png;
exit 1;
fi
- name: Archive result artifact
Expand Down
8 changes: 3 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ ENV COLLECTSTATIC 1
ENV TIMEOUT 60
ENV WORKERS 1
ENV MAX_REQUESTS 250
ENV PUPPETEER_CACHE_DIR /app/puppeteer/

RUN useradd -ms /bin/bash django
RUN mkdir -p /app/static
Expand Down Expand Up @@ -82,7 +83,7 @@ RUN /app/venv/bin/pip3 install --no-cache-dir pip setuptools wheel -U

COPY requirements.txt /app/
RUN /app/venv/bin/pip3 install --no-cache-dir -r /app/requirements.txt -U && rm /app/requirements.txt
RUN /app/venv/bin/nodeenv /app/venv/ -C '' -p -n 14.18.1
RUN /app/venv/bin/nodeenv /app/venv/ -C '' -p -n 20.9.0

# upgrade npm & requirements
COPY package.json /app/package.json
Expand All @@ -100,11 +101,10 @@ FROM base

COPY --from=build /app/venv /app/venv
COPY --from=build /app/node_modules /app/node_modules
COPY --from=build /app/puppeteer /app/puppeteer
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 +113,4 @@ 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

11 changes: 7 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
builder:
docker build . -f ./Dockerfile.debian.builder --build-arg DISTRO=$(DISTRO) --build-arg BUILDID=$(BUILDID) -t screamshotter-builder
mkdir -p dist
docker run --rm screamshotter-builder tar -C /dpkg -c . | tar -C dist -xv
build_deb:
docker pull $(DISTRO)
docker build -t screamshotter_deb -f ./Dockerfile.debian.builder --build-arg DISTRO=$(DISTRO) .
docker run --name screamshotter_deb_run -t screamshotter_deb bash -c "exit"
docker cp screamshotter_deb_run:/dpkg ./
docker stop screamshotter_deb_run
docker rm screamshotter_deb_run
1 change: 1 addition & 0 deletions conf/env.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
TIMEOUT=${TIMEOUT}
MAX_REQUESTS=${MAX_REQUESTS}
PUPPETEER_CACHE_DIR=${PUPPETEER_CACHE_DIR}
4 changes: 2 additions & 2 deletions debian/postinst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

# Create screamshotter user (only on a new install)
if [ "$2" = "" ]; then
adduser --system --group --no-create-home --quiet screamshotter || true
adduser --system --group --home /opt/screamshotter --quiet screamshotter || true
fi

db_get screamshotter/TIMEOUT; export TIMEOUT="$RET"
Expand All @@ -18,7 +18,7 @@ db_get screamshotter/SENTRY_ENVIRONMENT; export SENTRY_ENVIRONMENT="$RET"
db_get screamshotter/SENTRY_TRACE_SAMPLE; export SENTRY_TRACE_SAMPLE="$RET"

mkdir -p /opt/screamshotter/static || true
chown -R screamshotter:screamshotter /opt/screamshotter/static || true
chown -R screamshotter:screamshotter /opt/screamshotter || true

# Generate config files
echo "Generate configuration" >&2
Expand Down
1 change: 1 addition & 0 deletions debian/postrm
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

if [ "$1" = "purge" ]; then
deluser --quiet screamshotter || true
rm -rf /opt/screamshotter || true
fi

#DEBHELPER#
Expand Down
7 changes: 3 additions & 4 deletions debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ export DH_VIRTUALENV_INSTALL_ROOT=/opt
dh $@ --with python-virtualenv

override_dh_virtualenv:
dh_virtualenv --python /usr/bin/python3 --builtin-venv --install-suffix screamshotter --preinstall "setuptools==53.0.0" --preinstall "wheel==0.36.2"
debian/screamshotter/opt/screamshotter/bin/python debian/screamshotter/opt/screamshotter/bin/pip install nodeenv==1.5.0
debian/screamshotter/opt/screamshotter/bin/nodeenv -C '' -p -n 14.18.1
dh_virtualenv --python /usr/bin/python3 --builtin-venv --install-suffix screamshotter --preinstall "setuptools" --preinstall "wheel"
debian/screamshotter/opt/screamshotter/bin/python debian/screamshotter/opt/screamshotter/bin/nodeenv -C '' -p -n 20.9.0
cp package.json package-lock.json debian/screamshotter/opt/screamshotter/
. debian/screamshotter/opt/screamshotter/bin/activate && npm ci --production -g --unsafe-perm=true
export PUPPETEER_CACHE_DIR=$(CURDIR)/debian/screamshotter/opt/screamshotter/puppeteer/ && . ./debian/screamshotter/opt/screamshotter/bin/activate && cd debian/screamshotter/opt/screamshotter/ && npm ci --omit=dev --unsafe-perm=true

.PHONY: override_dh_strip override_dh_shlibdeps
1 change: 1 addition & 0 deletions debian/screamshotter.service
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ WorkingDirectory=/opt/screamshotter
ExecStart=/opt/screamshotter/bin/gunicorn --config=/opt/screamshotter/conf/gunicorn-screamshotter.conf.py screamshotter.wsgi:application
Environment=NODE_PATH=/opt/screamshotter/node_modules/
Environment=NODE_BIN_PATH=/opt/screamshotter/bin/node
Environment=PUPPETEER_CACHE_DIR=/opt/screamshotter/puppeteer/
Restart=on-failure
User=screamshotter
Group=screamshotter
Expand Down
2 changes: 1 addition & 1 deletion debian/screamshotter.templates
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ Template: screamshotter/SENTRY_TRACE_SAMPLE
Type: string
Default: 0.2
Description: Trace sample of sentry
With this option set, every transaction created will have that percentage chance of being sent to Sentry (between 0 and 1)
With this option set, every transaction created will have that percentage chance of being sent to Sentry (between 0 and 1)
Loading

0 comments on commit 51c0846

Please sign in to comment.