Skip to content

Commit d722fbf

Browse files
committed
Add nginx-proxy docs and GHCR publishing
1 parent 499510d commit d722fbf

File tree

4 files changed

+340
-1
lines changed

4 files changed

+340
-1
lines changed

.github/workflows/publish-ghcr.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Publish GHCR Image
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- "v*"
9+
paths:
10+
- ".github/workflows/publish-ghcr.yml"
11+
- "notify_push/**"
12+
- "README.md"
13+
- "README.pt-BR.md"
14+
- "docker-compose.example.yml"
15+
workflow_dispatch:
16+
17+
permissions:
18+
contents: read
19+
packages: write
20+
21+
jobs:
22+
publish:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@v4
27+
28+
- name: Derive image name
29+
id: image
30+
shell: bash
31+
run: echo "name=ghcr.io/${GITHUB_REPOSITORY,,}" >> "$GITHUB_OUTPUT"
32+
33+
- name: Set up QEMU
34+
uses: docker/setup-qemu-action@v3
35+
36+
- name: Set up Docker Buildx
37+
uses: docker/setup-buildx-action@v3
38+
39+
- name: Log in to GHCR
40+
uses: docker/login-action@v3
41+
with:
42+
registry: ghcr.io
43+
username: ${{ github.actor }}
44+
password: ${{ secrets.GITHUB_TOKEN }}
45+
46+
- name: Extract Docker metadata
47+
id: meta
48+
uses: docker/metadata-action@v5
49+
with:
50+
images: ${{ steps.image.outputs.name }}
51+
tags: |
52+
type=raw,value=latest,enable={{is_default_branch}}
53+
type=ref,event=branch
54+
type=ref,event=tag
55+
type=sha
56+
57+
- name: Build and push image
58+
uses: docker/build-push-action@v6
59+
with:
60+
context: ./notify_push
61+
file: ./notify_push/Dockerfile
62+
platforms: linux/amd64,linux/arm64
63+
push: true
64+
tags: ${{ steps.meta.outputs.tags }}
65+
labels: ${{ steps.meta.outputs.labels }}

README.md

