Skip to content
Open
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
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM binwiederhier/ntfy:v2.19.2

RUN apk add --no-cache bash curl yq

COPY scripts/docker_entrypoint.sh /usr/local/bin/docker_entrypoint.sh
COPY scripts/check-web.sh /usr/local/bin/check-web.sh
RUN chmod +x /usr/local/bin/docker_entrypoint.sh /usr/local/bin/check-web.sh

EXPOSE 80

ENTRYPOINT ["/usr/local/bin/docker_entrypoint.sh"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<p align="center">
<img src="icon.svg" alt="NTFY Logo" width="21%">
<img src="icon.png" alt="NTFY Logo" width="21%">
</p>

# NTFY on StartOS
Expand Down
Binary file added icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 44 additions & 0 deletions instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# NTFY on StartOS

NTFY is a simple HTTP-based pub-sub notification service. Send push
notifications to your phone or desktop via scripts or a REST API.

## Initial Setup

1. Install and start the service.
2. In the service config, set **Base URL** to your public URL (your Tor
`.onion` address or LAN HTTPS address). This is required for attachment
links and web push to work correctly.
3. Open the Web Interface (from the Tor address or LAN HTTPS address).
4. Create your first user via the signup form. By default this user is a
regular (non-admin) user.
5. To promote a user to admin, open a shell into the container and run:

```
ntfy user change-role <username> admin
```

6. Once you have an admin, you can disable signup in the service config.

## Configuration

Available in the service config:

- **Enable Signup**: allow new users to register accounts
- **Base URL**: public URL of your server (Tor `.onion` or LAN HTTPS URL)
- **Log Level**: server log verbosity
- **Attachment File Size Limit**: maximum size of a single attachment
- **Attachment Total Size Limit**: maximum total disk usage for attachments
- **Per-Visitor Attachment Limit**: per-visitor attachment quota
- **Cache Duration**: how long messages and attachments are retained

## Usage

Publish a notification:

```
curl -d "Hello from StartOS" https://your-ntfy-address/mytopic
```

Subscribe from the web interface, mobile app, or any HTTP client.
See https://docs.ntfy.sh/ for full documentation.
113 changes: 113 additions & 0 deletions manifest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
id: ntfy
title: NTFY
version: 2.19.2
release-notes: |
* Initial StartOS 0.3.5 release of NTFY
license: Apache-2.0
wrapper-repo: "https://github.com/JesseMarkowitz/ntfy-startos"
upstream-repo: "https://github.com/binwiederhier/ntfy"
support-site: "https://github.com/binwiederhier/ntfy/issues"
marketing-site: "https://ntfy.sh/"
donation-url: "https://github.com/sponsors/binwiederhier"
build: ["make"]
description:
short: Send push notifications to your phone or desktop via HTTP PUT/POST
long: |
ntfy (pronounced "notify") is a simple HTTP-based pub-sub notification
service. It allows you to send notifications to your phone or desktop via
scripts from any computer, and/or using a REST API. It's entirely free
software, open source, and very lightweight.
assets:
license: LICENSE
icon: icon.png
instructions: instructions.md
main:
type: docker
image: main
entrypoint: "docker_entrypoint.sh"
args: []
mounts:
main: /data
health-checks:
web:
name: Web Interface
success-message: The NTFY web interface is ready
type: docker
image: main
entrypoint: "check-web.sh"
args: []
io-format: json
inject: true
config:
get:
type: script
set:
type: script
properties: ~
volumes:
main:
type: data
interfaces:
main:
name: Web Interface
description: The main web interface for NTFY
tor-config:
port-mapping:
80: "80"
lan-config:
443:
ssl: true
internal: 80
ui: true
protocols:
- tcp
- http
dependencies: {}
alerts:
install: |
NTFY will be available on your Tor address and LAN (HTTPS).
Configure signup, attachment limits, and log level in the service config.
uninstall: ~
restore: ~
backup:
create:
type: docker
image: main
system: false
entrypoint: /bin/sh
args:
- -c
- "cp -a /data/. /mnt/backup/ 2>/dev/null || true"
mounts:
BACKUP: /mnt/backup
main: /data
restore:
type: docker
image: main
system: false
entrypoint: /bin/sh
args:
- -c
- "cp -a /mnt/backup/. /data/ 2>/dev/null || true"
mounts:
BACKUP: /mnt/backup
main: /data
migrations:
from:
"*":
type: docker
image: main
entrypoint: /bin/sh
args: ["-c", "echo '{\"configured\": true}'"]
io-format: json
mounts:
main: /data
to:
"*":
type: docker
image: main
entrypoint: /bin/sh
args: ["-c", "echo '{\"configured\": true}'"]
io-format: json
mounts:
main: /data
5 changes: 5 additions & 0 deletions scripts/bundle.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { bundle } from "https://deno.land/x/emit@0.40.0/mod.ts";

const result = await bundle("scripts/embassy.ts");

await Deno.writeTextFile("scripts/embassy.js", result.code);
9 changes: 9 additions & 0 deletions scripts/check-web.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

if curl -fs http://localhost:80/v1/health > /dev/null 2>&1; then
echo '{"result":{"version":"0","message":"The NTFY web interface is ready","value":null,"variant":"success"}}'
exit 0
else
echo '{"result":{"version":"0","message":"The NTFY web interface is not ready","value":null,"variant":"loading"}}'
exit 0
fi
2 changes: 2 additions & 0 deletions scripts/deps.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from "https://deno.land/x/embassyd_sdk@v0.3.3.0.8/mod.ts";
export * from "https://deno.land/x/embassyd_sdk@v0.3.3.0.8/util.ts";
60 changes: 60 additions & 0 deletions scripts/docker_entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/bin/bash
set -e

DATA_DIR="/data"
CONFIG_FILE="${DATA_DIR}/start9/config.yaml"

SIGNUP_ENABLED="true"
LOG_LEVEL="info"
ATTACHMENT_FILE_LIMIT="15"
ATTACHMENT_TOTAL_LIMIT="5000"
VISITOR_ATTACHMENT_LIMIT="100"
CACHE_DURATION="12"
BASE_URL=""

if [ -f "$CONFIG_FILE" ]; then
SIGNUP_ENABLED=$(yq e '.signup-enabled // true' "$CONFIG_FILE" 2>/dev/null || echo "true")
LOG_LEVEL=$(yq e '.log-level // "info"' "$CONFIG_FILE" 2>/dev/null || echo "info")
ATTACHMENT_FILE_LIMIT=$(yq e '.attachment-file-size-limit // 15' "$CONFIG_FILE" 2>/dev/null || echo "15")
ATTACHMENT_TOTAL_LIMIT=$(yq e '.attachment-total-size-limit // 5000' "$CONFIG_FILE" 2>/dev/null || echo "5000")
VISITOR_ATTACHMENT_LIMIT=$(yq e '.visitor-attachment-limit // 100' "$CONFIG_FILE" 2>/dev/null || echo "100")
CACHE_DURATION=$(yq e '.cache-duration // 12' "$CONFIG_FILE" 2>/dev/null || echo "12")
BASE_URL=$(yq e '.base-url // ""' "$CONFIG_FILE" 2>/dev/null || echo "")
fi

mkdir -p "${DATA_DIR}/attachments"

export NTFY_LISTEN_HTTP=":80"
export NTFY_CACHE_FILE="${DATA_DIR}/cache.db"
export NTFY_AUTH_FILE="${DATA_DIR}/auth.db"
export NTFY_AUTH_DEFAULT_ACCESS="deny-all"
export NTFY_BEHIND_PROXY="true"
export NTFY_ENABLE_LOGIN="true"
export NTFY_ENABLE_SIGNUP="${SIGNUP_ENABLED}"
export NTFY_ATTACHMENT_CACHE_DIR="${DATA_DIR}/attachments"
export NTFY_ATTACHMENT_FILE_SIZE_LIMIT="${ATTACHMENT_FILE_LIMIT}m"
export NTFY_ATTACHMENT_TOTAL_SIZE_LIMIT="${ATTACHMENT_TOTAL_LIMIT}m"
export NTFY_VISITOR_ATTACHMENT_TOTAL_SIZE_LIMIT="${VISITOR_ATTACHMENT_LIMIT}m"
export NTFY_CACHE_DURATION="${CACHE_DURATION}h"
export NTFY_ATTACHMENT_EXPIRY_DURATION="${CACHE_DURATION}h"
export NTFY_KEEPALIVE_INTERVAL="45s"
export NTFY_LOG_LEVEL="${LOG_LEVEL}"
export NTFY_ENABLE_METRICS="true"

if [ -n "$BASE_URL" ] && [ "$BASE_URL" != "null" ]; then
export NTFY_BASE_URL="${BASE_URL}"
else
export NTFY_BASE_URL="http://localhost"
fi

echo "========================================"
echo "NTFY Configuration:"
echo " Base URL: ${NTFY_BASE_URL:-<auto>}"
echo " Signup Enabled: ${NTFY_ENABLE_SIGNUP}"
echo " Log Level: ${NTFY_LOG_LEVEL}"
echo " Attachment File Limit: ${NTFY_ATTACHMENT_FILE_SIZE_LIMIT}"
echo " Attachment Total Limit: ${NTFY_ATTACHMENT_TOTAL_SIZE_LIMIT}"
echo " Cache Duration: ${NTFY_CACHE_DURATION}"
echo "========================================"

exec ntfy serve
Loading