Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions .github/workflows/build-deb-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Build Debian Package
# Check status: systemctl status changedetection.io.service
# Get logs: journalctl -u changedetection.io.service
on: [push, pull_request]

jobs:
build-deb:
runs-on: ubuntu-latest
name: Build and Package changedetection.io
env:
PACKAGE_VERSION: 0.48.5 # or load from somewhere else

steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
path: changedetection.io-${{ env.PACKAGE_VERSION }}

- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Install Build Dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
devscripts \
dh-virtualenv \
dh-python \
python3-all \
python3-all-dev \
python3.10 \
python3.10-venv \
python3.10-dev \
debhelper-compat

- name: Build the Debian Package
# Build it the same as the pypi way, then use the same package tar
run: |
mkdir /tmp/changedetection.io
python3 -m build
mv dist/*gz .
debuild -us -uc

- name: Upload Debian Package Artifact
uses: actions/upload-artifact@v3
with:
name: changedetection.io-deb-package
path: ../*.deb

#@todo install and test that some basic content appears
165 changes: 165 additions & 0 deletions .github/workflows/build-deb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
name: Build Debian Package

on:
push:
branches: [ master ]
tags:
- '*'
pull_request:
branches: [ master ]
workflow_dispatch:

jobs:
build-deb:
runs-on: ubuntu-latest
container:
image: debian:bookworm

steps:
- name: Install git and dependencies
run: |
apt-get update
apt-get install -y git

- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install build dependencies
run: |
apt-get install -y \
dpkg-dev \
debhelper \
dh-python \
python3-all \
python3-setuptools \
python3-pip \
python3-venv \
build-essential \
fakeroot

- name: Build Debian package
run: |
# Build the package
dpkg-buildpackage -us -uc -b

# Move built package to workspace for artifact upload
mkdir -p deb-packages
mv ../*.deb deb-packages/ || true
mv ../*.buildinfo deb-packages/ || true
mv ../*.changes deb-packages/ || true

# List what was built
ls -lh deb-packages/

- name: Upload .deb package
uses: actions/upload-artifact@v4
with:
name: changedetection-deb-package
path: deb-packages/*.deb
retention-days: 30

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: changedetection-build-info
path: |
deb-packages/*.buildinfo
deb-packages/*.changes
retention-days: 30

test-install:
needs: build-deb
runs-on: ubuntu-latest
container:
image: debian:bookworm

steps:
- name: Download .deb package
uses: actions/download-artifact@v4
with:
name: changedetection-deb-package
path: ./deb-packages

- name: Install systemd and dependencies
run: |
apt-get update
apt-get install -y systemd systemctl

- name: Install package
run: |
ls -lh deb-packages/
apt-get install -y ./deb-packages/*.deb

- name: Verify installation
run: |
echo "Checking if _changedetection user exists..."
id _changedetection

echo "Checking if data directory exists..."
test -d /var/lib/changedetection
ls -ld /var/lib/changedetection

echo "Checking if service file exists..."
test -f /lib/systemd/system/changedetection.io.service

echo "Checking if binary wrapper exists..."
test -x /usr/bin/changedetection.io

echo "Checking if venv exists..."
test -d /opt/changedetection
test -x /opt/changedetection/bin/python3

echo "Testing binary execution..."
/usr/bin/changedetection.io --help || echo "Help command returned: $?"

echo ""
echo "✓ Installation verification passed!"

- name: Test service start and HTTP endpoint
run: |
apt-get install -y curl procps

echo "Starting changedetection.io service manually..."
# Start service in background as _changedetection user
su - _changedetection -s /bin/sh -c 'cd /var/lib/changedetection && /opt/changedetection/bin/changedetection.io -h 127.0.0.1 -p 5000 -d /var/lib/changedetection' &

echo "Waiting 5 seconds for service to start..."
sleep 5

echo "Checking if process is running..."
ps aux | grep changedetection || true

echo "Testing HTTP endpoint on localhost:5000..."
if curl -f -s http://127.0.0.1:5000/ | grep -i "changedetection" > /dev/null; then
echo "✓ Service is responding on port 5000!"
echo "✓ HTML content received successfully!"
else
echo "✗ Service did not respond correctly"
exit 1
fi

# Optional: Publish to GitHub Releases on tag push
publish-release:
if: startsWith(github.ref, 'refs/tags/')
needs: [build-deb, test-install]
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Download .deb package
uses: actions/download-artifact@v4
with:
name: changedetection-deb-package
path: ./deb-packages

- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: deb-packages/*.deb
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 3 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ recursive-include changedetectionio/tests *
prune changedetectionio/static/package-lock.json
prune changedetectionio/static/styles/node_modules
prune changedetectionio/static/styles/package-lock.json
prune changedetectionio/tests/test-datastore

include changedetection.py
include requirements.txt
include README-pip.md
Expand All @@ -18,5 +20,6 @@ global-exclude node_modules
global-exclude venv

global-exclude test-datastore
global-exclude changedetectionio/tests/test-datastore
global-exclude changedetection.io*dist-info
global-exclude changedetectionio/tests/proxy_socks5/test-datastore
40 changes: 40 additions & 0 deletions build-deb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash
set -e

echo "========================================"
echo "Building changedetection.io Debian package"
echo "========================================"

# Check if running on Debian-based system
if ! command -v dpkg-buildpackage &> /dev/null; then
echo "Error: dpkg-buildpackage not found. Install with:"
echo " sudo apt-get install dpkg-dev debhelper dh-python python3-all python3-setuptools"
exit 1
fi

# Clean previous builds
echo "Cleaning previous builds..."
rm -rf debian/.debhelper debian/changedetection.io debian/files debian/*.debhelper* debian/*.substvars
rm -f ../changedetection.io_*.deb ../changedetection.io_*.buildinfo ../changedetection.io_*.changes

# Build the package
echo "Building package..."
dpkg-buildpackage -us -uc -b

echo ""
echo "========================================"
echo "Build complete!"
echo "========================================"
echo ""
echo "Package created at:"
ls -lh ../changedetection.io_*.deb
echo ""
echo "To install locally:"
echo " sudo dpkg -i ../changedetection.io_*.deb"
echo " sudo apt-get install -f # If there are dependency issues"
echo ""
echo "To test in a clean environment:"
echo " docker run --rm -it -v \$(pwd)/..:/build debian:bookworm bash"
echo " # Inside container:"
echo " apt-get update && apt-get install -y /build/changedetection.io_*.deb"
echo " systemctl status changedetection.io"
4 changes: 4 additions & 0 deletions changedetectionio/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from . import main

if __name__ == '__main__':
main()
3 changes: 3 additions & 0 deletions debian/changedetection-wrapper
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
# Wrapper script to run changedetection.io from venv
exec /opt/changedetection/bin/python3 /opt/changedetection/bin/changedetection.io "$@"
31 changes: 31 additions & 0 deletions debian/changedetection.io.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[Unit]
Description=changedetection.io - Website change detection and monitoring
After=network.target
Documentation=https://changedetection.io

[Service]
Type=simple
User=_changedetection
Group=_changedetection
WorkingDirectory=/var/lib/changedetection
Environment="DATASTORE_PATH=/var/lib/changedetection"
Environment="HOST=127.0.0.1"
Environment="PORT=5000"
ExecStart=/opt/changedetection/bin/changedetection.io -h 127.0.0.1 -p 5000 -d /var/lib/changedetection

# Security hardening
NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=strict
ProtectHome=true
ReadWritePaths=/var/lib/changedetection
ProtectKernelTunables=true
ProtectKernelModules=true
ProtectControlGroups=true

# Restart policy
Restart=on-failure
RestartSec=10s

[Install]
WantedBy=multi-user.target
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[Unit]
Description=changedetection.io Service
After=network.target

[Service]
User=changedetio
Group=changedetio
WorkingDirectory=/opt/changedetection.io
ExecStart=/opt/changedetection.io/bin/python -m changedetectionio
Restart=on-failure

[Install]
WantedBy=multi-user.target
7 changes: 7 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
changedetection.io (0.50.38) stable; urgency=medium

* Initial Debian package release
* Service runs as _changedetection user on localhost:5000
* Systemd integration with security hardening

-- dgtlmoon <[email protected]> Sat, 02 Nov 2024 00:00:00 +0000
1 change: 1 addition & 0 deletions debian/compat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
13
38 changes: 38 additions & 0 deletions debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
Source: changedetection.io
Section: web
Priority: optional
Maintainer: dgtlmoon <[email protected]>
Build-Depends: debhelper-compat (= 13),
dh-python,
python3-all (>= 3.10),
python3-setuptools,
python3-pip,
python3-venv
Standards-Version: 4.6.2
Homepage: https://changedetection.io
Vcs-Browser: https://github.com/dgtlmoon/changedetection.io
Vcs-Git: https://github.com/dgtlmoon/changedetection.io.git
Rules-Requires-Root: no

Package: changedetection.io
Architecture: all
Depends: ${misc:Depends},
${python3:Depends},
python3 (>= 3.10),
python3-pip,
python3-venv,
adduser
Description: Website change detection and monitoring service
changedetection.io is a self-hosted open source application for monitoring
websites for changes. It detects changes to web pages and sends alerts or
notifications when changes are detected.
.
Features include:
* Monitor websites for visual and text changes
* XPath, CSS, and JSON filtering
* Notifications via multiple services (Apprise)
* API for automation
* Headless browser support
.
This package installs changedetection.io as a systemd service running on
localhost (127.0.0.1:5000) as the unprivileged _changedetection user.
1 change: 1 addition & 0 deletions debian/debhelper-build-stamp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
python-changedetection.io
2 changes: 2 additions & 0 deletions debian/install
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Install wrapper script
debian/changedetection-wrapper usr/bin/changedetection.io
Loading
Loading