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
69 changes: 69 additions & 0 deletions .github/workflows/docker-ghcr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# SPDX-FileCopyrightText: 2026 LibreCode contributors
# SPDX-License-Identifier: MIT
name: Docker GHCR

on:
push:
branches:
- main
tags:
- "v*"
pull_request:
paths:
- ".dockerignore"
- ".github/workflows/docker-ghcr.yml"
- "Cargo.lock"
- "Cargo.toml"
- "Dockerfile"
- "appinfo/info.xml"
- "build.rs"
- "src/**"
workflow_dispatch:

permissions:
contents: read
packages: write

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
flavor: |
latest=auto
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha,prefix=sha-
type=raw,value=edge,enable={{is_default_branch}}

- name: Log in to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# SPDX-License-Identifier: AGPL-3.0-or-later
target
.env
.env.notify_push
bin
build
composer.phar
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ FROM scratch
COPY --from=build /notify_push /
EXPOSE 7867

CMD ["/notify_push"]
ENTRYPOINT ["/notify_push"]
115 changes: 115 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,15 @@

[![REUSE status](https://api.reuse.software/badge/github.com/nextcloud/notify_push)](https://api.reuse.software/info/github.com/nextcloud/notify_push)

Portuguese translation: [README.pt-BR.md](./README.pt-BR.md)

Update notifications for nextcloud clients

## Additional documentation

- Running the container locally and publishing images to GHCR:
[`docs/docker-ghcr.md`](./docs/docker-ghcr.md)

## About

This app attempts to solve the issue where Nextcloud clients have to periodically check the server if any files have
Expand Down Expand Up @@ -286,6 +293,63 @@ Once the nginx configuration is edit you can reload nginx using.
sudo nginx -s reload
```

#### nginx-proxy

If you're using the [`nginx-proxy`](https://github.com/nginx-proxy/nginx-proxy) Docker project, do not add the
`location` block manually to the Nextcloud container. In that setup the `server` block is generated by `nginx-proxy`,
so the simplest approach is to publish `notify_push` on the same host under the `/push/` path.

Example using the generic domain `cloud.example.com`:

```yaml
services:
nextcloud:
image: nextcloud:apache
environment:
VIRTUAL_HOST: cloud.example.com
VIRTUAL_PATH: /
networks:
- nginx-proxy
- internal

notify_push:
image: ghcr.io/nextcloud/notify_push:latest
environment:
PORT: "7867"
VIRTUAL_HOST: cloud.example.com
VIRTUAL_PATH: /push/
VIRTUAL_DEST: /
VIRTUAL_PORT: "7867"
expose:
- "7867"
networks:
- nginx-proxy
- internal
```

Important details:

- `notify_push` must be attached to the same Docker network as `nginx-proxy`
- use `VIRTUAL_PATH=/push/` with the trailing slash
- use `VIRTUAL_DEST=/` so the `/push/` prefix is stripped before forwarding the request
- with `nginx-proxy`, `expose` is usually enough and you do not need to publish port `7867` on the host

If you prefer injecting a custom config snippet into `nginx-proxy`, create a file at
`/etc/nginx/vhost.d/cloud.example.com` with the following block:

```nginx
location ^~ /push/ {
proxy_pass http://notify_push:7867/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
```

Again, both trailing slashes in `/push/` and in `proxy_pass` are required.

#### Apache

To use apache as a reverse proxy you first need to enable the proxy modules using
Expand Down Expand Up @@ -328,6 +392,57 @@ the push server is listening.

The app will automatically run some tests to verify that the push server is configured correctly.

### Testing

After finishing the configuration, test it at several levels:

1. Configure the push server URL in Nextcloud:

```bash
occ app:enable notify_push
occ notify_push:setup https://cloud.example.com/push
```

2. Run the self-test:

```bash
occ notify_push:self-test
```

3. Verify that the proxy responds correctly:

```bash
curl -I https://cloud.example.com/push
curl -I https://cloud.example.com/push/
```

Expected behavior:

- `/push` returns `301` redirecting to `/push/`
- `/push/` does not return `502` or another proxy upstream error

4. Generate a notification in Nextcloud and watch the `notify_push` logs. For example, keep a browser session open in
Nextcloud and create a notification, a Talk message, or a file change. Then verify that the service logs connections
and events.

With Docker Compose:

```bash
docker compose logs -f notify_push
```

If you need more detail while testing, temporarily increase the log level:

```bash
occ notify_push:log debug
```

After verification, restore the previous log level:

```bash
occ notify_push:log --restore
```

### Logging

By default, the push server only logs warnings, you can temporarily change the log level with an occ command
Expand Down
Loading
Loading