Lines changed: 117 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,117 @@
1-
# nextcloud-notify-push-docker
1+
# nextcloud-notify-push-docker
2+
3+
Docker packaging for `notify_push`, with the upstream source vendored in `./notify_push` via `git subtree`.
4+
5+
This repository adds:
6+
7+
- a Portuguese README for the vendored `notify_push` project
8+
- an example deployment behind `nginx-proxy`
9+
- GitHub Actions configuration to publish the image to GHCR
10+
11+
## Repository layout
12+
13+
- `notify_push/`: upstream `nextcloud/notify_push` source tree
14+
- `docker-compose.example.yml`: example deployment with `nginx-proxy`
15+
- `.github/workflows/publish-ghcr.yml`: image publishing workflow for GHCR
16+
17+
## Deploy behind nginx-proxy
18+
19+
Use the same host for Nextcloud and `notify_push`, and route `/push/` to the push service.
20+
21+
Example using the generic domain `cloud.example.com`:
22+
23+
```yaml
24+
services:
25+
nextcloud:
26+
image: nextcloud:apache
27+
environment:
28+
VIRTUAL_HOST: cloud.example.com
29+
VIRTUAL_PATH: /
30+
networks:
31+
- reverse-proxy
32+
- internal
33+
34+
notify_push:
35+
image: ghcr.io/librecodecoop/nextcloud-notify-push-docker:latest
36+
environment:
37+
PORT: "7867"
38+
NEXTCLOUD_URL: "https://cloud.example.com"
39+
REDIS_URL: "redis://redis:6379/0"
40+
DATABASE_URL: "postgres://nextcloud:secret@postgres/nextcloud"
41+
DATABASE_PREFIX: ""
42+
LOG: "info"
43+
VIRTUAL_HOST: cloud.example.com
44+
VIRTUAL_PATH: /push/
45+
VIRTUAL_DEST: /
46+
VIRTUAL_PORT: "7867"
47+
expose:
48+
- "7867"
49+
networks:
50+
- reverse-proxy
51+
- internal
52+
```
53+
54+
Important details:
55+
56+
- `notify_push` must be attached to the same Docker network as `nginx-proxy`
57+
- use `VIRTUAL_PATH=/push/` with the trailing slash
58+
- use `VIRTUAL_DEST=/` so the `/push/` prefix is stripped before forwarding the request
59+
- with `nginx-proxy`, `expose` is usually enough and you do not need to publish port `7867` on the host
60+
61+
## Configure in Nextcloud
62+
63+
Once the service is reachable through the reverse proxy:
64+
65+
```bash
66+
occ app:enable notify_push
67+
occ notify_push:setup https://cloud.example.com/push
68+
occ notify_push:self-test
69+
```
70+
71+
## Test the setup
72+
73+
Verify the proxy responses:
74+
75+
```bash
76+
curl -I https://cloud.example.com/push
77+
curl -I https://cloud.example.com/push/
78+
```
79+
80+
Expected behavior:
81+
82+
- `/push` returns `301` redirecting to `/push/`
83+
- `/push/` does not return `502` or another proxy upstream error
84+
85+
Watch the service logs while generating a Nextcloud notification, Talk message, or file change:
86+
87+
```bash
88+
docker compose logs -f notify_push
89+
```
90+
91+
## Publish to GHCR
92+
93+
The workflow in `.github/workflows/publish-ghcr.yml` builds the image from `notify_push/Dockerfile` and publishes it to
94+
GitHub Container Registry.
95+
96+
It runs on:
97+
98+
- pushes to `main`
99+
- version tags matching `v*`
100+
- manual dispatch
101+
102+
Required repository settings:
103+
104+
- GitHub Actions must be enabled
105+
- the workflow must have `packages: write` permission
106+
107+
The published image name is derived from the repository path, for example:
108+
109+
```text
110+
ghcr.io/librecodecoop/nextcloud-notify-push-docker:latest
111+
ghcr.io/librecodecoop/nextcloud-notify-push-docker:main
112+
```
113+
114+
## Portuguese docs
115+
116+
The Portuguese translation for the vendored upstream README is available at
117+
[`notify_push/README.pt-BR.md`](/home/mohr/git/librecode/nextcloud-notify-push-docker/notify_push/README.pt-BR.md).

