Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Commit

Permalink
Chore(Doc): Update Doc on Chromium Sandboxing
Browse files Browse the repository at this point in the history
  • Loading branch information
toksdotdev committed Dec 31, 2020
1 parent 420e3f6 commit d7d0ee1
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ PORT=3000
NODE_ENV=production

# Chromium
LAUNCH_CHROMIUM_IN_SANDBOX=false # should be disabled in production
LAUNCH_CHROMIUM_IN_SANDBOX=false # should be false in production

# Cache
REDIS_URL=redis
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ A dead-simple service that screenshots webpages, and sends the links to your ema
## Design Goals

- **Security:** All webpages are opened both in _sandboxed chromium_ and _icognito mode_.
- **Security:** All webpages are opened both in _sandboxed and \_icognito mode_ of chromium.
- **Scalability:** Handles ~2.3k reqs/s on a single node. For load performance, see [load testing](#load-testing).
- **Resilience:** Chromium instance automatically restarts on sudden crash without interrupting the job queue. Jobs that get affected are auto-retried.
- **Reduced memory footprints:** Puppeteer is used under the hood to capture screeshots. To reduce memory footprint, **only one** Chromium instance exists throughout the service lifetime irrespective of the number of screenshot workers that are running.
Expand Down Expand Up @@ -40,6 +40,8 @@ You'll need to ensure you have the following installed:
- Set `MAIL_DEFAULT` to `smtp`.
- Set `REDIS_URL` to `redis` (only if you'll be running the app via `docker-compose` for simplicity sake).

> NOTE: If you want to start chromium in `--no-sandbox` mode, simply specify the env `LAUNCH_CHROMIUM_IN_SANDBOX=false`. By default, it is set to `true`.
### Starting Up

#### Production
Expand Down
2 changes: 1 addition & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const appConfig: AppConfig = {
},
puppeteer: {
launchInSandbox: JSON.parse(
process.env.LAUNCH_CHROMIUM_IN_SANDBOX || "false"
process.env.LAUNCH_CHROMIUM_IN_SANDBOX || "true"
),
},
redis: {
Expand Down
2 changes: 1 addition & 1 deletion src/services/screenshot/screenshot.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class ScreenshotService {
args: [
"--incognito",
// "--disable-setuid-sandbox",
this.config?.puppeteer.launchInSandbox ? "--no-sandbox" : "",
this.config?.puppeteer.launchInSandbox ? "" : "--no-sandbox",
// This will write shared memory files into /tmp instead of /dev/shm,
// because Docker’s default for /dev/shm is 64MB
"--disable-dev-shm-usage",
Expand Down

0 comments on commit d7d0ee1

Please sign in to comment.