gpt4 book ai didi

amazon-web-services - EROFS:一天后在EBS上运行puppeteer时的只读文件系统

转载 作者:行者123 更新时间:2023-12-02 19:23:52 28 4
gpt4 key购买 nike

我正在Elastic BeanStalk上运行puppeteer。每30分钟就会打开200个URL。每个打开和关闭一个新的浏览器。

经过大约一天的运行,它停止并抛出如下错误:

EROFS:只读文件系统,mkdtemp'/ tmp / puppeteer_dev_profile-4cenrs'

我在网上搜索解决方案,如果我猜的话。对于Docker或Puppeteer来说,这不是问题,但是由于某种原因,EBS只是在磁盘上进行了一定数量的操作后才锁定自身。如果我运行两个服务器,每个服务器只有100个请求,那么它将持续更长的时间,直到引发错误为止。

我正在使用这些选项运行Puppeteer:

'--disable-dev-shm-usage',
'--no-sandbox',
'--disable-setuid-sandbox',
'--disable-dev-shm-usage',
'--disable-accelerated-2d-canvas',
'--disable-gpu',
'--disable-dev-profile'

每天,我都在重建EBS实例,并使该应用程序运行另一天。

这是我的Dockerfile
FROM ubuntu:18.04

# Application parameters and variables
ENV NODE_ENV=production
ENV HOST=0.0.0.0
ENV PORT=3000
ENV application_directory=/usr/src/app
ENV ENABLE_XVBF=true

# Build Args
ARG USE_CHROME_STABLE

# Configuration for Chrome
ENV CONNECTION_TIMEOUT=60000
ENV CHROME_PATH=/usr/bin/google-chrome
ENV USE_CHROME_STABLE=${USE_CHROME_STABLE}

RUN mkdir -p $application_directory

WORKDIR $application_directory

# Install app dependencies
COPY package.json .

# Bundle app source
COPY . .

# Dependencies + NodeJS
RUN apt-get -qq update && \
echo "ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true" | debconf-set-selections && \
apt-get -y -qq install software-properties-common &&\
apt-add-repository "deb http://archive.canonical.com/ubuntu $(lsb_release -sc) partner" && \
apt-add-repository ppa:malteworld/ppa && apt-get -qq update && apt-get -y -qq install \
adobe-flashplugin \
msttcorefonts \
fonts-noto-color-emoji \
fonts-noto-cjk \
fonts-liberation \
fonts-thai-tlwg \
fonts-indic \
fontconfig \
libappindicator3-1 \
pdftk \
unzip \
locales \
gconf-service \
libasound2 \
libatk1.0-0 \
libc6 \
libcairo2 \
libcups2 \
libdbus-1-3 \
libexpat1 \
libfontconfig1 \
libgcc1 \
libgconf-2-4 \
libgdk-pixbuf2.0-0 \
libglib2.0-0 \
libgtk-3-0 \
libnspr4 \
libpango-1.0-0 \
libpangocairo-1.0-0 \
libstdc++6 \
libx11-6 \
libx11-xcb1 \
libxcb1 \
libxcomposite1 \
libxcursor1 \
libxdamage1 \
libxext6 \
libxfixes3 \
libxi6 \
libxrandr2 \
libxrender1 \
libxss1 \
libxtst6 \
ca-certificates \
libappindicator1 \
libnss3 \
lsb-release \
xdg-utils \
wget \
xvfb \
curl &&\
# Install Node
curl --silent --location https://deb.nodesource.com/setup_10.x | bash - &&\
apt-get -y -qq install nodejs &&\
apt-get -y -qq install build-essential &&\
# Fonts
fc-cache -f -v

# It's a good idea to use dumb-init to help prevent zombie chrome processes.
ADD https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64 /usr/local/bin/dumb-init
RUN chmod +x /usr/local/bin/dumb-init

# Install Chrome Stable when specified
RUN if [ "$USE_CHROME_STABLE" = "true" ]; then \
cd /tmp &&\
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb &&\
dpkg -i google-chrome-stable_current_amd64.deb;\
fi

# Build
RUN if [ "$USE_CHROME_STABLE" = "true" ]; then \
export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true;\
fi &&\
npm install

# Cleanup
RUN apt-get -qq clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# Add user
RUN groupadd -r blessuser && useradd -r -g blessuser -G audio,video blessuser \
&& mkdir -p /home/blessuser/Downloads \
&& chown -R blessuser:blessuser /home/blessuser \
&& chown -R blessuser:blessuser $application_directory

# Run everything after as non-privileged user.
USER blessuser

# Expose the web-socket and HTTP ports
EXPOSE 3000
ENTRYPOINT ["dumb-init", "--"]
CMD ["npm", "start"]

最佳答案

查看设备上剩余的可用磁盘空间,建议您定期清洁/tmp文件夹以防止此类行为。所以我认为问题与puppeteer生成的许多临时文件有关。另请参阅this

关于amazon-web-services - EROFS:一天后在EBS上运行puppeteer时的只读文件系统,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57800382/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com