Skip to content

Commit

Permalink
NoVNC (#58)
Browse files Browse the repository at this point in the history
* Fix README

* NoVNC

* README
  • Loading branch information
MatthewZMSU authored Nov 6, 2024
1 parent 8139dee commit 3337ec3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ ENV RESOLUTION=1080x720
# Note: this installs the necessary libs to make the bundled version of Chromium that Puppeteer
# installs, work.
RUN apt-get update \
&& apt-get install -y wget gnupg tightvncserver xfce4 xfce4-goodies xfonts-base dbus-x11 \
&& apt-get install -y wget gnupg tightvncserver xfce4 xfce4-goodies xfonts-base dbus-x11 novnc \
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor -o /usr/share/keyrings/googlechrome-linux-keyring.gpg \
&& sh -c 'echo "deb [arch=amd64 signed-by=/usr/share/keyrings/googlechrome-linux-keyring.gpg] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
&& apt-get update \
&& apt-get install -y google-chrome-stable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-khmeros fonts-kacst fonts-freefont-ttf libxss1 \
--no-install-recommends \
&& ln /usr/share/novnc/vnc.html /usr/share/novnc/index.html \
&& rm -rf /var/lib/apt/lists/*

RUN mkdir -p /app
Expand All @@ -36,5 +37,7 @@ RUN yarn install
EXPOSE 3000
# VNC-server
EXPOSE 5901
# NoVNC
EXPOSE 5900

CMD ./start_container.sh
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ Example request body:
"waitOptions": { // selector, xpath or timeout, same as in the goto method
"timeout": 5000, //default timeout is 1000ms
}
}
}
```

### **/har**
Expand Down Expand Up @@ -253,7 +253,7 @@ async function action(page, request) {
};
await page.close();
return response;
}
}
```

### **/screenshot**
Expand All @@ -270,7 +270,7 @@ Example request body:
"quality": 100,
"fullPage" : true
}
}
}
```

### **/recaptcha_solver**
Expand Down Expand Up @@ -324,6 +324,12 @@ You may expect the service to fit 60 open contexts into 1 gigabyte of RAM.

Once you don't need the browser tab you need to explicitly close it (e.g. at the end of the parse method).

## VNC and NoVNC

In case when `HEADLES=false` environment variable is explicitly set,
you may use VNC-server on 5901 port or view NoVNC in browser at localhost:5900.
These provide the ability to check container's process.

## TODO

- [x] skeleton that could handle goto, click, scroll, and actions.
Expand Down
1 change: 1 addition & 0 deletions start_container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
if [ "${HEADLESS}" == "false" ]; then
printf "%s\n%s\nn" "${VNC_PASSWORD:=password}" "${VNC_PASSWORD:=password}" | vncpasswd
./start_vnc.sh &
websockify -D 5900 localhost:5901 --web /usr/share/novnc
fi

# Start scrapy-puppeteer-service
Expand Down

0 comments on commit 3337ec3

Please sign in to comment.