ntfy-emergency-app/README.md

101 lines
2.9 KiB
Markdown
Raw Normal View History

2025-10-17 19:35:19 +02:00
# ntfy emergency app - Message Webapp
2025-10-16 09:50:36 +02:00
2025-10-18 14:34:43 +02:00
This is a simple web application that allows users to send emergency messages to a ntfy server.
2025-10-16 09:50:36 +02:00
2025-10-18 14:34:43 +02:00
tldr: I look at messaging apps very infrequently and have no notifications for them. But what happens if there's a real emergency and someone needs to grab my attention? The only app in my phone that has notifications is the ntfy client, which I use to monitor servers and services. Why not receive a ntfy alert? This small webapp lets my trusted ones send me a high priority message if needed.
2025-10-16 09:50:36 +02:00
2025-10-18 23:44:50 +02:00
[![webapp.gif](https://i.postimg.cc/85P4ZfK4/webapp.gif)](https://postimg.cc/KKwtzjy3)
2025-10-18 14:34:43 +02:00
More details:
- You can deploy in a single `docker run`, simply passing the ntfy details through env vars.
- You can use it with both the official ntfy instance or with a selfhosted instance of your own.
- Deals with ntfy username/password auth if needed.
- No auth or spam protection: either roll your own, or simply pray nobody spams you.
## Dev setup
2025-10-16 09:50:36 +02:00
2025-10-17 19:35:19 +02:00
1. Install dependencies:
2025-10-18 14:34:43 +02:00
2025-10-16 09:50:36 +02:00
```bash
npm install
```
2025-10-17 19:35:19 +02:00
2. Configure environment variables:
2025-10-16 09:50:36 +02:00
```bash
2025-10-18 14:34:43 +02:00
cp env.example .env
# Edit .env with your values
2025-10-16 09:50:36 +02:00
```
2025-10-17 19:35:19 +02:00
3. Run the application:
2025-10-16 09:50:36 +02:00
```bash
npm start
```
2025-10-18 14:34:43 +02:00
## Environment Variables in detail
2025-10-16 09:50:36 +02:00
2025-10-17 19:35:19 +02:00
- `NTFY_URL`: URL of your ntfy server (required)
- `NTFY_USER`: Username for ntfy authentication (required)
- `NTFY_PASSWORD`: Password for ntfy authentication (required)
- `NTFY_TOPIC`: ntfy topic/channel to send messages to (optional, defaults to "emergencia")
- `PORT`: Port to run the application on (optional, defaults to 3000)
2025-10-18 18:13:47 +02:00
- `UI_MESSAGE`: Custom message to display in the UI (optional, defaults to "Emergency Message")
2025-10-16 09:50:36 +02:00
2025-10-18 14:34:43 +02:00
### Docker Registry Variables (Optional, needed to push to private registry)
Note that we assume that you `docker` cli is authenticated for the registry you want to use.
2025-10-16 12:08:18 +02:00
2025-10-17 19:35:19 +02:00
- `DOCKER_REGISTRY`: Custom registry to publish the image to (optional)
- `DOCKER_USERNAME`: Username/organization in the registry (optional)
- `DOCKER_TAG`: Tag for the Docker image (optional, defaults to "latest")
2025-10-16 12:08:18 +02:00
2025-10-17 19:35:19 +02:00
## Deployment
2025-10-16 09:50:36 +02:00
2025-10-18 14:34:43 +02:00
### Option 1: Docker Run
2025-10-16 09:50:36 +02:00
2025-10-17 19:35:19 +02:00
1. Create a `.env` file with your credentials:
2025-10-16 09:50:36 +02:00
```bash
2025-10-17 19:35:19 +02:00
NTFY_URL=https://your-ntfy-server.com
NTFY_USER=your-username
NTFY_PASSWORD=your-password
2025-10-16 09:55:32 +02:00
NTFY_TOPIC=emergencia
2025-10-18 18:13:47 +02:00
UI_MESSAGE=Send an emergency message
2025-10-16 09:50:36 +02:00
```
2025-10-18 14:34:43 +02:00
2. Run with Docker:
2025-10-16 09:50:36 +02:00
```bash
2025-10-18 14:34:43 +02:00
docker run -d \
--name ntfy-emergency-app \
-p 3000:3000 \
--env-file .env \
2025-10-18 19:07:00 +02:00
ghcr.io/pmartincalvo/ntfy-emergency-app:latest
2025-10-16 09:50:36 +02:00
```
2025-10-17 19:35:19 +02:00
The application will be available at `http://localhost:3000`
2025-10-16 09:50:36 +02:00
2025-10-17 19:35:19 +02:00
### Option 2: Direct Installation
2025-10-16 09:50:36 +02:00
2025-10-17 19:35:19 +02:00
1. Upload files to the server
2. Install Node.js (version 14 or higher)
2025-10-18 14:34:43 +02:00
3. Create a `.env` file with your credentials:
2025-10-16 09:50:36 +02:00
```bash
2025-10-18 14:34:43 +02:00
NTFY_URL=https://your-ntfy-server.com
NTFY_USER=your-username
NTFY_PASSWORD=your-password
NTFY_TOPIC=emergencia
2025-10-18 18:13:47 +02:00
UI_MESSAGE=Send an emergency message
2025-10-16 12:08:18 +02:00
```
2025-10-18 14:34:43 +02:00
4. Install dependencies:
2025-10-16 12:08:18 +02:00
```bash
2025-10-18 14:34:43 +02:00
npm install
2025-10-16 12:08:18 +02:00
```
2025-10-18 14:34:43 +02:00
5. Start the application:
2025-10-16 12:08:18 +02:00
```bash
2025-10-18 14:34:43 +02:00
npm start
2025-10-16 10:02:25 +02:00
```
2025-10-18 14:34:43 +02:00
## Docker Image Publishing
2025-10-16 10:02:25 +02:00
```bash
2025-10-18 14:34:43 +02:00
npm run docker:build-tag-push
```