Skip to content

Commit eea5aeb

Browse files
committed
Added:
- Dockerfile and related documentation Fixed: - shasum was missing in requirements check - References to URL file removed
1 parent 726eb58 commit eea5aeb

File tree

7 files changed

+106
-10
lines changed

7 files changed

+106
-10
lines changed

.devcontainer/devcontainer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
"yzhang.markdown-all-in-one",
2121
"christian-kohler.path-intellisense",
2222
"esbenp.prettier-vscode",
23-
"foxundermoon.shell-format"
23+
"foxundermoon.shell-format",
24+
"ms-azuretools.vscode-docker",
25+
"Gruntfuggly.todo-tree"
2426
]
2527
}
2628
}

.vscode/settings.json

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
{
22
"cSpell.words": [
3+
"Anson",
4+
"binarynoir",
5+
"cirolosapio",
36
"coreutils",
7+
"devcontainers",
8+
"esbenp",
9+
"foxundermoon",
10+
"Ganepola",
411
"grealpath",
12+
"Gruntfuggly",
13+
"kohler",
14+
"libnotify",
515
"mandb",
616
"mktemp",
717
"msys",
@@ -11,7 +21,11 @@
1121
"noscript",
1222
"nslookup",
1323
"osascript",
24+
"pacman",
1425
"realpath",
15-
"subshell"
26+
"rogalmic",
27+
"Sanjula",
28+
"subshell",
29+
"yzhang"
1630
]
1731
}

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
- none
1111

12+
## [1.3.1] - 2024-12-20
13+
14+
### Added
15+
16+
- Dockerfile and related documentation
17+
18+
### Fixed
19+
20+
- shasum was missing in requirements check
21+
- References to URL file removed
22+
1223
## [1.3.0] - 2024-12-20
1324

1425
### Added

Dockerfile

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
FROM alpine:latest
2+
3+
# Upgrade all installed packages and install necessary packages
4+
RUN apk upgrade && \
5+
apk add --no-cache bash coreutils jq curl libxml2-utils perl-utils
6+
7+
# Set the working directory
8+
WORKDIR /app
9+
10+
# Fetch the latest release tar.gz from GitHub
11+
RUN curl -L \
12+
-H "Accept: application/vnd.github+json" \
13+
-H "X-GitHub-Api-Version: 2022-11-28" \
14+
https://api.github.com/repos/binarynoir/noirwatch/releases/latest | \
15+
jq -r '.tarball_url' | \
16+
xargs curl -L -o /tmp/noirwatch.tar.gz
17+
18+
# Create the temporary directory and extract the tarball
19+
RUN mkdir -p /tmp/noirwatch && \
20+
tar -xzf /tmp/noirwatch.tar.gz -C /tmp/noirwatch --strip-components=1
21+
22+
# Copy the noirwatch script to /usr/local/bin
23+
RUN cp /tmp/noirwatch/noirwatch /usr/local/bin/noirwatch
24+
25+
# Copy the man page to the appropriate location
26+
RUN mkdir -p /usr/share/man/man1 && \
27+
cp /tmp/noirwatch/noirwatch.1 /usr/share/man/man1/noirwatch.1
28+
29+
# Clean up the temporary files
30+
RUN rm -rf /tmp/noirwatch /tmp/noirwatch.tar.gz
31+
32+
# Make the script executable
33+
RUN chmod +x /usr/local/bin/noirwatch
34+
35+
# Run noirwatch --init during the build process
36+
ENV NOIRWATCH_CONFIG="/app/noirwatch.json"
37+
ENV NOIRWATCH_CACHE="/app/cache"
38+
RUN /usr/local/bin/noirwatch --init -c "$NOIRWATCH_CONFIG" -C "$NOIRWATCH_CACHE"
39+
40+
# Set the CMD to run the startup script and keep the container running
41+
CMD ["/bin/sh", "-c", "/usr/local/bin/noirwatch -c '/app/noirwatch.json' --start && tail -f /dev/null"]

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ NoirWatch monitors specified websites for changes and sends notifications. It su
3434
- Bash 4.0+
3535
- `curl` for fetching website content
3636
- `sed` for HTML content normalization
37+
- `shasum` for change comparisons
3738
- `timeout` for custom command files
3839
- `xmllint` for HTML content normalization
3940
- `powershell` for Windows desktop notifications
@@ -382,6 +383,37 @@ NoirWatch uses a configuration file to store default settings. The default locat
382383
- `-r, --restart`: Restart the AppName service.
383384
- `-t, --status`: Check the current status of the AppName service.
384385

