Skip to content

Commit

Permalink
- Modify Postgres version
Browse files Browse the repository at this point in the history
- Updated Readme to show setting regarding Silicon Macs and "Unable to open X display" error
  • Loading branch information
paschmann committed Jan 2, 2025
1 parent 389ac7c commit c4e9297
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 21 deletions.
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,18 @@

###

Changd is a open source web monitoring application and a free alternative to ChangeTower.com, Hexowatch.com, and other SaaS-based solutions. Changd can currently be used for automated monitoring visual site changes (screenshots), XPath's or API's.
Changd is a open source web monitoring application and a self hosted free alternative to SaaS-based solutions. Changd can currently be used for automated monitoring visual site changes (using differential screenshots), XPath's or data returned from API endpoints. It is currently developed using Typescript, React and AntD for the Frontend UI, and the Backend/API is written in JS and running on Node.js. Changd has multiple configuration options and screenshots can be stored on Amazon S3 or locally. Notifications can be sent using your own SMTP service or Amazon SES.

Changd is developed using Typescript, React and AntD for UI, and the API/backend is written in JS and running on Node.js. I developed Changd because I wanted a free website monitoring solution that I could host locally and have full control over.

Changd has multiple configuration options and screenshots can be stored on Amazon S3 or locally. Notifications can be sent using your own SMTP service or Amazon SES.
I developed Changd because I wanted a free website monitoring solution that I could host locally and have full control over.

#### Monitoring Use Cases

- Content is changed on a website
- Online shopping price changes
- Get notified when a news article is changed
- Detect changes in API responses
- Monitor specific text (via XPath) changes on a website
- Your website gets defaced, hacked, or changed without your knowledge
- Monitor specific text (via XPath) changes
- If a website gets defaced, hacked, or changed without your knowledge
- Monitor your site availability (online or offline)
- Monitor competitor websites for changes
- Be sure content is displayed correctly
Expand All @@ -27,13 +25,13 @@ Changd has multiple configuration options and screenshots can be stored on Amazo
- Monitors Visual changes, APIs or HTML XPaths
- Run using docker, locally or in a scaled node environment
- Quickly and easily setup new jobs
- Notify one or multiple email addresses when a condition is met
- Visual screenshot of website changes via email notifications
- Notification options for SMTP or Amazon SES Notifications
- Store screenshots in AWS S3 or Locally
- Store data in Postgres DB
- Notifcations (or any [Reach SDK](https://www.github.com/paschmann/reach-sdk) supported notification type) when a condition is met
- Visual screenshot included in email notifications
- Supports email via SMTP or Amazon SES Notifications
- Store screenshots in Locally or in AWS S3
- Data is persisted in a Postgres DB
- Includes a history of changes
- Usage charts
- Usage and change related charts
- Supports multiple users
- Open Source

Expand All @@ -51,6 +49,8 @@ Or using Docker:

## Running from Docker

NB: If using Docker on a Apple Silicon Mac, you need to enable the setting: 'Use Rosetta for x86/amd64 emulation on Apple Silicon' see [here](https://github.com/puppeteer/puppeteer/issues/7746#issuecomment-1382021497)

Running from docker is the quickest and easiet method for testing the application. Clone the repo and run:

```
Expand Down Expand Up @@ -94,7 +94,7 @@ npm start
Optional (Cron Service):
```
cd server
npm run crondev
npm run devcron
```

Once running, your web application frontend should be available on http://localhost:3000, the API/backend should be available on http://localhost:8000. The frontend API calls will be proxied to port 8000 using the proxy referenced in the frontend/package.json file.
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ services:
# - 5432:5432
volumes:
- ./server/db_script/changd.sql:/docker-entrypoint-initdb.d/changd.sql
- ./server/data/db:/var/lib/postgresql/data
- ./server/data/db:/var/lib/postgresql@14/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
Expand Down
3 changes: 2 additions & 1 deletion server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ RUN npm install pm2 -g

ENV CHROME_BIN="/usr/bin/chromium-browser" \
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD="true"

RUN set -x \
&& apk update \
&& apk upgrade \
&& apk add --no-cache \
udev \
ttf-freefont \
chromium \
&& npm install puppeteer@1.10.0
&& npm install puppeteer

WORKDIR /app
COPY . .
Expand Down
10 changes: 4 additions & 6 deletions server/db/job_daemon.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ const chrome_args = [
'--use-gl=swiftshader',
'--use-mock-keychain',
'--disable-setuid-sandbox',
'--disable-gpu',
'--user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Safari/605.1.15'
];

Expand Down Expand Up @@ -520,7 +521,7 @@ async function getWebsiteScreenshot(url, dest, filename, delay) {
const browser = await chromium.puppeteer.launch({
args: chrome_args,
executablePath: process.env.CHROME_BIN || await chromium.executablePath,
headless: false,
headless: true,
defaultViewport: { height: parseInt(process.env.CAPTURE_IMAGE_HEIGHT), width: parseInt(process.env.CAPTURE_IMAGE_WIDTH), }
});
const path = dest + filename + ".png";
Expand All @@ -540,9 +541,6 @@ async function getWebsiteScreenshot(url, dest, filename, delay) {

await page.goto(url, { waitUntil: 'networkidle0' });

await page.waitForTimeout((Math.floor(Math.random() * 12) + 5) * 1000)

//Wait slightly longer just in case
await new Promise(resolve => setTimeout(resolve, parseInt(delay * 1000)));

// Hopefully remove cookie consent box
Expand Down Expand Up @@ -581,8 +579,8 @@ async function getWebsiteScreenshot(url, dest, filename, delay) {

await filehandler.createFile(dest + filename + "_small.png", smalldata);

//await page.close();
//await browser.close();
await page.close();
await browser.close();
return true;
} catch (err) {
console.log('Unable to get website screenshot: ' + err);
Expand Down

0 comments on commit c4e9297

Please sign in to comment.