README.pt-BR.md

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# nextcloud-notify-push-docker
2+
3+
Empacotamento Docker do `notify_push`, com o codigo-fonte upstream versionado em `./notify_push` via `git subtree`.
4+
5+
Este repositorio adiciona:
6+
7+
- um README em portugues para o projeto `notify_push` vendorizado
8+
- um exemplo de deploy atras do `nginx-proxy`
9+
- a configuracao de GitHub Actions para publicar a imagem no GHCR
10+
11+
## Estrutura do repositorio
12+
13+
- `notify_push/`: arvore de codigo do `nextcloud/notify_push`
14+
- `docker-compose.example.yml`: exemplo de deploy com `nginx-proxy`
15+
- `.github/workflows/publish-ghcr.yml`: workflow de publicacao da imagem no GHCR
16+
17+
## Deploy atras do nginx-proxy
18+
19+
Use o mesmo host para o Nextcloud e para o `notify_push`, roteando `/push/` para o servico de push.
20+
21+
Exemplo usando o dominio generico `cloud.example.com`:
22+
23+
```yaml
24+
services:
25+
nextcloud:
26+
image: nextcloud:apache
27+
environment:
28+
VIRTUAL_HOST: cloud.example.com
29+
VIRTUAL_PATH: /
30+
networks:
31+
- reverse-proxy
32+
- internal
33+
34+
notify_push:
35+
image: ghcr.io/librecodecoop/nextcloud-notify-push-docker:latest
36+
environment:
37+
PORT: "7867"
38+
NEXTCLOUD_URL: "https://cloud.example.com"
39+
REDIS_URL: "redis://redis:6379/0"
40+
DATABASE_URL: "postgres://nextcloud:secret@postgres/nextcloud"
41+
DATABASE_PREFIX: ""
42+
LOG: "info"
43+
VIRTUAL_HOST: cloud.example.com
44+
VIRTUAL_PATH: /push/
45+
VIRTUAL_DEST: /
46+
VIRTUAL_PORT: "7867"
47+
expose:
48+
- "7867"
49+
networks:
50+
- reverse-proxy
51+
- internal
52+
```
53+
54+
Pontos importantes:
55+
56+
- o `notify_push` precisa estar na mesma rede Docker do `nginx-proxy`
57+
- use `VIRTUAL_PATH=/push/` com barra final
58+
- use `VIRTUAL_DEST=/` para remover o prefixo `/push/` antes de encaminhar a requisicao
59+
- em setups com `nginx-proxy`, normalmente `expose` e suficiente e voce nao precisa publicar a porta `7867` no host
60+
61+
## Configuracao no Nextcloud
62+
63+
Depois que o servico estiver acessivel pelo proxy reverso:
64+
65+
```bash
66+
occ app:enable notify_push
67+
occ notify_push:setup https://cloud.example.com/push
68+
occ notify_push:self-test
69+
```
70+
71+
## Como testar
72+
73+
Valide as respostas do proxy:
74+
75+
```bash
76+
curl -I https://cloud.example.com/push
77+
curl -I https://cloud.example.com/push/
78+
```
79+
80+
O comportamento esperado e:
81+
82+
- `/push` responder com `301` para `/push/`
83+
- `/push/` nao responder com `502` ou outro erro de upstream do proxy
84+
85+
Enquanto isso, acompanhe os logs do servico e gere um evento no Nextcloud, como uma notificacao, mensagem no Talk ou
86+
alteracao de arquivo:
87+
88+
```bash
89+
docker compose logs -f notify_push
90+
```
91+
92+
## Publicacao no GHCR
93+
94+
O workflow em `.github/workflows/publish-ghcr.yml` constroi a imagem a partir de `notify_push/Dockerfile` e publica no
95+
GitHub Container Registry.
96+
97+
Ele executa em:
98+
99+
- pushes para `main`
100+
- tags de versao no formato `v*`
101+
- disparo manual
102+
103+
Requisitos do repositorio:
104+
105+
- GitHub Actions habilitado
106+
- permissao `packages: write` para o workflow
107+
108+
O nome final da imagem e derivado do caminho do repositorio, por exemplo:
109+
110+
```text
111+
ghcr.io/librecodecoop/nextcloud-notify-push-docker:latest
112+
ghcr.io/librecodecoop/nextcloud-notify-push-docker:main
113+
```
114+
115+
## Documentacao em portugues do upstream
116+
117+
O README em portugues do projeto vendorizado esta em
118+
[`notify_push/README.pt-BR.md`](/home/mohr/git/librecode/nextcloud-notify-push-docker/notify_push/README.pt-BR.md).

docker-compose.example.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
services:
2+
nextcloud:
3+
image: nextcloud:apache
4+
environment:
5+
VIRTUAL_HOST: cloud.example.com
6+
VIRTUAL_PATH: /
7+
networks:
8+
- reverse-proxy
9+
- internal
10+
11+
notify_push:
12+
image: ghcr.io/librecodecoop/nextcloud-notify-push-docker:latest
13+
environment:
14+
PORT: "7867"
15+
NEXTCLOUD_URL: "https://cloud.example.com"
16+
REDIS_URL: "redis://redis:6379/0"
17+
DATABASE_URL: "postgres://nextcloud:secret@postgres/nextcloud"
18+
DATABASE_PREFIX: ""
19+
LOG: "info"
20+
VIRTUAL_HOST: cloud.example.com
21+
VIRTUAL_PATH: /push/
22+
VIRTUAL_DEST: /
23+
VIRTUAL_PORT: "7867"
24+
expose:
25+
- "7867"
26+
networks:
27+
- reverse-proxy
28+
- internal
29+
- redis
30+
- postgres
31+
32+
networks:
33+
internal:
34+
driver: bridge
35+
reverse-proxy:
36+
external: true
37+
redis:
38+
external: true
39+
postgres:
40+
external: true

0 commit comments

Comments
 (0)