386+
## Docker Deployment Instructions
387+
388+
This guide provides step-by-step instructions to deploy the NoirWatch service using Docker.
389+
390+
### Docker Prerequisites
391+
392+
Ensure you have the following installed on your system:
393+
394+
- Docker
395+
396+
### Using the Dockerfile
397+
398+
To download the `Dockerfile` from the GitHub repository, run the following command:
399+
400+
```sh
401+
curl -O https://raw.githubusercontent.com/binarynoir/noirwatch/main/Dockerfile
402+
```
403+
404+
### Build and Deploy
405+
406+
Navigate to the directory containing the `Dockerfile` and run the following command to build and start the service:
407+
408+
```sh
409+
docker build -t noirwatch-image .
410+
docker run -d --name noirwatch noirwatch-image
411+
```
412+
413+
### Conclusion
414+
415+
You have successfully deployed the NoirWatch service using Docker. The service will automatically start when the container is created and will restart if it stops unexpectedly. For any further modifications or assistance, feel free to ask!
416+
385417
## Instructions for Running the Tests
386418

387419
To run the tests for the `NoirWatch` script, follow these steps:

noirwatch

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
# App version and name
99
APP_NAME="NoirWatch"
10-
VERSION=1.3.0
10+
VERSION=1.3.1
1111
LAST_UPDATED="2024-12-20"
1212

1313
# TODO:
@@ -24,7 +24,7 @@ CLI_URLS=()
2424
THRESHOLD=0
2525

2626
# Application specific dependencies
27-
DEPENDENCIES=("timeout" "xmllint")
27+
DEPENDENCIES=("shasum" "timeout" "xmllint")
2828

2929
# ==============================
3030
# Base Application Variables
@@ -976,7 +976,6 @@ show_config() {
976976
log_message "INFO" "Check interval: $CHECK_INTERVAL" "$LINENO"
977977
log_message "INFO" "Timeout interval: $TIMEOUT" "$LINENO"
978978
log_message "INFO" "Repeat times: ${REPEAT:-0}" "$LINENO"
979-
log_message "INFO" "URL file: $URL_FILE" "$LINENO"
980979
log_message "INFO" "Threshold for changes: $THRESHOLD" "$LINENO"
981980
}
982981

@@ -1048,10 +1047,7 @@ show_help() {
10481047
printf " Start the service with URLS:\n"
10491048
printf " %s --start 'https://example.com'\n" "$(basename "$0")"
10501049
printf "\n"
1051-
printf " Start the service with URL file:\n"
1052-
printf " %s --start --url-file '/path/to/file'\n" "$(basename "$0")"
1053-
printf "\n"
1054-
printf " Start the service with default URL file:\n"
1050+
printf " Start the service with default settings:\n"
10551051
printf " %s --start\n" "$(basename "$0")"
10561052
printf "\n"
10571053
printf " Restart the service with default settings:\n"

noirwatch.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.TH NOIRWATCH 1 "December 20, 2024" "NoirWatch 1.3.0" "User Commands"
1+
.TH NOIRWATCH 1 "December 20, 2024" "NoirWatch 1.3.1" "User Commands"
22
.SH NAME
33
NoirWatch \- Monitor specified websites for changes and send notifications.
44
.SH SYNOPSIS

0 commit comments

Comments
 (0)