Skip to content

Commit c27746f

Browse files
Gotify: add optional iGotify container (#388)
* Gotify: add optional iGotify container * Gotify: pre-fill GOTIFY_URLS for iGotify * Gotify: put Configuration before Upgrading and align the table --------- Co-authored-by: Bart <57799908+crypt0rr@users.noreply.github.com>
1 parent 4cd0e04 commit c27746f

3 files changed

Lines changed: 67 additions & 7 deletions

File tree

‎services/gotify/.env‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,15 @@ TZ=Europe/Amsterdam # See: https://en.wikipedia.org/wiki/List_of_tz_database_tim
2323
# Required: password of the user admin that Gotify creates at the first start.
2424
GOTIFY_DEFAULTUSER_PASS=
2525

26+
# Optional: set to igotify to also start the iGotify container for the iOS app, see the README.
27+
COMPOSE_PROFILES=
28+
29+
# iGotify Configuration (only used with the igotify profile)
30+
IGOTIFY_IMAGE_URL=ghcr.io/androidseb25/igotify-notification-assist:latest
31+
# Address at which iGotify reaches Gotify. Keep it: iGotify shares the network of the Tailscale sidecar and reaches Gotify on the loopback address.
32+
GOTIFY_URLS=http://127.0.0.1:80
33+
# Set the next two values after you set up the iGotify app, see the README.
34+
GOTIFY_CLIENT_TOKENS=
35+
SECNTFY_TOKENS=
36+
2637
#EXAMPLE_VAR="Environment variable"

‎services/gotify/README.md‎

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,49 @@ This stack runs Gotify with a Tailscale sidecar, as described in [the standard s
66

77
## At a glance
88

9-
| Item | Value |
10-
| ------------- | --------------------------------- |
11-
| Web interface | `https://gotify.<tailnet>.ts.net` |
12-
| Service port | `80` |
13-
| Image | `gotify/server` |
14-
| Data | `./gotify-data/app/data` |
9+
| Item | Value |
10+
| ------------- | ------------------------------------------------------------- |
11+
| Web interface | `https://gotify.<tailnet>.ts.net` |
12+
| Service port | `80` |
13+
| Image | `gotify/server` |
14+
| Data | `./gotify-data/app/data` |
15+
| iGotify image | `ghcr.io/androidseb25/igotify-notification-assist` (optional) |
16+
| iGotify data | `./gotify-data/igotify` (optional) |
1517

1618
## Before you start
1719

1820
Set `GOTIFY_DEFAULTUSER_PASS` in `.env`. It is the password of the user `admin` that Gotify creates at the first start. Compose stops with an error if it is empty.
1921

2022
## Deviations from the standard setup
2123

22-
None.
24+
- **Optional iGotify container.** The Compose service `igotify` (container `app-gotify-igotify`) only runs when the `igotify` profile is active. It shares the network of the Tailscale sidecar, like the application, and stores its data in `./gotify-data/igotify`. See [iGotify for iPhone and iPad](#igotify-for-iphone-and-ipad).
25+
- **iGotify port.** iGotify listens on port `8080` for its API and device pages. Tailscale Serve does not publish it, but it is reachable at the Tailscale IP address of the device when your Tailnet policy allows it.
2326

2427
## First run
2528

2629
Open the web interface and log in with username `admin` and the password from `GOTIFY_DEFAULTUSER_PASS`. Gotify uses this value only at the first start, so change the password in the web interface afterwards.
2730

2831
In the Gotify app, use `https://gotify.<tailnet>.ts.net` as the server address. The device must be connected to your Tailnet.
2932

33+
## Configuration
34+
35+
### iGotify for iPhone and iPad
36+
37+
Gotify has no iOS app. [iGotify](https://github.com/androidseb25/iGotify-Notification-Assistent) fills that gap: the optional `igotify` container listens to Gotify and forwards each message to the iGotify app on your iPhone or iPad.
38+
39+
Notifications leave your Tailnet on this route. iGotify encrypts each message and sends it over HTTPS to the SecNtfy relay of its author, which hands it to Apple's push service. Skip this section when you do not want that.
40+
41+
The stack uses the "local instance" mode of iGotify, so Gotify stays reachable only through your Tailnet. In this mode the app talks to Gotify directly, and the images of apps and contacts do not show in the iGotify app.
42+
43+
1. Start the stack as usual and install the [iGotify app](https://apps.apple.com/app/igotify/id6473452512) on a device that is connected to your Tailnet.
44+
2. In the app, enter `https://gotify.<tailnet>.ts.net`, turn on the Local Instance toggle, and log in with your Gotify account. The app then shows three values: the Gotify URL, the Gotify client token, and the SecNtfy token.
45+
3. In `.env`, set `COMPOSE_PROFILES=igotify`, and fill in `GOTIFY_CLIENT_TOKENS` and `SECNTFY_TOKENS` with the values from the app. Keep `GOTIFY_URLS=http://127.0.0.1:80` instead of the URL that the app shows: the iGotify container shares the network of the Tailscale sidecar and cannot resolve the MagicDNS name, but it reaches Gotify on the loopback address. The three values go together: if one is missing, the connection fails.
46+
4. Apply the change with `docker compose up -d`.
47+
48+
The two tokens are secrets, so keep them out of anything you publish. Keep `COMPOSE_PROFILES=igotify` in `.env` as long as you use iGotify: without it, `docker compose down` and `docker compose pull` skip the `igotify` container.
49+
50+
To stop using iGotify, run `docker compose --profile igotify down`, empty `COMPOSE_PROFILES` in `.env`, and run `docker compose up -d`. A plain `docker compose down` leaves the `igotify` container behind once the profile is no longer active.
51+
3052
## Upgrading
3153

3254
Earlier versions of this stack set `GOTIFY_DEFAULTUSER_PASS=admin` in `compose.yaml`. The value is now empty in `.env`, and Compose stops with an error until you set it. Gotify reads it only at the first start, so a new value does not change the password of an existing installation. If you still log in as `admin` with the password `admin`, change the password in the web interface.
@@ -35,3 +57,5 @@ Earlier versions of this stack set `GOTIFY_DEFAULTUSER_PASS=admin` in `compose.y
3557

3658
- [Gotify documentation](https://gotify.net/docs/)
3759
- [Gotify source code](https://github.com/gotify/server)
60+
- [iGotify documentation](https://github.com/androidseb25/iGotify-Notification-Assistent/wiki)
61+
- [iGotify source code](https://github.com/androidseb25/iGotify-Notification-Assistent)

‎services/gotify/compose.yaml‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,28 @@ services:
6262
condition: service_healthy
6363
# Healthcheck: defined by the image (curl against /health), so this file does not override it.
6464
restart: always
65+
66+
# Optional iGotify container: forwards Gotify messages to the iGotify iOS app. Start it with the igotify profile.
67+
igotify:
68+
profiles:
69+
- igotify
70+
image: ${IGOTIFY_IMAGE_URL} # Image to be used
71+
network_mode: service:tailscale # Sidecar configuration to route the service through Tailscale
72+
container_name: app-${SERVICE}-igotify # Name for local container management
73+
environment:
74+
- GOTIFY_URLS=${GOTIFY_URLS:-http://127.0.0.1:80} # Gotify on the loopback address of the shared network
75+
- GOTIFY_CLIENT_TOKENS=${GOTIFY_CLIENT_TOKENS:-}
76+
- SECNTFY_TOKENS=${SECNTFY_TOKENS:-}
77+
- TZ=${TZ}
78+
volumes:
79+
- ./${SERVICE}-data/igotify:/app/data
80+
depends_on:
81+
application:
82+
condition: service_healthy
83+
healthcheck:
84+
test: ["CMD", "curl", "-fs", "http://127.0.0.1:8080/Version"] # The image has no HEALTHCHECK, so call the version endpoint of iGotify
85+
interval: 1m # How often to perform the check
86+
timeout: 10s # Time to wait for the check to succeed
87+
retries: 3 # Number of retries before marking as unhealthy
88+
start_period: 10s # Time to wait before starting health checks
89+
restart: always

0 commit comments

Comments
 (0)