|
| 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). |
0 commit comments