
For those who administer servers and / or web projects, there is an acute issue of awareness of what is happening with their “wards”. There are a lot of decisions on failure notification, connection status and other parameters on the market, including via SMS. It's about MRTG, Twilio, F-Droid, Google services, and many, many others. The only problem is that most of these solutions are very narrowly specialized, and it is not possible to influence their functions. MRTG will give information about traffic and connection, Google will send SMS. Some freedom gives Twilio in terms of writing scripts in JavaScript to fit your needs, but I'm sorry, this is a commercial project. That is, "come on, pay the loot or get away."
So, in this family of tools we have an open source replenishment: Gotify is a simple client-server project for receiving and sending push notifications and commands, including through an Android application. And it is definitely worth telling about it in more detail, I think it will be useful for those who were looking for something similar and at the same time free, but eventually started their own pet-project. Quite possibly, this publication will save a couple of hundred hours of your time.
What does Gotify offer?
The project has been peacefully developing for several years and developing on GitHub, and during this time it has acquired a server, a web client, an Android application, an API, and, of course, documentation. I decided to talk about Gotrify for two reasons: it is open source and works not only for “reception”, but also for “return”, all the samples are on GitHub, plus it is configured using bash scripts. And of course, it is free.
')
Most of the existing solutions are aimed solely at receiving notifications from the target server / device, but not at the full interaction between the client and the server. That is, you can receive a notification that your server has crashed or the Internet has disappeared. It’s not always convenient to find out for yourself what is happening on the “other bank” and can be done in the same application / window. Most often, to get this kind of information, you have to hack a VPN or (forgive, my God) any TeamViever and watch it with your hands. Above, I mentioned that Twilio gives some space due to self-signed JS scripts, but this is paid, so by.
In fact, the entire Gotify project is divided into three parts: a server, a client, and an application. The server works as it is clear - to send and receive messages, the client - only to receive, and the application - only to send.

Plus, the project has an API client (and documentation), an API template, a plug-in template, its own website, a Go configuration library that supports JSON, YAML, TOML and environment variables, as well as server build, client, and , Android application. The only thing that may bother is the Android application. There is nothing more helpless, irresponsible and immoral than monitoring infrastructure through a mobile phone in the world. But technology is going forward and we know that sooner or later we will move on to this rubbish. Not that it was the minimum required set to communicate remotely with the server, but when the open source community starts cutting its own tools, it is difficult for it to stop.
Separately, it should be said that to communicate with the server, only authentication and application token is needed, which is returned by the server via the REST request. In the future, using this token, you can receive messages through any http client, for example, through
curl or
HTTPie :
$ curl -X POST "https://push.example.de/message?token=<apptoken>" -F "title=my title" -F "message=my message" -F "priority=5" $ http -f POST "https://push.example.de/message?token=<apptoken>" title="my title" message="my message" priority="5"
According to the manual on the official website of the project, pushy to a server with different priorities can be sent to both Golang and Python:
Golang package main import ( "net/http" "net/url" ) func main() { http.PostForm("http://localhost:8008/message?<apptoken>", url.Values{"message": {"My Message"}, "title": {"My Title"}}) }
Python import requests
It is also possible to write your own plug-ins under Linux and Mac. Here are their available characteristics that are listed on the project website:
- individual plug-ins for each user;
- registering custom http handlers;
- sending messages as an application;
- YAML based configuration system in WebUI;
- persistent storage for each user plugin;
- displaying dynamically generated user instructions.
At the heart of the Gotify plugin system is the standard Go plugin system, which
is described here . What can they be used in Gotify? the developers cite the example of getting webchucks from GitHub, Travis CI and others, polling feeds via RSS, Atom sources and expanding the standard WebUI functionality, and of course delivering alert notifications about crashes.
On this page you can find a template for the plugin and an explanation of the code. For the correct operation of plug-ins, developers recommend using Docker, but without it, it is possible to customize Gotify's operation, although the correct sending and receiving of messages in this case is not guaranteed.
I did not give here the full text of the basic documentation for the project - everything can be read by yourself. Judging by the reviews, the project turned out to be quite thoughtful, at least from the side that does not use SMS-notification (which is inconvenient if you are abroad or in the basement), actively trying to ignore the power-safe mode, which was delivered to Android 6-7 . Gotify is curious at least in that it is open source, that is, free and does not interfere with making a fork, pick up a file, and bring this tool to a state suitable for the needs of certain people / teams.
Links
- GitHub repository.
- The official site of the project.
- API documentation.